/**
 * VIG-IA Dashboard - Styles
 * 
 * Modern, premium design with dark theme and vibrant accents.
 */

/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #0f172a;
    /* Matched primary for seamless look */
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-hover: rgba(51, 65, 85, 0.6);
    --bg-sidebar: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-card: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    /* Prevent body scroll due to layout */
    height: 100vh;
}

/* Add subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===== Layout Structure ===== */
.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-lg);
    z-index: 10;
}

.sidebar-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.sidebar-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.nav-item .icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-error);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    position: relative;
}

.dashboard-view {
    max-width: 1600px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.view-header h1 {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.view-header p {
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

/* ===== Health Dashboard Styles ===== */

.health-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.chart-container.wide {
    width: 100%;
}

.health-grid-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-lg);
}

/* Data Table */
.table-responsive {
    overflow-x: auto;
}

.health-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-md);
}

.health-table th {
    text-align: left;
    padding: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.health-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.health-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.health-table tr.clickable {
    cursor: pointer;
}

.health-table tr.clickable:hover {
    background: rgba(59, 130, 246, 0.05);
}

.health-table .btn-view {
    padding: 0.4rem 0.8rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.health-table .btn-view:hover {
    background: var(--accent-primary);
    color: white;
}

/* Active Filters */
.active-filters {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.badge-filter {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-secondary);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-filter button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
}

.badge-filter button:hover {
    color: white;
}

/* Login Screen (Adapted) */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: var(--bg-primary);
    /* Full cover */
}

/* Reusing existing components... */
/* [Previous chart-container, metrics-section, etc. styles remain compatible] */

/* Existing styles below for compatibility */
.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.metric-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.metric-content {
    flex: 1;
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--spacing-xs) 0;
    font-variant-numeric: tabular-nums;
}

.metric-sublabel {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.charts-section.dual-layout {
    grid-template-columns: 2fr 1fr;
    align-items: stretch;
}

.efficiency-card-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.ai-rejected-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3) !important;
    height: 100%;
}

.ai-rejected-card .metric-icon {
    color: var(--accent-warning);
}

.ai-rejected-card .metric-value {
    color: var(--accent-warning);
}

.helper-text-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border-left: 4px solid var(--accent-primary);
}

.helper-text-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    font-style: italic;
}

.chart-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    /* Prevent infinite growth */
    height: 400px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Make canvas fill remaining space */
.chart-container canvas {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
}

.chart-container h2 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

/* Logs Section */
.logs-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.logs-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

/* ===== Georeferenced Map Dashboard ===== */

.map-container-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 500px;
}

.map-stats-bar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    gap: var(--spacing-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 5;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-weight: 700;
    color: var(--accent-primary);
}

.main-map-canvas {
    flex: 1;
    width: 100%;
    position: relative;
}

.map-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-secondary);
}

/* Custom Google Maps styles to match theme */
.gm-style .gm-style-iw-c {
    background-color: var(--bg-sidebar) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    padding: var(--spacing-md) !important;
}

.gm-style .gm-style-iw-t::after {
    background: var(--bg-sidebar) !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}

/* Tooltip style for map markers */
.map-tooltip {
    padding: 0.5rem;
}

.map-tooltip h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--accent-primary);
}

.map-tooltip p {
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-secondary);
}

.map-tooltip .badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-top: 5px;
    font-weight: bold;
}

.logs-controls {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.filter-select,
.period-select,
.search-input {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input {
    min-width: 250px;
}

/* Logs Pagination */
.logs-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary {
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Popup / Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
    animation: fadeIn 0.15s ease-out;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: var(--spacing-lg);
}

/* Keep previous content box styles */
.content-box {
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-top: var(--spacing-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Status Badges ===== */
.log-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.log-badge.agravo {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.log-badge.sucesso {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.log-badge.erro {
    background-color: rgba(249, 115, 22, 0.15);
    /* Orange */
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* ===== Audit Report Styles (New) ===== */

.audit-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.audit-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.audit-header {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-content {
    padding: var(--spacing-md);
}

/* Patient Data Grid */
.patient-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
}

.field-label {
    color: var(--text-muted);
    font-weight: 500;
}

.field-value {
    color: var(--text-primary);
}

.field-value.long-text {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
}

/* Evidence Cards */
.evidence-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.evidence-card {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
}

.evidence-term {
    font-weight: 600;
    color: var(--accent-primary);
}

.evidence-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Result Matrix */
.result-matrix {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--spacing-sm);
}

.result-matrix th {
    text-align: left;
    padding: var(--spacing-sm);
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-matrix td {
    padding: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.check-icon {
    font-size: 1.2rem;
    margin-right: var(--spacing-xs);
}

.check-pass {
    color: var(--accent-success);
}

.check-fail {
    color: var(--accent-error);
}

.check-warn {
    color: var(--accent-warning);
}

/* Classification Header highlight */
.classification-banner {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    border: 1px solid transparent;
}

.status-CID_E_ANAMNESE {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.status-CID_APENAS {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.status-SUSPEITA {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

.status-SEM_AGRAVO {
    background: rgba(148, 163, 184, 0.1);
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.status-REJEITADO {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

/* ===== Classification Matrix (Placar) ===== */
.matrix-section {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-md);
}

.matrix-item {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.matrix-item:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.matrix-header {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.badge-status {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-cid-on,
.badge-texto-on {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-cid-off,
.badge-texto-off {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.matrix-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin: var(--spacing-xs) 0;
    font-variant-numeric: tabular-nums;
}

.scenario-1 .matrix-value {
    color: var(--accent-success);
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.scenario-2 .matrix-value {
    color: var(--accent-primary);
}

.scenario-3 .matrix-value {
    color: var(--accent-warning);
}

.scenario-4 .matrix-value {
    color: var(--text-muted);
}

.matrix-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-pct {
    font-size: 0.9rem;
    opacity: 0.6;
    font-weight: 400;
    margin-left: 6px;
    vertical-align: middle;
}

/* Restored Taxa Card Highlight */
.metric-card:has(#metricTaxa) {
    border-color: rgba(139, 92, 246, 0.3);
}

.metric-card:has(#metricTaxa) .metric-icon {
    color: var(--accent-secondary);
}

/* Highlight for Evidence Matching */
.highlight-term {
    background-color: rgba(245, 158, 11, 0.4);
    color: #fff;
    padding: 0 2px;
    border-radius: 3px;
    border-bottom: 2px solid var(--accent-warning);
    font-weight: 600;
}

/* === AI INSPECTOR STYLES === */

.btn-inspect-ia {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-inspect-ia:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.modal.technical-modal {
    z-index: 2000;
    /* Above regular popup */
    background: rgba(0, 0, 0, 0.85);
}

.modal-content.large {
    max-width: 900px;
    width: 95%;
}

.tech-scroll {
    max-height: 80vh;
    overflow-y: auto;
    background: #0b0f1a;
    padding: var(--spacing-lg) !important;
}

.trace-step {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xl);
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
}

.trace-step-header {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.step-idx {
    background: var(--accent-primary);
    color: #fff;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.step-type {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.step-model {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.step-time {
    font-size: 0.75rem;
    margin-left: auto;
    color: var(--accent-secondary);
}

.trace-step-body {
    padding: var(--spacing-md);
}

.trace-block {
    margin-bottom: var(--spacing-md);
}

.trace-block:last-child {
    margin-bottom: 0;
}

.block-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.trace-block pre {
    background: rgba(0, 0, 0, 0.3);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    font-family: 'Roboto Mono', 'monaco', 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Color specific blocks */
.trace-block.system pre {
    color: #94a3b8;
}

.trace-block.user pre {
    color: #38bdf8;
}

.trace-block.response pre {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.03);
    border-color: rgba(251, 191, 36, 0.1);
}

.trace-step-footer {
    background: rgba(0, 0, 0, 0.2);
    padding: 6px var(--spacing-md);
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.loading-trace,
.no-data,
.error-box {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-style: italic;
}

.error-box {
    color: var(--accent-error);
}

/* ===== Health Dashboard Redesign Styles ===== */

/* KPIs Row */
.health-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all var(--transition-normal);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card .kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card.alert {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.kpi-card.alert .kpi-value {
    color: var(--accent-warning);
}

.kpi-card.has-alert {
    animation: pulseAlert 2s infinite;
}

@keyframes pulseAlert {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 15px 3px rgba(245, 158, 11, 0.3);
    }
}

/* Charts Row */
.health-charts-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.chart-container.cid-chart {
    height: 450px;
}

.chart-container.unit-chart {
    height: 450px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.chart-header h2 {
    margin-bottom: 0;
}

/* Filter Badge in Charts */
.filter-badge {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-secondary);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.filter-badge button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

.filter-badge button:hover {
    color: white;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .health-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .chart-container.cid-chart,
    .chart-container.unit-chart {
        height: 380px;
    }
}

@media (max-width: 768px) {
    .health-kpis {
        grid-template-columns: 1fr;
    }

    .kpi-card .kpi-value {
        font-size: 1.5rem;
    }
}