:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --secondary-color: #3b82f6;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #10b981;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: rgba(30, 41, 59, 0.5);
    --bg-hover: rgba(51, 65, 85, 0.5);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition-fast: 150ms;
    --transition-base: 250ms;
    --transition-slow: 350ms;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-hover: rgba(241, 245, 249, 0.8);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: rgba(148, 163, 184, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.navbar {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all var(--transition-base);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

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

.nav-menu a.active {
    color: var(--primary-color);
    background: rgba(16, 185, 129, 0.1);
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    width: 2.5rem;
    height: 2.5rem;
    margin-left: 1rem;
}

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

.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--text-primary);
}

.hello-kitty-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.hello-kitty-logo:hover {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255, 182, 193, 0.1);
}

.hello-kitty-logo svg {
    filter: drop-shadow(0 2px 4px rgba(255, 105, 180, 0.3));
    transition: all var(--transition-fast);
}

.hello-kitty-logo:hover svg {
    filter: drop-shadow(0 4px 8px rgba(255, 105, 180, 0.5));
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
    position: relative;
    z-index: 1;
}

#messages-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;                            /* From 0.75rem → 0.5rem (save ~4px between alerts) */
    margin-bottom: 0.5rem;                  /* From 1rem → 0.5rem (save ~8px before stats) */
}

.message-box {
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideDown var(--transition-base) ease-out;
    position: relative;
    overflow: hidden;
}

.message-normal {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.1), rgba(194, 97, 13, 0.1));
    border: 1px solid rgba(217, 119, 6, 0.3);
}

.message-critical {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(185, 28, 28, 0.2));
    border: 2px solid rgba(220, 38, 38, 0.5);
}

.message-critical {
    animation: slideDown var(--transition-base) ease-out;
}

.message-box.message-critical.show {
    animation: messagePulse 2s infinite !important;
    animation-delay: 0.3s;
}

.message-box.message-critical.pulsing {
    animation: messagePulse 2s infinite !important;
}

.message-informational {
    background: linear-gradient(135deg, rgba(171, 58, 237, 0.1), rgba(155, 40, 217, 0.1));
    border: 1px solid rgba(171, 58, 237, 0.3);
}

.message-normal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #d97706, #c2410c);
}

.message-critical::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #dc2626, #b91c1c);
}

.message-informational::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ab3aed, #9b28d9);
}

.message-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.message-text {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    text-align: center;
}

.message-normal .message-text {
    color: #d97706;
}

.message-critical .message-text {
    color: #dc2626;
    font-weight: 700;
}

.message-informational .message-text {
    color: #ab3aed;
}

.message-close {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
}

.message-close:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.message-close:active {
    transform: scale(0.95);
}

/* Expandable Message Details */
.message-content {
    position: relative;
}

.message-content.expandable {
    cursor: pointer;
}

.message-content.expandable:hover {
    opacity: 0.9;
}

.message-content.expandable::after {
    content: "▼";
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0.7;
    transition: transform var(--transition-fast);
}

.message-content.expanded::after {
    transform: translateY(-50%) rotate(180deg);
}

.message-details {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
    padding-top: 1rem;
    animation: expandDetails var(--transition-base) ease-out;
}

.message-details-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

@keyframes expandDetails {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        margin-top: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 1rem;
        margin-top: 1rem;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
}

.message-box.hiding {
    animation: slideUp var(--transition-base) ease-in;
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

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

.header-title {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.header-title h2 {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: var(--text-muted);
    font-size: 0.975rem;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.clock {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.clock::before {
    content: '🕒';
    font-size: 1.25rem;
}

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

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.stat-card-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-card-change {
    font-size: 0.825rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.stat-card-change.positive {
    color: var(--success-color);
}

.stat-card-change.negative {
    color: var(--danger-color);
}

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

.expanded-card {
    grid-column: 1 / -1;
    max-width: none;
}

.hospital-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.hospital-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.hospital-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(16, 185, 129, 0.3);
}

.hospital-card:hover::after {
    opacity: 1;
}

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

.hospital-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hospital-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-open {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-closed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.hospital-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

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

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    display: block;
}

.stat-value.green {
    color: var(--success-color);
}

.stat-value.orange {
    color: var(--warning-color);
}

.stat-value.red {
    color: var(--danger-color);
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.dropdown-toggle:hover {
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-tertiary));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.dropdown-toggle.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.arrow {
    transition: transform var(--transition-base);
    font-size: 0.875rem;
}

.dropdown-toggle.active .arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

/* Login Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-base);
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-field input {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.login-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.error-message,
.login-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    text-align: center;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    min-width: 120px;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

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

.unit-table th {
    background: var(--bg-secondary);
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.unit-table td {
    padding: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    transition: background-color var(--transition-fast);
}

.unit-table tr:hover td {
    background: var(--bg-hover);
}

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

.arrival-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--warning-color), var(--danger-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pulse-indicator {
    width: 12px;
    height: 12px;
    background: var(--warning-color);
    border-radius: 50%;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes messagePulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.7; 
    }
}

.arrival-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    min-height: 120px;
}

.arrival-unit {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 700;
    font-size: 1.25rem;
    font-family: var(--font-mono);
    color: var(--warning-color);
    border: 2px solid rgba(245, 158, 11, 0.3);
    animation: slideIn var(--transition-slow) ease-out;
    transition: all var(--transition-fast);
}

.arrival-unit:hover {
    transform: scale(1.05);
    border-color: var(--warning-color);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.empty-state {
    color: var(--text-muted);
    padding: 3rem;
    text-align: center;
    width: 100%;
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.empty-state::before {
    content: '✓';
    font-size: 2rem;
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.last-update {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.last-update::before {
    content: '↻';
    font-size: 1rem;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

footer {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

footer p {
    color: var(--text-muted);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

footer a:hover {
    text-decoration: underline;
    color: var(--primary-light);
}

.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
    0% {
        background-color: var(--bg-secondary);
    }
    100% {
        background-color: var(--bg-tertiary);
    }
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 1.5rem;
    }
    
    .hospital-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .nav-brand h1 {
        font-size: 1.25rem;
    }
    
    .nav-brand img {
        width: 48px !important;
        height: 48px !important;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .message-box {
        margin-bottom: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .message-text {
        font-size: 0.875rem;
    }
    
    .message-close {
        min-width: 20px;
        min-height: 20px;
    }
    
    .message-close svg {
        width: 14px;
        height: 14px;
    }
    
    .nav-container {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .nav-brand {
        flex: 1;
        min-width: 200px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .nav-menu li {
        margin: 0.25rem;
    }
    
    .nav-menu a {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .dashboard-header {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .header-title h2 {
        font-size: 1.75rem;
    }

    .header-stats {
        width: 100%;
    }

    .clock {
        width: 100%;
        justify-content: center;
        font-size: 1.25rem;
    }

    .hospital-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hospital-stats {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-card-value {
        font-size: 1.75rem;
    }

    .arrival-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    /* Make tables horizontally scrollable on mobile */
    .current-units-table,
    .historical-units-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    .unit-table {
        min-width: 500px;
        width: 100%;
        table-layout: auto;
    }
    
    /* Visual indicator for scrollable tables */
    .current-units-table::after,
    .historical-units-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, var(--bg-card));
        pointer-events: none;
        opacity: 0.8;
    }
    
    /* Adjust widget header for mobile */
    .widget-header {
        padding: 0.75rem 0.5rem;
    }
    
    .widget-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .widget-title-section h3 {
        font-size: 1.125rem;
    }
    
    .header-stats {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
    
    .status-indicators {
        width: 100%;
    }
    
    .widget-toggle {
        position: absolute;
        right: 1rem;
        top: 1rem;
        margin-left: 0;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .dashboard-container {
        padding: 0.75rem;
    }

    .header-title h2 {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 0.875rem;
    }

    .clock {
        font-size: 1.125rem;
        padding: 0.5rem 1rem;
    }
    
    .hospital-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    .nav-brand img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .nav-brand h1 {
        font-size: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .stat-card-label {
        font-size: 0.75rem;
    }
    
    /* Simplify table on very small screens */
    .unit-table {
        font-size: 0.875rem;
    }
    
    .unit-table th,
    .unit-table td {
        padding: 0.5rem;
    }
    
    /* Hide less critical columns on very small screens */
    @media (max-width: 375px) {
        .unit-table th:nth-child(2),
        .unit-table td:nth-child(2) {
            display: none;
        }
    }
    
    .theme-toggle {
        width: 2rem;
        height: 2rem;
    }
    
    .theme-toggle svg {
        width: 1rem;
        height: 1rem;
    }
    
    /* Adjust header stats for small screens */
    .header-stat-item {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }
    
    .header-stat-label {
        font-size: 0.625rem;
    }
    
    .header-stat-value {
        font-size: 0.75rem;
    }
    
    #providence-stpeter .header-stat-value,
    #multicare-capital .header-stat-value,
    #providence-centralia .header-stat-value,
    #multicare-offcampus .header-stat-value {
        font-size: 0.875rem;
    }
    
    .time-period {
        font-size: 0.5rem;
    }
}

/* Extra Small Mobile Styles */
@media (max-width: 375px) {
    .nav-menu {
        gap: 0.25rem;
    }
    
    .nav-menu a {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .dashboard-container {
        padding: 0.5rem;
    }
    
    .hospital-card {
        padding: 0.75rem;
    }
    
    .widget-title-section h3 {
        font-size: 1rem;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    .widget-header {
        min-height: 48px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .historical-toggle {
        min-height: 44px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .nav-menu a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Add subtle touch feedback */
    .widget-header:active,
    .historical-toggle:active {
        background: var(--bg-hover);
        transform: scale(0.98);
    }
    
    /* Improve scrolling */
    .historical-units-scroll,
    .current-units-table {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Prevent text selection on interactive elements */
    .widget-header,
    .historical-toggle,
    .nav-menu a,
    .theme-toggle {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .navbar {
        position: relative;
        padding: 0.5rem 0;
    }
    
    .nav-container {
        padding: 0.5rem 1rem;
    }
    
    .dashboard-header {
        margin-bottom: 1rem;
    }
    
    .header-title h2 {
        font-size: 1.5rem;
    }
    
    .clock {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    
    .hospital-card {
        padding: 0.75rem;
    }
}

/* High resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hospital-card,
    .stat-card {
        border-width: 0.5px;
    }
}

/* iPad specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .hospital-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .hospital-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ensure proper scrollbar styling on mobile */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Improve text readability on mobile */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

.units-section {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.section-divider {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.divider-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.current-units-table {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.1);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.historical-units-scroll {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 300px;
    overflow-y: auto;
}

.historical-units-scroll::-webkit-scrollbar {
    width: 6px;
}

.historical-units-scroll::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.historical-units-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.historical-units-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.historical-dropdown {
    margin-top: 1rem;
}

.historical-toggle {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.historical-toggle:hover {
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-tertiary));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.historical-toggle.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.historical-toggle .arrow {
    transition: transform var(--transition-base);
    font-size: 0.875rem;
}

.historical-toggle.active .arrow {
    transform: rotate(180deg);
}

.historical-count {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.7;
    font-weight: 400;
}

.historical-content {
    display: none;
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-base);
}

.historical-content.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.collapsible-widget {
    overflow: hidden;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.widget-header:hover {
    background: var(--bg-hover);
}

.widget-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.widget-title-section h3 {
    margin: 0;
}

.header-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto;
}

.header-stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.header-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.time-period {
    font-size: 0.5625rem;
    font-weight: 400;
    text-transform: none;
}

.header-stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

#providence-stpeter .header-stat-value,
#multicare-capital .header-stat-value,
#providence-centralia .header-stat-value,
#multicare-offcampus .header-stat-value {
    font-size: 1.094rem;
}

.header-stat-value.green {
    color: var(--success-color);
}

.header-stat-value.orange {
    color: var(--warning-color);
}

.header-stat-value.red {
    color: var(--danger-color);
}

.status-indicators {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-indicators .hospital-badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    margin: 0;
}

/* Hospital Alert Status - Merged indicator */
.hospital-alert-status {
    display: inline-block;
    padding: 0.25rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--transition-fast);
    width: auto;
    min-width: 140px;
    text-align: center;
}

/* Default status (Normal Operations) - Green */
.hospital-alert-status.status-default {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Normal alert type - Orange */
.hospital-alert-status.status-normal {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

/* Critical alert type - Red (no pulsing) */
.hospital-alert-status.status-critical {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-indicators .hospital-alert-status {
    font-size: 0.625rem;
    padding: 0.25rem 0.75rem;
    margin: 0;
    min-width: 100px;
}

.widget-toggle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    margin-left: 1rem;
    font-weight: 400;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    user-select: none;
}

.widget-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.widget-content {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-base);
}

.widget-content.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.units-section .unit-table th {
    font-size: 0.75rem;
    padding: 0.75rem;
}

.units-section .unit-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
}

.historical-row {
    opacity: 0.8;
}

.historical-row:hover {
    opacity: 1;
    background: var(--bg-hover);
}

@media (max-width: 1200px) {
    .expanded-card {
        grid-column: 1 / -1;
    }
    
    .expanded-card .units-section {
        margin-bottom: 1rem;
    }
    
    .historical-units-scroll {
        max-height: 250px;
    }
    
    .widget-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .header-stats {
        margin-left: 0;
        order: 2;
    }
    
    .status-indicators {
        order: 3;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   iPhone 14 Pro Max Unit Table Optimizations
   ========================================================================== */

/* iPhone 14 Pro Max specific unit table optimizations */
@media (max-width: 430px) {
    /* Remove horizontal scrolling requirement for unit tables */
    .unit-table {
        min-width: 100% !important;          /* Remove 500px requirement */
        table-layout: fixed;                 /* Fixed layout for consistent columns */
        font-size: 0.875rem;                 /* Slightly larger for mobile readability */
    }
    
    /* Optimize column widths for 430px screen */
    .unit-table th:nth-child(1),
    .unit-table td:nth-child(1) {
        width: 25%;                          /* Unit column */
    }
    
    .unit-table th:nth-child(2),
    .unit-table td:nth-child(2) {
        width: 35%;                          /* Hospital/Call column */
    }
    
    .unit-table th:nth-child(3),
    .unit-table td:nth-child(3) {
        width: 40%;                          /* Arrival/Status column */
    }
    
    /* Enhanced mobile table cell styling */
    .unit-table th {
        padding: 0.75rem 0.5rem;            /* Optimized padding */
        font-size: 0.75rem;                 /* Readable header size */
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
    
    .unit-table td {
        padding: 0.75rem 0.5rem;            /* Consistent cell padding */
        vertical-align: top;                 /* Top align for better layout */
        line-height: 1.3;                   /* Better readability */
        word-wrap: break-word;               /* Handle long text */
    }
    
    /* Touch-friendly row heights */
    .unit-table tr {
        min-height: 48px;                   /* Adequate touch target */
    }
    
    /* Remove horizontal scroll container requirements */
    .current-units-table,
    .historical-units-scroll {
        overflow-x: visible !important;      /* No horizontal scroll needed */
    }
    
    /* Improve text wrapping in cells */
    .unit-table td div {
        word-break: break-word;              /* Break long words */
        overflow-wrap: break-word;
    }
    
    /* Optimize duration and ETA displays for mobile */
    .duration-cell {
        font-size: 0.875rem;
        font-weight: 600;
    }
    
    /* Better spacing for unit identification display */
    .unit-table td div[style*="font-size: 0.75rem"] {
        font-size: 0.7rem !important;       /* Slightly smaller incident numbers */
        margin-top: 0.25rem;                /* Small spacing */
        opacity: 0.8;                       /* Subtle appearance */
    }
}

/* Additional optimizations for very narrow screens */
@media (max-width: 390px) {
    /* iPhone 14 Pro and smaller */
    .unit-table {
        font-size: 0.8125rem;               /* Slightly smaller base font */
    }
    
    .unit-table th {
        font-size: 0.6875rem;               /* Smaller headers */
        padding: 0.625rem 0.375rem;         /* Tighter padding */
    }
    
    .unit-table td {
        padding: 0.625rem 0.375rem;         /* Match header padding */
    }
}

/* ==========================================================================
   END iPhone 14 Pro Max Optimizations
   ========================================================================== */

/* ==========================================================================
   DASHBOARD HEADER COMPRESSION
   ========================================================================== */

/* Compress dashboard header to save vertical space */
.dashboard-header {
    margin-bottom: 1.5rem !important;       /* From 2.5rem → 1.5rem (save ~16px) */
    align-items: flex-end;                   /* Align clock to bottom for tighter fit */
}

.header-title {
    gap: 0.25rem;                           /* From 0.5rem → 0.25rem (save ~4px) */
}

.header-title h2 {
    font-size: 1.375rem !important;         /* Smaller than navbar (1.5rem) for proper hierarchy */
    line-height: 1.1;                       /* Tighter line height */
}

.header-subtitle {
    font-size: 0.875rem !important;         /* From 0.975rem → 0.875rem (save ~2px) */
    line-height: 1.2;                       /* Tighter line height */
}

.clock {
    font-size: 1.25rem !important;          /* From 1.5rem → 1.25rem (save ~4px) */
    padding: 0.5rem 1rem;                   /* From 0.75rem 1.5rem → smaller padding */
}

.clock::before {
    font-size: 1rem;                        /* Scale down clock emoji */
}

/* Maintain mobile responsiveness with compression */
@media (max-width: 768px) {
    .header-title h2 {
        font-size: 1.125rem !important;     /* Smaller than navbar (1.25rem) */
    }
    
    .header-subtitle {
        font-size: 0.8125rem !important;    /* Maintain readability */
    }
    
    .clock {
        font-size: 1.125rem !important;     /* Proportional mobile size */
    }
}

@media (max-width: 480px) {
    .header-title h2 {
        font-size: 1rem !important;         /* Smaller than navbar (1.125rem) */
    }
}

/* ==========================================================================
   END DASHBOARD HEADER COMPRESSION
   ========================================================================== */