/* Core Theme & Variables */
:root {
    --bg-main: #0a0d18;
    --bg-sidebar: #060810;
    --card-bg: rgba(16, 22, 38, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(239, 68, 68, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #ef4444; /* Emergency Red */
    --primary-glow: rgba(239, 68, 68, 0.3);
    --secondary: #3b82f6; /* Info Blue */
    --success: #10b981; /* Green */
    --warning: #f59e0b; /* Yellow */
    --dark-red: #991b1b;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.sidebar-brand i {
    color: var(--primary);
}

.plus-symbol {
    color: var(--primary);
}

.pulsing-icon {
    animation: heartPulse 1.5s infinite;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes gpsPulse {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

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

.menu-item.active {
    color: var(--text-primary);
    background-color: rgba(239, 68, 68, 0.15);
    border-left: 3px solid var(--primary);
    padding-left: calc(1rem - 3px);
}

.disaster-menu-btn {
    margin-top: auto;
    color: var(--warning);
    background-color: rgba(245, 158, 11, 0.05);
}

.disaster-menu-btn:hover {
    color: #fff;
    background-color: rgba(245, 158, 11, 0.2);
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    font-size: 1.1rem;
    color: var(--secondary);
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Workspace */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Persistent Header */
.main-header {
    height: 80px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background-color: rgba(10, 13, 24, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.header-left h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.current-time-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Language Dropdown */
.lang-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
}

.lang-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

/* Header buttons */
.header-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.header-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-main);
}

.voice-btn {
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--secondary);
}

.voice-btn.recording {
    background: rgba(59, 130, 246, 0.2);
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* SOS Button */
.sos-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 0 15px var(--primary-glow);
    animation: pulseSOSButton 2s infinite;
    transition: var(--transition);
}

.sos-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

@keyframes pulseSOSButton {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Notification Dropdown List */
.notification-dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: #0f1322;
    border: 1px solid var(--card-border);
    min-width: 320px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 200;
}

.dropdown-content.show {
    display: block;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-header h4 {
    font-size: 0.9rem;
}

.dropdown-header a {
    font-size: 0.75rem;
    color: var(--secondary);
    text-decoration: none;
}

.dropdown-items {
    max-height: 250px;
    overflow-y: auto;
}

.noti-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.noti-item:hover {
    background: rgba(255,255,255,0.02);
}

.noti-item.unread {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--secondary);
}

/* Floating Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.toast-alert {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid #3b82f6;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s ease;
}

.toast-critical {
    border-left-color: #ef4444;
    background: rgba(30, 10, 15, 0.95);
}

.toast-transit {
    border-left-color: #60a5fa;
}

.toast-success {
    border-left-color: #10b981;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* View Panels */
.view-panel {
    display: none;
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.view-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.glass {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
}

.metric-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.metric-card:hover {
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-right: 1rem;
}

.metric-icon.blood {
    background: rgba(239, 68, 68, 0.15);
    color: var(--primary);
}

.metric-icon.beds {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.metric-icon.ambulance {
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary);
}

.metric-icon.response {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.metric-data h3 {
    font-size: 1.6rem;
    font-weight: 700;
}

.metric-data p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trend {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.trend.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.trend.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--primary);
}

.trend.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Dashboard Row Configurations */
.dashboard-main-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    min-height: 320px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

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

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-body {
    flex: 1;
    position: relative;
}

.action-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: rgba(255,255,255,0.1);
}

.ai-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Broadcast feed */
.broadcast-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 250px;
    overflow-y: auto;
}

.broadcast-card {
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.broadcast-card:hover {
    background: rgba(255,255,255,0.04);
}

.broadcast-card.critical {
    border-left: 4px solid var(--primary);
    background: rgba(239, 68, 68, 0.03);
}

.broadcast-card.high {
    border-left: 4px solid var(--warning);
    background: rgba(245, 158, 11, 0.03);
}

.b-meta h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.b-meta p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Map Container & Card Styles */
.map-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.map-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.map-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-title i {
    color: var(--primary);
}

.map-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.map-container {
    width: 100%;
    height: 420px;
    min-height: 420px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    z-index: 1;
    border: 1px solid var(--card-border);
    background: rgba(15, 23, 42, 0.6);
}

#donor-map,
#ambulance-map,
#transport-map,
#disaster-map {
    width: 100%;
    height: 420px;
    min-height: 420px;
    border-radius: 12px;
}

.b-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
}

.b-tag.critical {
    background: rgba(239,68,68,0.2);
    color: var(--primary);
}

.b-tag.high {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.b-tag.medium {
    background: rgba(59, 130, 246, 0.2);
    color: var(--secondary);
}

/* AI Insights list */
.prediction-insights {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-item {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.insight-item.warning {
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.insight-item.safe {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}

/* Dashboard Bottom Row */
.dashboard-sub-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.blood-stock-indicator {
    padding: 0.85rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.blood-stock-indicator.red {
    border-left: 3px solid var(--primary);
}

.blood-stock-indicator.yellow {
    border-left: 3px solid var(--warning);
}

.blood-stock-indicator.green {
    border-left: 3px solid var(--success);
}

.blood-type {
    font-size: 1rem;
    font-weight: 700;
}

.stock-progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.stock-progress-bar .progress {
    height: 100%;
}

.red .progress { background: var(--primary); }
.yellow .progress { background: var(--warning); }
.green .progress { background: var(--success); }

.stock-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Resource sharing list */
.sharing-requests-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.share-item {
    padding: 0.85rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-info {
    display: flex;
    flex-direction: column;
}

.share-info strong {
    font-size: 0.85rem;
}

.share-info span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-outline:hover {
    background: var(--secondary);
    color: #fff;
}

/* Two Column Layouts */
.two-column-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 120px);
}

.left-panel {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.panel-section {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.border-top {
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

/* Forms styling */
.w-100 {
    width: 100% !important;
    box-sizing: border-box !important;
}

.form-group {
    margin-bottom: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    box-sizing: border-box;
}

.form-group label {
    display: block !important;
    width: 100%;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.form-control {
    width: 100% !important;
    box-sizing: border-box !important;
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100% !important;
    box-sizing: border-box !important;
    padding-right: 42px !important;
}

.password-input-wrapper i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    z-index: 2;
}

.form-control:focus {
    border-color: var(--secondary);
    background: rgba(255,255,255,0.06);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #dc2626;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
    border: none;
    padding: 0.65rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #2563eb;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Map Card */
.map-card {
    height: 380px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.map-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.map-container {
    flex: 1;
    background: #111422;
}

/* Map style corrections */
.leaflet-container {
    background: #0f1222 !important;
}

/* Donor Results Panel */
.donor-results-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.results-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.results-table th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-weight: 600;
}

.results-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 700;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-badge.cooldown {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

/* Bed controls / Sliders */
.bed-slider-group {
    margin-bottom: 1.25rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.slider-value {
    font-weight: 700;
    color: var(--secondary);
}

.range-slider {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    outline: none;
    border-radius: 10px;
    accent-color: var(--secondary);
}

.hospital-beds-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.hospital-bed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    transition: var(--transition);
}

.hospital-bed-item:hover {
    background: rgba(255,255,255,0.04);
}

.h-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.h-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.h-beds-counts {
    display: flex;
    gap: 0.75rem;
}

.bed-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
}

.bed-badge .b-count {
    font-size: 0.9rem;
    font-weight: 700;
}

.bed-badge .b-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.bed-badge.critical {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--primary);
}

/* Ambulance list */
.ambulance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 350px;
    overflow-y: auto;
}

.ambulance-card {
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.ambulance-card:hover {
    background: rgba(255,255,255,0.04);
}

.a-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.a-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge-pulse {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    animation: pulseBadge 2s infinite;
}

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

.amb-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 700;
}

.amb-status.available { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.amb-status.transit { background: rgba(59, 130, 246, 0.15); color: var(--secondary); }
.amb-status.delayed { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* Community / Camps list */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.leaderboard-item .rank {
    width: 24px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
}

.leaderboard-item.gold .rank { color: #ffd700; }
.leaderboard-item.silver .rank { color: #c0c0c0; }
.leaderboard-item.bronze .rank { color: #cd7f32; }

.leaderboard-item .info {
    flex: 1;
    margin-left: 0.75rem;
}

.leaderboard-item .info strong {
    font-size: 0.85rem;
    display: block;
}

.leaderboard-item .info span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.leaderboard-item .points {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--secondary);
}

.camps-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.camp-card-item {
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camp-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.camp-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Digital Health Card */
.health-card-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-card-layout {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
}

.health-card-layout::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.card-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-blood-type {
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.card-body-hc {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.card-details {
    flex: 1;
}

.card-details h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.card-details p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.card-details strong {
    color: var(--text-primary);
}

.card-qrcode {
    width: 100px;
    height: 100px;
    background: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.card-qrcode canvas {
    width: 100% !important;
    height: 100% !important;
}

.card-footer-hc {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 0.75rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Disaster Management Mode Styling */
.disaster-alert-header {
    background: linear-gradient(90deg, #7f1d1d 0%, #450a0a 100%);
    border: 1px solid var(--primary);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.disaster-alert-header h2 {
    font-size: 1.3rem;
    color: #fff;
    letter-spacing: 0.05em;
}

.disaster-alert-header p {
    font-size: 0.8rem;
    color: #fca5a5;
    margin-top: 0.25rem;
}

.warning-flash {
    font-size: 2.2rem;
    color: var(--primary);
    margin-right: 1rem;
    animation: flashAlert 1s infinite alternate;
}

@keyframes flashAlert {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--primary)); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 15px var(--primary)); }
}

.btn-deactivate {
    background: transparent;
    border: 1px solid #fca5a5;
    color: #fca5a5;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-deactivate:hover {
    background: #7f1d1d;
    color: #fff;
}

.border-alert {
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-danger-action {
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 0.75rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-action:hover {
    background: #b91c1c;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-warning-action {
    background: var(--warning);
    border: none;
    color: #fff;
    padding: 0.75rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-warning-action:hover {
    background: #d97706;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.disaster-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.d-stat-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

.d-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.d-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.text-green { color: var(--success); }
.text-red { color: var(--primary); }

/* Global Disaster State Class on body */
body.disaster-active {
    --bg-main: #110808;
    --bg-sidebar: #0a0303;
    --card-bg: rgba(26, 12, 12, 0.7);
    --card-border: rgba(239, 68, 68, 0.15);
    --primary: #f87171;
    --secondary: #fb7185;
}

body.disaster-active .sidebar-brand i {
    color: #f87171;
}

body.disaster-active .menu-item.active {
    background: rgba(248, 113, 113, 0.15);
    border-color: #f87171;
}

/* AI Assistant Drawer */
.ai-assistant-drawer {
    position: fixed;
    right: -360px;
    top: 0;
    width: 360px;
    height: 100vh;
    background: #0d111d;
    border-left: 1px solid var(--card-border);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-assistant-drawer.open {
    right: 0;
}

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

.drawer-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
}

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

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    max-width: 85%;
    line-height: 1.4;
}

.message ul {
    margin-left: 1.2rem;
    margin-top: 0.4rem;
}

.message.ai {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    align-self: flex-start;
}

.message.user {
    background: var(--secondary);
    color: #fff;
    align-self: flex-end;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 0.5rem;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--card-border);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.chat-input-area input:focus {
    border-color: var(--secondary);
}

.chat-input-area button {
    background: var(--secondary);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SOS Fullscreen Overlay Screen */
.sos-overlay-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 3, 3, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.sos-overlay-screen.show {
    display: flex;
}

.sos-alert-box {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
    background: rgba(26, 8, 8, 0.8);
    border: 2px solid var(--primary);
    border-radius: 30px;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.alert-ring {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 2px dashed var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotateRing 8s linear infinite;
}

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

.pulsing-sos-icon {
    font-size: 2.5rem;
    color: var(--primary);
    animation: pulseIcon 1.5s infinite alternate;
}

@keyframes pulseIcon {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

.sos-alert-box h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #fff;
    letter-spacing: 0.05em;
}

.sos-alert-box p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sos-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    overflow: hidden;
}

.sos-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.notified-services {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.service-chip {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-chip.active {
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.05);
}

.btn-cancel-sos {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: var(--transition);
}

.btn-cancel-sos:hover {
    border-color: #fff;
    color: #fff;
}

/* Voice Command Modal */
.voice-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 13, 24, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.voice-modal.show {
    display: flex;
}

.voice-modal-content {
    text-align: center;
    background: rgba(16, 22, 38, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 3rem;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
}

.waveform .bar {
    width: 4px;
    height: 10px;
    background: var(--secondary);
    border-radius: 10px;
    animation: wave 1.2s ease-in-out infinite;
}

.waveform .bar:nth-child(2) { animation-delay: 0.15s; }
.waveform .bar:nth-child(3) { animation-delay: 0.3s; }
.waveform .bar:nth-child(4) { animation-delay: 0.45s; }
.waveform .bar:nth-child(5) { animation-delay: 0.6s; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

.transcript-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-close-voice {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* Broadcast Alert Modals */
.broadcast-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}

.broadcast-modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
    border-radius: 16px;
    position: relative;
}

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

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

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Map Custom Styling details */
.leaflet-popup-content-wrapper {
    background: #111528 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 10px !important;
}

.leaflet-popup-tip {
    background: #111528 !important;
}

.leaflet-popup-content h4 {
    font-family: var(--font-heading);
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--primary);
}

.leaflet-popup-content p {
    font-size: 11px;
    margin: 2px 0;
    color: var(--text-secondary);
}

.leaflet-popup-content button {
    background: var(--secondary);
    color: #fff;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-top: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* Responsiveness fixes */
@media (max-width: 1024px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: visible;
    }
    .left-panel, .right-panel {
        overflow-y: visible;
        height: auto;
    }
    .main-content {
        overflow-y: auto;
        width: 100%;
        max-width: 100vw;
    }
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }
}

/* Brand Logo Styling */
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--primary-glow);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Light Theme Variables and Rules */
body.light-theme {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(15, 23, 42, 0.08);
    --card-hover-border: rgba(239, 68, 68, 0.5);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary: #dc2626;
    --primary-glow: rgba(220, 38, 38, 0.15);
    --secondary: #2563eb;
    --success: #16a34a;
    --warning: #d97706;
}

body.light-theme .main-header {
    background-color: rgba(248, 250, 252, 0.8);
}

body.light-theme .dropdown-content {
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body.light-theme .map-container,
body.light-theme .leaflet-container {
    background: #e2e8f0 !important;
}

body.light-theme .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.1) !important;
}

body.light-theme .leaflet-popup-tip {
    background: #ffffff !important;
}

body.light-theme .leaflet-popup-content p {
    color: #475569;
}

body.light-theme .form-control {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.15);
}

body.light-theme .form-control:focus {
    background: #ffffff;
    border-color: var(--secondary);
}

body.light-theme .chat-input-area input {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.15);
}

body.light-theme .voice-modal-content {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

body.light-theme .results-table td {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.25);
}

body.light-theme .header-btn {
    background: rgba(15, 23, 42, 0.04);
}
body.light-theme .header-btn:hover {
    background: rgba(15, 23, 42, 0.08);
}

/* Startup Auth & Login Overlay Styles */
.auth-overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 15% 25%, rgba(239, 68, 68, 0.15), transparent 45%),
                radial-gradient(circle at 85% 75%, rgba(59, 130, 246, 0.18), transparent 45%),
                radial-gradient(circle at 50% 50%, #0f172a, #090d1a);
    background-size: 200% 200%;
    animation: authGlowShift 12s ease infinite alternate;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 1rem;
    overflow-y: auto;
    box-sizing: border-box;
}

@keyframes authGlowShift {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.auth-box {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: fadeInScale 0.3s ease-out;
    box-sizing: border-box;
}

.auth-box::-webkit-scrollbar {
    width: 6px;
}
.auth-box::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.auth-box::-webkit-scrollbar-thumb {
    background: rgba(239, 68, 68, 0.5);
    border-radius: 3px;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.auth-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.auth-header h2 span.plus-symbol {
    color: var(--primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.role-selector-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.role-chips {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.role-chip {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.02);
}

.role-chip i {
    font-size: 1.2rem;
}

.role-chip:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.2);
}

.role-chip.active {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Light Theme overrides for Auth Screen */
body.light-theme .auth-overlay-screen {
    background: radial-gradient(circle at center, rgba(241, 245, 249, 0.98), rgba(226, 232, 240, 0.99));
}

body.light-theme .auth-box {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

body.light-theme .role-chip {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
}

body.light-theme .role-chip:hover {
    background: rgba(15, 23, 42, 0.02);
    border-color: rgba(15, 23, 42, 0.2);
}

body.light-theme .role-chip.active {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--primary);
}

/* Global Search Bar Styling */
.header-search {
    position: relative;
    margin-left: 2rem;
    margin-right: auto;
    width: 320px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.2rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.header-search input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    outline: none;
}

.search-results-dropdown {
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    max-height: 250px;
    overflow-y: auto;
    z-index: 10000;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-result-item i {
    position: static;
    transform: none;
    font-size: 1rem;
}

.search-result-item span {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .item-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: bold;
}

.search-result-item .role-hospital { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.search-result-item .role-donor { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.search-result-item .role-driver { background: rgba(16, 185, 129, 0.2); color: #10b981; }

.no-results-item {
    padding: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Profile Card Styling */
.profile-card {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--card-border);
}

.profile-header-accent {
    height: 120px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
}

.profile-content {
    padding: 2rem;
    text-align: center;
    position: relative;
    margin-top: -60px;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    background: #1e293b;
    border: 4px solid #0f172a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
    color: var(--text-primary);
}

.profile-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    text-align: left;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
}

.detail-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

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

/* ── Ambulance Marker Popup ─────────────────────────────────── */
.amb-popup .leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

.amb-popup .leaflet-popup-content {
    margin: 14px 16px;
}

.amb-popup .leaflet-popup-tip-container {
    margin-top: -1px;
}

.amb-popup .leaflet-popup-tip {
    background: #ffffff;
}

/* ==========================================================================
   Comprehensive Fit-To-Window Responsiveness (Mobile, Tablet, Laptop)
   ========================================================================== */

/* Universal No-Horizontal-Overflow Guarantee */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9998;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
}

.mobile-toggle-btn {
    display: none;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 13, 24, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 99990;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
    box-sizing: border-box;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex: 1;
    text-decoration: none;
}

.mobile-nav-item i {
    font-size: 1.15rem;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active i {
    color: var(--primary);
}

/* 1. Mobile & Tablet Drawer Layout (Screens <= 1024px) */
@media (max-width: 1024px) {
    body {
        overflow-y: auto;
        height: auto;
        min-height: 100dvh;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100dvh;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Mobile Drawer Sidebar - completely off-canvas by default */
    .mobile-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--card-border);
        color: var(--text-primary);
        border-radius: 8px;
        cursor: pointer;
        font-size: 1rem;
        flex-shrink: 0;
        margin-right: 6px;
    }

    .sidebar-close-btn {
        display: inline-flex !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        background: #090d1a !important;
        border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8) !important;
        z-index: 100000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        padding: 1.25rem 1rem !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }

    .view-panel {
        padding-bottom: 75px !important;
    }

    /* Mobile Header Fit */
    .main-header {
        height: auto !important;
        min-height: 56px !important;
        padding: 0.65rem 0.85rem !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        background: rgba(10, 13, 24, 0.95) !important;
        border-bottom: 1px solid var(--card-border) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .header-left {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    .header-left h2 {
        font-size: 1.05rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .current-time-text {
        display: none !important;
    }

    #live-location-badge {
        display: none !important;
    }

    .header-search {
        order: 3 !important;
        width: 100% !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .header-right {
        gap: 0.35rem !important;
        margin-left: auto;
    }

    .header-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
        font-size: 0.85rem !important;
    }

    .lang-selector {
        padding: 0.35rem 0.45rem !important;
        font-size: 0.75rem !important;
    }

    .lang-selector select {
        font-size: 0.75rem !important;
    }

    /* Main Content & View Panels */
    .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        height: auto !important;
    }

    .view-panel {
        padding: 0.75rem !important;
        height: auto !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Metrics Grid: 2 columns on mobile */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
    }

    .metric-card {
        padding: 0.75rem 0.65rem !important;
        border-radius: 10px !important;
    }

    .metric-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.95rem !important;
        margin-right: 0.4rem !important;
    }

    .metric-data h3 {
        font-size: 1.15rem !important;
    }

    .metric-data p {
        font-size: 0.7rem !important;
    }

    /* Stacking Layouts */
    .dashboard-main-row,
    .two-column-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        height: auto !important;
        overflow: visible !important;
    }

    .left-panel, .right-panel {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Auth Box on Mobile */
    .auth-overlay-screen {
        padding: 10px !important;
        align-items: center !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
    }

    .auth-box {
        padding: 1.15rem 0.9rem !important;
        width: 100% !important;
        max-width: 440px !important;
        border-radius: 14px !important;
        margin: auto !important;
        box-sizing: border-box !important;
        max-height: 94dvh !important;
        overflow-y: auto !important;
    }

    .auth-header {
        margin-bottom: 0.75rem !important;
    }

    .auth-header h2 {
        font-size: 1.35rem !important;
    }

    .auth-header p {
        font-size: 0.78rem !important;
    }

    .auth-tabs {
        margin-bottom: 12px !important;
    }

    .role-chips {
        display: flex !important;
        gap: 0.35rem !important;
        margin-bottom: 0.75rem !important;
    }

    .role-chip {
        flex: 1 !important;
        padding: 0.5rem 0.2rem !important;
        font-size: 0.75rem !important;
    }

    .role-chip i {
        font-size: 0.95rem !important;
    }

    .form-row {
        flex-direction: column !important;
        gap: 0.65rem !important;
    }

    .form-group {
        margin-bottom: 0.65rem !important;
        width: 100% !important;
    }

    /* Form Inputs (Prevent iOS Auto-Zoom) */
    input[type="text"], 
    input[type="password"], 
    input[type="email"], 
    input[type="tel"], 
    input[type="number"], 
    select {
        font-size: 16px !important;
    }

    /* Maps and Charts */
    .chart-container, #supply-chart, #demand-chart, #transit-chart {
        height: 220px !important;
        min-height: 220px !important;
    }

    #hospital-map, #ambulance-map, #blood-map, #donor-map, #transport-map, #disaster-map {
        height: 280px !important;
        min-height: 280px !important;
        border-radius: 10px !important;
    }

    /* Responsive Tables */
    .table-responsive,
    .results-table-container,
    .styled-table,
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .profile-details-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* 2. Laptop Screen Viewport Optimization (1366x768 & standard laptops) */
@media (min-width: 769px) and (max-width: 1440px) {
    .sidebar {
        width: 220px;
        padding: 1rem 0.85rem;
    }
    .sidebar-brand {
        margin-bottom: 1.15rem;
        font-size: 1.25rem;
    }
    .sidebar-menu {
        gap: 0.3rem;
    }
    .menu-item {
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
        border-radius: 8px;
    }
    .sidebar-footer {
        padding-top: 0.75rem;
    }
    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    .user-info h4 {
        font-size: 0.82rem;
    }
    .user-info p {
        font-size: 0.68rem;
    }
    .main-header {
        height: 60px;
        padding: 0 1.15rem;
    }
    .header-left h2 {
        font-size: 1.15rem;
    }
    .view-panel {
        padding: 0.85rem 1.15rem;
        height: calc(100vh - 60px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.85rem;
    }
    .metric-card {
        padding: 0.85rem 1rem;
    }
    .metric-icon {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
        margin-right: 0.65rem;
    }
    .metric-data h3 {
        font-size: 1.25rem;
    }
    .metric-data p {
        font-size: 0.72rem;
    }
    .dashboard-main-row {
        grid-template-columns: 1.4fr 1fr;
        gap: 0.85rem;
    }
    .two-column-layout {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        gap: 1rem;
        height: calc(100vh - 150px);
    }
    .chart-container, #supply-chart, #demand-chart, #transit-chart {
        height: 240px !important;
    }
    #hospital-map, #donor-map, #ambulance-map, #transport-map, #disaster-map {
        height: 350px !important;
        min-height: 320px !important;
    }
}

/* 3. Height-Constrained Laptop Viewports (e.g. 1366x768 screen with browser toolbars) */
@media (max-height: 820px) {
    .auth-box {
        padding: 1.15rem 1.4rem !important;
        max-height: 94vh !important;
    }
    .auth-header {
        margin-bottom: 0.5rem !important;
    }
    .auth-header h2 {
        font-size: 1.4rem !important;
        margin-bottom: 0.2rem !important;
    }
    .auth-header p {
        font-size: 0.78rem !important;
    }
    .auth-tabs {
        margin-bottom: 10px !important;
    }
    .auth-tabs button {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
    .role-chips {
        margin-bottom: 0.65rem !important;
    }
    .role-chip {
        padding: 0.45rem 0.35rem !important;
        font-size: 0.78rem !important;
    }
    .role-chip i {
        font-size: 0.95rem !important;
    }
    .modal-form {
        gap: 0.55rem !important;
    }
    .form-group {
        margin-bottom: 0.45rem !important;
    }
    .form-control {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.82rem !important;
    }
    .btn-primary {
        padding: 0.55rem !important;
        font-size: 0.85rem !important;
    }
    .google-btn {
        padding: 0.5rem !important;
        font-size: 0.8rem !important;
    }
    .auth-footer {
        margin-top: 0.65rem !important;
        font-size: 0.8rem !important;
    }
}

[data-theme="dark"] .leaflet-layer { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }
