/* Monitoring Dashboard Styles */

.monitoring-dashboard {
    padding: 20px;
    background-color: #f8f9fa;
    min-height: calc(100vh - 120px);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-header h2 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.dashboard-controls {
    display: flex;
    gap: 10px;
}

.dashboard-controls .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dashboard-controls .btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.dashboard-controls .btn-success {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.dashboard-controls .btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Overview Cards */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease;
}

.overview-card:hover {
    transform: translateY(-2px);
}

.overview-card.healthy {
    border-left: 4px solid #28a745;
}

.overview-card.unhealthy {
    border-left: 4px solid #dc3545;
}

.overview-card.warning {
    border-left: 4px solid #ffc107;
}

.overview-card.success {
    border-left: 4px solid #28a745;
}

.overview-card.info {
    border-left: 4px solid #17a2b8;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.overview-card.healthy .card-icon,
.overview-card.success .card-icon {
    background: #28a745;
}

.overview-card.unhealthy .card-icon {
    background: #dc3545;
}

.overview-card.warning .card-icon {
    background: #ffc107;
}

.overview-card.info .card-icon {
    background: #17a2b8;
}

.card-content h4 {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.card-subtext {
    font-size: 12px;
    color: #999;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.chart-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.chart-controls select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #333;
    font-size: 12px;
}

.chart-container canvas {
    flex: 1;
    max-height: 280px;
}

/* Metrics Tables */
.metrics-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-container h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* Monitoring Tools */
.monitoring-tools {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tool-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: white;
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

.tab-content {
    min-height: 400px;
}

.tab-panel {
    display: none;
    padding: 20px;
}

.tab-panel.active {
    display: block;
}

/* Health Checks */
.health-checks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.health-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 6px;
    background: #f8f9fa;
    border-left: 4px solid #ddd;
}

.health-check-item.healthy {
    border-left-color: #28a745;
    background: #f8fff9;
}

.health-check-item.warning {
    border-left-color: #ffc107;
    background: #fffef8;
}

.health-check-item.unhealthy {
    border-left-color: #dc3545;
    background: #fff8f8;
}

.health-check-item i {
    font-size: 18px;
}

.health-check-item.healthy i {
    color: #28a745;
}

.health-check-item.warning i {
    color: #ffc107;
}

.health-check-item.unhealthy i {
    color: #dc3545;
}

.health-check-item .component {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.health-check-item .status {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.1);
}

.health-check-item.healthy .status {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.health-check-item.warning .status {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.health-check-item.unhealthy .status {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.health-check-item .last-check {
    font-size: 12px;
    color: #999;
}

/* Raw Metrics */
.raw-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.metrics-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.metrics-section pre {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    overflow: auto;
    max-height: 200px;
}

/* Alerts */
.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 6px;
    background: #f8f9fa;
    margin-bottom: 12px;
    border-left: 4px solid #ddd;
}

.alert-item.critical {
    border-left-color: #dc3545;
    background: #fff8f8;
}

.alert-item.warning {
    border-left-color: #ffc107;
    background: #fffef8;
}

.alert-item.info {
    border-left-color: #17a2b8;
    background: #f8ffff;
}

.alert-icon {
    font-size: 18px;
}

.alert-item.critical .alert-icon {
    color: #dc3545;
}

.alert-item.warning .alert-icon {
    color: #ffc107;
}

.alert-item.info .alert-icon {
    color: #17a2b8;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.alert-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.alert-time {
    font-size: 12px;
    color: #999;
}

.alert-actions .btn {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.no-alerts {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .monitoring-dashboard {
        padding: 10px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .dashboard-controls {
        justify-content: center;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .metrics-tables {
        grid-template-columns: 1fr;
    }

    .tool-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 50%;
    }
}

@media (max-width: 480px) {
    .overview-cards {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }

    .tab-btn {
        flex: 1 1 100%;
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.healthy {
    background: #28a745;
}

.status-indicator.warning {
    background: #ffc107;
}

.status-indicator.unhealthy {
    background: #dc3545;
}

.status-indicator.unknown {
    background: #6c757d;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}