/* style.css */

/* Light Mode (Default) */
:root {
    /* Primary Colors */
    --primary-color: #0056b3;
    --accent-color: #007bff;
    --primary-light: #38bdf8;
    
    /* Backgrounds */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-light: #f4f6f9;
    
    /* Text Colors */
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --text-muted: #95a5a6;
    --text-light: #6c757d;
    --text-dark: #333333;
    
    /* Borders & Shadows */
    --border-color: #e9ecef;
    --border-light: #dee2e6;
    --border-lighter: #ececec;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-lg: 0 2px 8px rgba(0,0,0,0.04);
    
    /* UI Elements */
    --white: #ffffff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ff9800;
    --info: #667eea;
    --sidebar-width: 250px;
}

/* Dark Mode */
[data-theme="dark"] {
    /* Primary Colors */
    --primary-color: #38bdf8;
    --accent-color: #38bdf8;
    --primary-light: #0ea5e9;
    
    /* Backgrounds */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-light: #1e293b;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --text-dark: #f1f5f9;
    
    /* Borders & Shadows */
    --border-color: #334155;
    --border-light: #475569;
    --border-lighter: #475569;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-lg: 0 2px 8px rgba(0,0,0,0.3);
    
    /* UI Elements */
    --white: #1e293b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #8b5cf6;
    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Layout Components --- */
.app-container {
    display: flex;
    flex: 1;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar h2 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.nav-links a {
    display: block;
    padding: 12px 15px;
    color: var(--text-dark);
    text-decoration: none;
    margin-bottom: 5px;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    background-color: var(--bg-light);
    color: var(--primary-color);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- Common UI Elements --- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn:hover { opacity: 0.9; }

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

/* --- Login Page Specifics --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
}

.login-container {
    background: var(--white);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* --- Upload Area --- */
.upload-zone {
    border: 2px dashed #ccc;
    padding: 50px;
    text-align: center;
    border-radius: 10px;
    background-color: #fafafa;
    cursor: pointer;
    transition: border 0.3s;
}

.upload-zone:hover { border-color: var(--primary-color); }

/* --- Results & Heatmap --- */
.xray-display {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.xray-display img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.heatmap-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,0,0,0.4) 0%, rgba(0,0,0,0) 70%); /* Fake Heatmap */
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.show-heatmap .heatmap-overlay { opacity: 1; }

.confidence-bar-container {
    background: #e9ecef;
    border-radius: 5px;
    height: 20px;
    margin-top: 10px;
    overflow: hidden;
}

.confidence-bar {
    background: var(--success);
    height: 100%;
    width: 85%; /* Dynamic width */
    text-align: center;
    color: white;
    font-size: 0.8rem;
    line-height: 20px;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid #ddd; }
    .nav-links { display: flex; overflow-x: auto; }
    .nav-links a { margin-right: 10px; white-space: nowrap; }
}

/* ---------------------------------------------------------------------- */
/* Consolidated styles extracted from individual HTML files                */
/* Dashboard page styles (from dashboard.html)                            */
/* ---------------------------------------------------------------------- */
/* NOTE: these were copied verbatim from dashboard.html to preserve layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    padding: 24px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: background 0.3s;
}

.logo {
    display: flex;
    align-items: center;
    padding: 0 24px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
    transition: background 0.3s;
}

.logo-text h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    flex-direction: column;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-links a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-links a.active {
    background: var(--bg-tertiary);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

.nav-links a::before {
    content: '';
    width: 20px;
    height: 20px;
    background-size: contain;
}
/* Normalize icon sizing for inline images, .nav-icon imgs and SVGs */
.nav-links a img,
.nav-links a .nav-icon img,
.nav-links a .nav-icon svg {
    width: 24px;
    height: 24px;
    display: inline-block;
    margin-right: 8px;
    object-fit: contain;
    vertical-align: middle;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    transition: background 0.3s;
}

.top-header {
    background: var(--bg-secondary);
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

.top-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.top-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.top-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex: 0 0 auto;
    transition: background 0.3s;
}

.user-details h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-details p {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    padding: 6px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Sidebar user profile pinned to bottom */
.sidebar .user-info {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
}

.sidebar .user-details {
    min-width: 0; /* allow truncation inside flex */
}

.sidebar .user-details h3,
.sidebar .user-details p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.sidebar .logout-btn {
    margin: 8px 16px 12px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: bold;
    align-self: stretch;
    text-align: center;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
}

.content-wrapper {
    padding: 32px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: background 0.3s;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.info-icon {
    cursor: help;
    color: var(--info);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--info);
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.info-icon:hover {
    background: var(--info);
    color: white;
}

.stat-icon.blue {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-color);
}

.stat-icon.green {
    background: #e8f9f0;
    color: #28a745;
}

.stat-icon.orange {
    background: #fff3e0;
    color: #ff9800;
}

.stat-icon.red {
    background: #ffebee;
    color: #dc3545;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Recent Cases Card */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: background 0.3s;
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.case-list {
    padding: 0;
}

.case-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.2s;
}

.case-item:hover {
    background: var(--bg-tertiary);
}

.case-item:last-child {
    border-bottom: none;
}

.case-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.case-patient {
    min-width: 140px;
}

.case-patient h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.case-age {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.case-details {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.case-id {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.case-severity {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.case-severity.critical {
    background: #ffebee;
    color: #dc3545;
}

.case-severity.moderate {
    background: #fff3e0;
    color: #ff9800;
}

.case-severity.low-risk {
    background: #e8f9f0;
    color: #28a745;
}

.case-confidence {
    font-size: 13px;
    color: var(--text-secondary);
}

.case-date {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 120px;
}

.view-btn {
    padding: 8px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.view-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* ---------------------------------------------------------------------- */
/* New Analysis page styles (from new_analysis.html)                       */
/* ---------------------------------------------------------------------- */
/* These were taken verbatim from new_analysis.html to centralize styles. */
.logo { display:flex; align-items:center; padding:0 8px; margin-bottom:28px; }
.logo-icon { width:36px; height:36px; background:#007bff; border-radius:8px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:600; margin-right:8px }
.logo-text h2{ font-size:16px; font-weight:600; margin-bottom:2px }
.logo-text p{ font-size:11px; color:#95a5a6 }
.nav-links { display:flex; flex-direction:column }
.nav-links a { display:flex; align-items:center; padding:8px 10px; text-decoration:none; color:#5a6c7d; font-size:14px; margin:6px 4px; border-radius:8px; line-height:1; min-height:32px; }
.nav-links a:hover { background:#f8f9fa; color:#2c3e50 }
.nav-links a.active { background:#eef6ff; color:#007bff; font-weight:600 }
.nav-icon { width:40px; height:40px; display:inline-flex; align-items:center; justify-content:center; margin-right:10px; flex-shrink:0; }
.nav-icon img{ width:40px; height:40px; object-fit:contain; display:block; }
.sidebar .user-info { margin-top:auto; padding:12px 16px; border-top:1px solid #e9ecef; display:flex; align-items:center; gap:10px; min-height:56px }
.user-avatar{ width:36px; height:36px; background:#007bff; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:600 }
.logout-btn{ margin:8px 16px 12px; padding:8px 10px; font-size:13px; font-weight:600; align-self:stretch; text-align:center; border-radius:6px; background:white; border:1px solid #dee2e6; color:#5a6c7d }
.main-content {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.top-header { background:white; padding:24px 32px; border-bottom:1px solid #e9ecef }
.top-header h1 { font-size:28px; font-weight:700; margin-bottom:6px }
.top-header p { color:#95a5a6 }
.top-header .page-header-row { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; width:100% }
.top-header .page-header-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap }
.content-wrapper {
    padding: 40px 56px;
    flex: 1 0 auto;
}

/* Footer */
.app-footer {
    width: 100%;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.app-footer-main {
    width: 100%;
    padding: 22px 56px;
    display: flex;
    justify-content: center;
}

.app-footer-col {
    width: 100%;
    max-width: 820px;
    text-align: center;
}

.app-footer-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.app-footer-support {
    display: grid;
    gap: 10px;
    justify-items: center;
}

.app-footer-contact {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    text-align: center;
}

.app-footer-contact-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.app-footer-contact-row svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--accent-color);
}

.app-footer-address {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.app-footer-address address {
    margin: 0;
    font-style: normal;
}

.app-footer-bottom {
    width: 100%;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    padding: 14px 56px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.app-footer-copy {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    max-width: 760px;
}

.app-footer-meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    text-align: right;
    white-space: nowrap;
}

body[data-theme="dark"] .app-footer {
    background: #0f172a;
    border-top-color: #334155;
}

body[data-theme="dark"] .app-footer-title {
    color: #e2e8f0;
}

body[data-theme="dark"] .app-footer-contact,
body[data-theme="dark"] .app-footer-copy {
    color: #cbd5e1;
}

body[data-theme="dark"] .app-footer-bottom {
    background: #111827;
    border-top-color: #334155;
}

body[data-theme="dark"] .app-footer-meta {
    color: #94a3b8;
}

.stepper { display:flex; align-items:center; gap:24px; margin:24px 0 40px }
.step { display:flex; align-items:center; gap:12px }
.step .circle { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#e9ecef; color:#6c757d; font-weight:700 }
.step.active .circle{ background:#007bff; color:white }
.step .label { color:#6c757d }
.step-sep { height:2px; width:60px; background:#e6eef6; border-radius:2px }
.card { background:white; border-radius:12px; box-shadow:0 2px 8px rgba(0,0,0,0.04); padding:28px; width:100% }
.card h3 { margin-bottom:8px; font-size:16px }
.card p { color:#95a5a6; margin-bottom:18px }
.form-row { margin-bottom:16px }
.form-row label { display:block; font-size:13px; margin-bottom:8px; font-weight:600 }
.form-row input { width:100%; padding:12px 14px; border-radius:8px; border:1px solid var(--border-lighter); background:var(--bg-tertiary); color:var(--text-primary); }
.cta { margin-top:22px; display:flex; justify-content:center }
.cta button { background:#05021a; color:white; padding:12px 22px; border-radius:10px; border:none; font-weight:700; cursor:pointer }

/* Phase 6: Notification Styles */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
}

.bell-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 20px;
    display: flex;
    align-items: center;
    position: relative;
    transition: color 0.3s;
}

.bell-btn:hover {
    color: #667eea;
}

[data-theme="dark"] .bell-btn {
    color: #94a3b8;
}

[data-theme="dark"] .bell-btn:hover {
    color: #a5b4fc;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    width: 350px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid var(--border-color);
    transition: background 0.3s;
}

.notification-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* User Role Badge Styles */
.user-role {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    margin-top: 6px;
}

.user-role.role-doctor {
    background: #d3e9f7;
    color: #0066cc;
}

.user-role.role-nurse {
    background: #e8d5f2;
    color: #6b21a8;
}

.user-role.role-admin {
    background: #ffeaa7;
    color: #d63031;
}

[data-theme="dark"] .clear-btn {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .clear-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .user-role.role-doctor {
    background: #164e63;
    color: #38bdf8;
}

[data-theme="dark"] .user-role.role-nurse {
    background: #581c87;
    color: #d8b4fe;
}

[data-theme="dark"] .user-role.role-admin {
    background: #7c2d12;
    color: #fed7aa;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.unread {
    background: var(--bg-tertiary);
    font-weight: 500;
}

.notification-content {
    flex: 1;
}

.notification-type {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.notification-message {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.notification-actions {
    display: flex;
    gap: 4px;
}

.notification-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    padding: 0;
}

.notification-action-btn:hover {
    color: #667eea;
}

.empty-notifications {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Responsive: notification bell in header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .notification-dropdown {
        width: 90vw;
        right: -80vw;
    }
}

@media (max-width:900px){ .sidebar{ position:fixed; left:0; top:0; bottom:0; z-index:30 } .content-wrapper{ padding:20px } }

/* ---------------------------------------------------------------------- */
/* Report page specific styles (from report.html)                         */
/* ---------------------------------------------------------------------- */
.report-paper {
    background: white;
    padding: 40px;
    border: 1px solid #ddd;
    max-width: 800px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------- */
/* New Analysis page styles - centered layout                             */
/* ---------------------------------------------------------------------- */
.content-wrapper.centered-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content-wrapper.centered-content .stepper {
    width: 100%;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
}

.content-wrapper.centered-content .card {
    width: 100%;
    max-width: 700px;
}

/* Center stepper in regular content-wrapper (for upload page) */
.content-wrapper .stepper {
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 600px) {
    .content-wrapper.centered-content {
        max-width: 100%;
        padding: 20px;
    }
    
    .content-wrapper.centered-content .stepper {
        gap: 16px;
        margin-bottom: 32px;
    }
}

/* Role-Based Dashboard Styles */
.case-staff {
    display: block;
    font-size: 12px;
    color: #667eea;
    margin-top: 4px;
    font-weight: 500;
}

.stat-card {
    min-height: 120px;
}

#userManagementCard {
    margin-top: 20px;
}

/* ========== THEME TOGGLE BUTTON ========== */
.theme-toggle-btn {
    background: none;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.theme-toggle-btn.dark-mode {
    color: #fbbf24;
}

.theme-toggle-btn.light-mode {
    color: #3b82f6;
}

/* Icon placement in logo */
.logo {
    position: relative;
}

.logo .theme-toggle-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 6px;
    font-size: 18px;
}

/* ---------------------------------------------------------------------- */
/* Reusable mobile drawer navigation (opt-in via body.mobile-nav-enabled) */
/* ---------------------------------------------------------------------- */
.mobile-nav-enabled .mobile-nav-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #ffffff;
    border: none;
    border-radius: 14px;
    margin: 10px 12px 0;
    position: sticky;
    top: 10px;
    z-index: 1000;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.mobile-nav-enabled .mobile-nav-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #2c3e50;
}

.mobile-nav-enabled .mobile-nav-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid #d4deee;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    transition: all 0.2s ease;
}

.mobile-nav-enabled .mobile-nav-toggle:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
    border-color: #b7c9e8;
    box-shadow: 0 8px 18px rgba(52, 152, 219, 0.22);
    transform: translateY(-1px);
}

.mobile-nav-enabled .mobile-nav-toggle:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

.mobile-nav-enabled .mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1090;
    border: 0;
}

body[data-theme="dark"].mobile-nav-enabled .mobile-nav-bar {
    background: #111827;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
}

body[data-theme="dark"].mobile-nav-enabled .mobile-nav-title {
    color: #f1f5f9;
}

body[data-theme="dark"].mobile-nav-enabled .mobile-nav-toggle {
    background: linear-gradient(180deg, #1f2937 0%, #1b2535 100%);
    border-color: #334155;
    color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.45);
}

body[data-theme="dark"].mobile-nav-enabled .mobile-nav-toggle:hover {
    background: linear-gradient(180deg, #243244 0%, #1f2b3c 100%);
    border-color: #3e5878;
    box-shadow: 0 8px 18px rgba(96, 165, 250, 0.28);
}

@media (max-width: 900px) {
    .mobile-nav-enabled .mobile-nav-bar {
        display: flex;
    }

    .mobile-nav-enabled .top-header {
        margin-bottom: 12px;
        padding: 14px 16px;
    }

    .mobile-nav-enabled .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-width: 82vw;
        z-index: 1100;
        transform: translateX(-105%);
        transition: transform 0.28s ease;
        box-shadow: 2px 0 20px rgba(15, 23, 42, 0.25);
    }

    .mobile-nav-enabled .main-content {
        width: 100%;
    }

    .mobile-nav-enabled .content-wrapper {
        padding: 20px;
    }

    .mobile-nav-enabled.nav-open .sidebar {
        transform: translateX(0);
    }

    .mobile-nav-enabled.nav-open .mobile-nav-overlay {
        display: block;
    }

    .mobile-nav-enabled.nav-open {
        overflow: hidden;
    }
}

/* ---------------------------------------------------------------------- */
/* Mobile comfort pass: reduce squished/compressed layouts                 */
/* ---------------------------------------------------------------------- */
@media (max-width: 900px) {
    .mobile-nav-enabled .top-header {
        border-radius: 12px;
        margin: 8px 12px 0;
        padding: 14px 16px;
    }

    .mobile-nav-enabled .top-header h1 {
        font-size: 24px;
        line-height: 1.2;
    }

    .mobile-nav-enabled .top-header p {
        font-size: 13px;
        line-height: 1.5;
    }

    .mobile-nav-enabled .content-wrapper {
        padding: 16px 14px;
    }

    .mobile-nav-enabled .app-footer-main {
        padding: 18px 14px;
    }

    .mobile-nav-enabled .app-footer-bottom {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .mobile-nav-enabled .app-footer-meta {
        text-align: left;
        white-space: normal;
    }

    .mobile-nav-enabled .card {
        padding: 20px;
    }

    .mobile-nav-enabled .stats-grid,
    .mobile-nav-enabled .metrics-grid,
    .mobile-nav-enabled .charts-grid,
    .mobile-nav-enabled .alerts-metrics-grid,
    .mobile-nav-enabled .results-grid,
    .mobile-nav-enabled .two-col {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .mobile-nav-enabled .stats-row {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-nav-enabled .tabs-container {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav-enabled .tabs-container .tab-btn {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .mobile-nav-enabled .stepper {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 10px;
        margin: 14px 0 20px;
    }

    .mobile-nav-enabled .step-sep {
        display: none;
    }

    .mobile-nav-enabled .button-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mobile-nav-enabled .records-table,
    .mobile-nav-enabled .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav-enabled .case-list {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-nav-enabled .case-list .case-item {
        min-width: 760px;
    }

    .mobile-nav-enabled .case-list .case-details,
    .mobile-nav-enabled .case-list .case-date {
        white-space: nowrap;
    }

    .mobile-nav-enabled table {
        min-width: 680px;
    }
}

@media (max-width: 600px) {
    .mobile-nav-enabled .mobile-nav-bar {
        margin: 8px 10px 0;
        padding: 12px 14px;
        border-radius: 12px;
    }

    .mobile-nav-enabled .mobile-nav-title {
        font-size: 15px;
    }

    .mobile-nav-enabled .top-header {
        margin: 8px 10px 0;
        padding: 12px 14px;
    }

    .mobile-nav-enabled .top-header h1 {
        font-size: 21px;
    }

    .mobile-nav-enabled .content-wrapper {
        padding: 14px 10px;
    }

    .mobile-nav-enabled .app-footer-main {
        padding: 16px 10px;
    }

    .mobile-nav-enabled .app-footer-title {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .mobile-nav-enabled .app-footer-contact,
    .mobile-nav-enabled .app-footer-copy,
    .mobile-nav-enabled .app-footer-meta {
        font-size: 11px;
        line-height: 1.5;
    }

    .mobile-nav-enabled .app-footer-bottom {
        padding: 10px;
        gap: 10px;
    }

    .mobile-nav-enabled .card {
        padding: 16px;
    }

    .mobile-nav-enabled .top-header [style*="display: flex"] {
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .mobile-nav-enabled .top-header .page-header-row {
        align-items: flex-start;
    }

    .mobile-nav-enabled .top-header .page-header-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .mobile-nav-enabled .top-header .download-report-btn,
    .mobile-nav-enabled .top-header #downloadPdfBtn,
    .mobile-nav-enabled .top-header #downloadReportBtn {
        width: 100%;
        justify-content: center;
    }
}
