/* ============================================
   HEALTHTRACK - LIGHT BLUE & WHITE THEME
   Based on your existing structure
   ============================================ */

:root {
    /* Light Blue & White Color Palette */
    --primary-light: #e0f2fe;
    --primary-soft: #bae6fd;
    --primary-medium: #7dd3fc;
    --primary-blue: #38bdf8;
    --primary-dark: #0284c7;
    --primary-deep: #0369a1;
    
    --white: #ffffff;
    --white-soft: #f8fafc;
    --gray-light: #f1f5f9;
    --gray-soft: #e2e8f0;
    --gray-medium: #cbd5e1;
    --gray: #94a3b8;
    --gray-dark: #64748b;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-light: #64748b;
    
    /* Status Colors */
    --success-light: #dcfce7;
    --success: #22c55e;
    --success-dark: #16a34a;
    --warning-light: #fef9c3;
    --warning: #eab308;
    --warning-dark: #ca8a04;
    --danger-light: #fee2e2;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --info-light: #dbeafe;
    --info: #3b82f6;
    
    /* UI Elements */
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-blue: 0 10px 25px -5px rgba(2, 132, 199, 0.2);

    /* Surfaces (cards, headers, modals) vs page background */
    --surface: #ffffff;
    --body-bg: #f4f7fa;
    --control-bg: #eef2f7;
    --control-bg-hover: #e2e8f0;
}

/* ============================================
   DARK THEME
   Applied when <html data-theme="dark">. Same component classes,
   just a different palette - so no per-page overrides are needed.
   ============================================ */
[data-theme="dark"] {
    --primary-light: #0c3a52;
    --primary-soft: #0e4f6e;
    --primary-medium: #1a6d94;
    --primary-blue: #38bdf8;
    --primary-dark: #38bdf8;
    --primary-deep: #7dd3fc;

    --white: #1e293b;
    --white-soft: #1a2332;
    --gray-light: #263242;
    --gray-soft: #334155;
    --gray-medium: #475569;
    --gray: #64748b;
    --gray-dark: #94a3b8;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;

    --success-light: #14321f;
    --success: #22c55e;
    --success-dark: #4ade80;
    --warning-light: #3a2f0d;
    --warning: #eab308;
    --warning-dark: #facc15;
    --danger-light: #3a1418;
    --danger: #ef4444;
    --danger-dark: #f87171;
    --info-light: #142a44;
    --info: #3b82f6;

    --border-light: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -1px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.45), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
    --shadow-blue: 0 10px 25px -5px rgba(56, 189, 248, 0.25);

    --surface: #1e293b;
    --body-bg: #0f172a;
    --control-bg: #334155;
    --control-bg-hover: #3f4f66;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--body-bg);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: var(--surface);
    color: var(--text-primary);
    padding: 1rem 0;
    box-shadow: var(--shadow-md);
    border-bottom: 3px solid var(--primary-blue);
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-logo {
    height: 34px;
    width: 34px;
    border-radius: 8px;
    display: block;
    object-fit: contain;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

/* Hamburger toggle - hidden on desktop, shown on mobile */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--primary-dark);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.65rem;
    border-radius: 5px;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
}

.nav a:hover, .nav a.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.user-info {
    font-weight: 500;
    color: var(--text-primary);
    background: var(--primary-light);
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Theme toggle - modern sliding switch */
.theme-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-switch input {
    display: none;
}

.theme-switch-track {
    position: relative;
    width: 54px;
    height: 28px;
    background: var(--gray-light);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.theme-switch input:checked + .theme-switch-track {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.theme-switch-icon {
    font-size: 12px;
    line-height: 1;
    z-index: 1;
    opacity: 0.85;
    filter: grayscale(0.15);
}

.theme-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
    transform: translateX(26px);
}

.theme-switch:hover .theme-switch-track {
    border-color: var(--primary-blue);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

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

.page-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    background: var(--primary-deep, var(--primary-dark));
}

.btn-secondary {
    background: var(--control-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--control-bg-hover);
    border-color: var(--primary-blue);
}

.btn-warning {
    background: var(--warning);
    color: #1e293b;
}

.btn-warning:hover {
    background: var(--warning-dark, var(--warning));
}

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

.btn-info:hover {
    background: var(--primary-dark);
}

.btn-success:hover { background: var(--success-dark, var(--success)); }
.btn-danger:hover { background: var(--danger-dark, var(--danger)); }

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-link {
    background: none;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
    color: var(--primary-deep);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    border-left: 4px solid var(--primary-blue);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-trend {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: var(--success);
}

/* Dashboard Specific Styles */

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-section h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.welcome-section p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    background: var(--white-soft);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.card-content {
    padding: 1.5rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--white-soft);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 1.2rem;
    color: var(--primary-dark);
}

/* Patients List */
.patients-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.patient-item {
    padding: 1rem;
    background: var(--white-soft);
    border-radius: 8px;
    border-left: 4px solid var(--primary-blue);
}

.patient-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.patient-mrn {
    font-size: 0.8rem;
    color: var(--text-light);
    background: var(--gray-light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.patient-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Readings List */
.readings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reading-item {
    padding: 1rem;
    background: var(--white-soft);
    border-radius: 8px;
    border-left: 4px solid;
}

.reading-item.glucose {
    border-left-color: var(--success);
}

.reading-item.blood_pressure {
    border-left-color: var(--danger);
}

.reading-item.weight {
    border-left-color: var(--warning);
}

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

.reading-type-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.reading-type-badge.glucose {
    background: var(--success-light);
    color: var(--success-dark);
}

.reading-type-badge.blood_pressure {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.reading-type-badge.weight {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.reading-value {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.reading-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Health Alerts */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-item.critical {
    background: var(--danger-light);
    border-left-color: var(--danger);
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-content {
    flex: 1;
}

.alert-value {
    font-weight: 600;
    color: var(--danger-dark);
    margin-top: 0.25rem;
}

.no-alerts {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 1rem;
}

.alert-badge {
    background: var(--danger);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Reading Types Distribution */
.reading-types-distribution {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.type-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--white-soft);
    border-radius: 8px;
}

.type-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.type-color.glucose {
    background: var(--success);
}

.type-color.blood-pressure {
    background: var(--danger);
}

.type-color.weight {
    background: var(--warning);
}

.type-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
}

/* Patient Conditions */
.conditions-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.condition-name {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-primary);
}

.condition-bar {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.condition-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-blue));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.condition-count {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

/* AI Natural-Language Search */
.ai-search-box {
    background: linear-gradient(135deg, var(--primary-light), var(--surface));
    border: 1px solid var(--primary-soft);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.ai-search-box input[type="text"] {
    flex: 1;
    padding: 0.7rem 0.9rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text-primary);
}

.ai-search-box input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* Filters Section */
.filters {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    background: var(--surface);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

/* Content Section */
.content-section {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

/* Readings Grid */
.readings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.reading-card {
    background: var(--white-soft);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary-blue);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.reading-card.glucose {
    border-left-color: var(--success);
}

.reading-card.blood_pressure {
    border-left-color: var(--danger);
}

.reading-card.weight {
    border-left-color: var(--warning);
}

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

.reading-header h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.reading-type {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reading-type.glucose {
    background: var(--success-light);
    color: var(--success-dark);
}

.reading-type.blood_pressure {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.reading-type.weight {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.reading-content {
    margin-bottom: 1rem;
}

.reading-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.reading-date {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.recorded-by {
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

.reading-notes {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--border-light);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* No Data State */
.no-data {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.no-data h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Error State */
.error-message {
    text-align: center;
    padding: 3rem;
    color: var(--danger-dark);
}

.error-message h3 {
    margin-bottom: 1rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--surface);
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close:hover {
    opacity: 1;
}

/* Form Styles */
form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: var(--surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.reading-fields {
    background: var(--white-soft);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-blue);
}

.checkbox-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    transform: scale(1.2);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    font-weight: 600;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

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

.notification.success {
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

.notification.info {
    background: var(--info);
}

.notification.warning {
    background: var(--warning);
    color: var(--text-primary);
}

/* Responsive Design */
/* Switch to hamburger menu before the nav can overflow on real desktop/laptop widths */
@media (max-width: 1080px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .nav-toggle {
        display: flex;
    }

    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        box-shadow: var(--shadow-md);
        border-top: 1px solid var(--border-light);
        padding: 0.5rem;
        z-index: 100;
    }

    .header {
        position: relative;
    }

    .nav.open {
        display: flex;
    }

    .nav a {
        padding: 0.85rem 1rem;
        border-radius: 6px;
        text-align: left;
        font-size: 1rem;
    }

    .user-info {
        margin: 0.5rem 1rem;
        text-align: center;
    }

    .nav .btn {
        margin: 0.5rem 1rem 0.25rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

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

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

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: auto;
    }

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

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

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 1rem;
    }

    .welcome-section h2 {
        font-size: 1.8rem;
    }

    .patient-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .reading-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .stat-card p {
        font-size: 1.5rem;
    }

    .reading-card {
        padding: 1rem;
    }

    .reading-value {
        font-size: 1.2rem;
    }

    .welcome-section {
        padding: 1.5rem;
    }

    .welcome-section h2 {
        font-size: 1.5rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

.hidden {
    display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-dark);
}

/* Print Styles */
@media print {
    .nav, .btn, .filters, .modal {
        display: none !important;
    }
    
    .header {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .reading-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid var(--border-light) !important;
    }
    
    .stat-card {
        box-shadow: none !important;
        border: 1px solid var(--border-light) !important;
    }
}

/* Patients Page Specific Styles */

/* Table Styles */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

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

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.patients-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

.patients-table th {
    background: var(--white-soft);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.patients-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.patients-table tr:last-child td {
    border-bottom: none;
}

.patients-table tr:hover {
    background: var(--primary-light);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.table-info {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Patient Badges and Tags */
.mrn-badge {
    background: var(--primary-blue);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.gender-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.gender-badge.male {
    background: var(--info-light);
    color: var(--info);
}

.gender-badge.female {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.gender-badge.other {
    background: var(--gray-light);
    color: var(--gray-dark);
}

.conditions-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.condition-tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.condition-tag.diabetes {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.condition-tag.hypertension {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.condition-tag.none {
    background: var(--gray-light);
    color: var(--gray-dark);
}

.last-reading {
    color: var(--text-light);
    font-size: 0.85rem;
    font-style: italic;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.3rem;
}

.btn-action {
    background: none;
    border: none;
    padding: 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-action:hover {
    background: var(--gray-light);
    transform: scale(1.1);
}

.btn-action.view:hover {
    background: var(--info-light);
    color: var(--info);
}

.btn-action.add-reading:hover {
    background: var(--success-light);
    color: var(--success-dark);
}

.btn-action.edit:hover {
    background: var(--warning-light);
    color: var(--warning-dark);
}

/* Patient Details Modal */
.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.patient-details {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.detail-section h4 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.detail-item label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 1rem;
}

.conditions-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.condition-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.condition-badge.diabetes {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
}

.condition-badge.hypertension {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.condition-badge.none {
    background: var(--gray-light);
    color: var(--gray-dark);
    border: 1px solid var(--gray);
}

/* Appointment Cards */
.appointment-card {
    background: var(--white-soft);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-blue);
}

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

.appointment-type {
    padding: 0.3rem 0.6rem;
    background: var(--primary-blue);
    color: white;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.appointment-details p {
    margin: 0.3rem 0;
    color: var(--text-secondary);
}

.appointment-notes {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 3px solid var(--border-light);
}

/* Appointment Status Styles */
.appointment-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-badge, .appointment-status {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.scheduled, .appointment-status.scheduled { 
    background: var(--info-light); 
    color: var(--info); 
}
.status-badge.completed, .appointment-status.completed { 
    background: var(--success-light); 
    color: var(--success-dark); 
}
.status-badge.cancelled, .appointment-status.cancelled { 
    background: var(--danger-light); 
    color: var(--danger-dark); 
}
.status-badge.missed, .appointment-status.missed { 
    background: var(--danger); 
    color: white; 
}
.status-badge.no-show, .appointment-status.no-show { 
    background: var(--gray); 
    color: white; 
}

/* Status action buttons */
.btn-status {
    background: none;
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-status.completed:hover { background: var(--success-light); color: var(--success-dark); }
.btn-status.missed:hover { background: var(--danger-light); color: var(--danger-dark); }
.btn-status.cancelled:hover { background: var(--gray-light); color: var(--gray-dark); }

/* Referral Card Styles */
.referral-card {
    background: var(--white-soft);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-blue);
}

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

.referral-patient h4 {
    margin: 0 0 0.3rem 0;
    color: var(--text-primary);
}

.referral-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.referral-priority, .referral-status {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.referral-priority.routine { background: var(--success-light); color: var(--success-dark); }
.referral-priority.urgent { background: var(--warning-light); color: var(--warning-dark); }
.referral-priority.emergency { background: var(--danger-light); color: var(--danger-dark); }

.referral-status.pending { background: var(--warning-light); color: var(--warning-dark); }
.referral-status.accepted { background: var(--success-light); color: var(--success-dark); }
.referral-status.rejected { background: var(--danger-light); color: var(--danger-dark); }
.referral-status.completed { background: var(--info-light); color: var(--info); }

.referral-details {
    margin-bottom: 1rem;
}

.referral-details div {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.referral-notes, .referral-summary {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 3px solid var(--border-light);
}

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

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Referral Type Styles */
.referral-type {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.referral-type.sent { background: var(--primary-blue); color: white; }
.referral-type.received { background: var(--success); color: white; }

/* Different border colors for sent/received */
.referral-card.sent { border-left-color: var(--primary-blue); }
.referral-card.received { border-left-color: var(--success); }

/* Form Sections Styling */
.form-section {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--white-soft);
    border-radius: 8px;
    border-left: 4px solid var(--primary-blue);
}

.form-section h4 {
    margin: 0 0 15px 0;
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-light);
    font-size: 12px;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-family: inherit;
    resize: vertical;
}

/* Visit Type Badges for Display */
.visit-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.visit-badge.new { background: var(--info); color: white; }
.visit-badge.followup { background: var(--primary-blue); color: white; }
.visit-badge.routine { background: var(--success); color: white; }
.visit-badge.emergency { background: var(--warning); color: white; }

/* Reading Type Badges */
.reading-type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.reading-type-badge.glucose_bp_weight { background: var(--primary-dark); color: white; }
.reading-type-badge.glucose_weight { background: var(--info); color: white; }
.reading-type-badge.bp_weight { background: var(--warning); color: white; }

/* ===== MODERN LOGIN STYLES - Light Blue Version ===== */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-soft) 50%, var(--primary-medium) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-50px, -50px) rotate(360deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 2;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px -12px rgba(2, 132, 199, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.login-form input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
    background: var(--surface);
}

.login-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.admin-note {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    background: var(--primary-light);
    border: 1px solid var(--primary-medium);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--primary-dark);
    backdrop-filter: blur(10px);
}

/* ===== PATIENT TRENDS DASHBOARD ===== */
.trends-dashboard {
    padding: 20px;
}

.trends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-blue));
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.trends-header h2 {
    margin: 0 0 10px 0;
    font-size: 1.8rem;
}

.patient-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.patient-badges .badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.reading-count {
    text-align: center;
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 12px;
}

.reading-count .count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.reading-count .label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.stats-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stats-grid-modern .stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 2rem;
    background: var(--primary-light);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--primary-dark);
}

.stat-details {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}

.stat-trend {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 5px;
}

.stat-trend.improving {
    background: var(--success-light);
    color: var(--success-dark);
}

.stat-trend.worsening {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.stat-trend.stable {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.averages-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.averages-section h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.averages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.average-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: var(--white-soft);
    border-radius: 8px;
}

.average-item .label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.average-item .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.charts-section {
    margin-bottom: 20px;
}

.charts-section h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.chart-card h5 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.recent-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.recent-section h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

/* ===== Patient Import Wizard ===== */
.import-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.import-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
}

.import-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-light, #f1f5f9);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.import-step.active .import-step-num {
    background: var(--primary-dark, #0284c7);
    color: white;
}

.import-step.completed .import-step-num {
    background: var(--success, #22c55e);
    color: white;
}

.import-step.active .import-step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.import-step-line {
    width: 60px;
    height: 2px;
    background: var(--border-light, #e2e8f0);
    margin: 0 12px;
}

.import-dropzone {
    border: 2px dashed var(--border-light, #e2e8f0);
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    color: var(--text-light);
}

.import-dropzone:hover, .import-dropzone.dragover {
    border-color: var(--primary-blue, #38bdf8);
    background: var(--primary-light, #e0f2fe);
}

.import-summary-bar {
    background: var(--white-soft, #f8fafc);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.import-row-invalid {
    background: var(--danger-light, #fee2e2) !important;
}

#columnMappingTable select, #validationTable select, #validationTable input {
    padding: 6px 8px;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
}

.readings-table {
    width: 100%;
    border-collapse: collapse;
}

.readings-table th {
    text-align: left;
    padding: 12px;
    background: var(--white-soft);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
}

.readings-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
}

.readings-table tr:hover {
    background: var(--primary-light);
}

.badge.new { background: var(--info); color: white; padding: 4px 8px; border-radius: 4px; }
.badge.followup { background: var(--primary-blue); color: white; padding: 4px 8px; border-radius: 4px; }
.badge.routine { background: var(--success); color: white; padding: 4px 8px; border-radius: 4px; }
.badge.emergency { background: var(--warning); color: white; padding: 4px 8px; border-radius: 4px; }

.badge.normal { background: var(--success-light); color: var(--success-dark); padding: 4px 8px; border-radius: 4px; }
.badge.elevated { background: var(--warning-light); color: var(--warning-dark); padding: 4px 8px; border-radius: 4px; }
.badge.critical { background: var(--danger-light); color: var(--danger-dark); padding: 4px 8px; border-radius: 4px; }

@media (max-width: 768px) {
    .trends-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid-modern {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid-modern {
        grid-template-columns: 1fr;
    }
    
    .averages-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading spinner for export buttons */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}
.check-list { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label.check-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}
.check-option input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: 0;
    padding: 0;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
}
.pagination-bar:empty { display: none; }
.pagination-info, .pagination-page { color: var(--text-secondary, var(--text-primary)); font-size: 0.875rem; }
.pagination-controls { display: flex; align-items: center; gap: 0.75rem; }
.pagination-controls .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Session lock (inactivity) */
.session-lock {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.85);
    padding: 1rem;
}
.session-lock-card {
    background: var(--surface, #fff);
    color: var(--text-primary);
    width: 100%;
    max-width: 380px;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.session-lock-card h3 { margin: 0 0 0.5rem; }
.session-lock-card p { margin: 0 0 1rem; font-size: 0.9rem; opacity: 0.85; }
.session-lock-card input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 6px;
    background: var(--control-bg, #fff);
    color: var(--text-primary);
}
.session-lock-error { color: #dc2626; font-size: 0.85rem; min-height: 1.2em; margin-bottom: 0.5rem; }
.session-lock-actions { display: flex; gap: 0.5rem; }
.session-lock-actions .btn { flex: 1; }
