/**
 * Metrics Dashboard Styles
 * Dark theme with accent colors
 */

/* ============================================================
   LAYOUT
   ============================================================ */

#metrics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #0f172a;
    min-height: 100vh;
    color: #e2e8f0;
}

.metrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.metrics-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
}

.metrics-actions {
    display: flex;
    gap: 0.5rem;
}

.metrics-actions select {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.metrics-actions select:focus {
    outline: none;
    border-color: #6366f1;
}

.btn-icon {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #334155;
    border-color: #6366f1;
}

/* ============================================================
   SUMMARY CARDS
   ============================================================ */

.metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #334155;
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.summary-card .card-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.summary-card .card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.summary-card .card-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Color variants */
.summary-card.color-primary .card-value { color: #6366f1; }
.summary-card.color-success .card-value { color: #22c55e; }
.summary-card.color-warning .card-value { color: #f59e0b; }
.summary-card.color-danger .card-value { color: #ef4444; }
.summary-card.color-info .card-value { color: #3b82f6; }

/* ============================================================
   CHARTS GRID
   ============================================================ */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-container {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #334155;
}

.chart-container.chart-wide {
    grid-column: 1 / -1;
}

.chart-container h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
}

.chart-container canvas {
    max-height: 200px;
}

.chart-container.chart-wide canvas {
    max-height: 250px;
}

/* ============================================================
   AGENT METRICS
   ============================================================ */

.agent-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.agent-metric-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #1e293b;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #334155;
}

.agent-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agent-info {
    flex: 1;
}

.agent-info .agent-name {
    font-weight: 600;
    color: #f8fafc;
}

.agent-info .agent-type {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
}

.agent-stats {
    display: flex;
    gap: 1rem;
}

.agent-stats .stat {
    text-align: center;
}

.agent-stats .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #6366f1;
}

.agent-stats .stat-label {
    font-size: 0.625rem;
    color: #64748b;
    text-transform: uppercase;
}

/* ============================================================
   HEALTH METRICS
   ============================================================ */

.health-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.health-status.healthy {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.health-status.degraded {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.health-status.unhealthy {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.health-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.health-metric {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #1e293b;
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid #334155;
}

.health-metric .metric-icon {
    font-size: 1.5rem;
}

.health-metric .metric-info {
    flex: 1;
}

.health-metric .metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
}

.health-metric .metric-label {
    font-size: 0.75rem;
    color: #64748b;
}

.health-metric .metric-bar {
    width: 60px;
    height: 6px;
    background: #334155;
    border-radius: 3px;
    overflow: hidden;
}

.health-metric .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #22c55e);
    transition: width 0.3s;
}

/* ============================================================
   WEBSOCKET STATS
   ============================================================ */

.ws-stats {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #334155;
    margin-bottom: 1.5rem;
}

.ws-stats h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
}

.ws-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.ws-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ws-stat .label {
    font-size: 0.75rem;
    color: #64748b;
}

.ws-stat .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #f8fafc;
}

/* ============================================================
   EMBEDDING INFO
   ============================================================ */

.embedding-info {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #334155;
}

.embedding-info h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
}

.embedding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.embed-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.embed-stat .label {
    font-size: 0.75rem;
    color: #64748b;
}

.embed-stat .value {
    font-size: 0.875rem;
    font-weight: 500;
    color: #f8fafc;
}

/* ============================================================
   NOTIFICATIONS
   ============================================================ */

#notifications {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 350px;
}

.notification {
    background: #1e293b;
    border-radius: 8px;
    border: 1px solid #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

.notification-critical {
    border-left: 4px solid #ef4444;
}

.notification-high {
    border-left: 4px solid #f97316;
}

.notification-medium {
    border-left: 4px solid #f59e0b;
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #f8fafc;
}

.notification-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

.notification-close:hover {
    color: #f8fafc;
}

.notification-body {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================
   CONNECTION STATUS
   ============================================================ */

#ws-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.ws-connected {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.ws-disconnected {
    background: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    #metrics-dashboard {
        padding: 1rem;
    }

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

    .metrics-summary {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .ws-grid {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ============================================================
   PANEL SECTIONS
   ============================================================ */

.metrics-panel {
    background: #0f172a;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #1e293b;
}

/* Navbar integration */
.metrics-nav {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}

.metrics-nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.metrics-nav a:hover,
.metrics-nav a.active {
    color: #f8fafc;
    background: #334155;
}

/* Tab panels */
.tab-content {
    display: none;
}

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