:root {
  --theme-primary: #0d6efd;
  --theme-secondary: #6c757d;
  --theme-success: #198754;
  --theme-danger: #dc3545;
  --theme-warning: #ffc107;
  --theme-bg-primary: #f8f9fa;
  --theme-bg-secondary: #ffffff;
  --theme-border: #dee2e6;
  --sidebar-width: 260px;
  --header-height: 70px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--theme-bg-primary);
}

.top-band {
  background: linear-gradient(135deg, #0d6efd 0%, #052c65 100%);
  height: var(--header-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.logo-subtitle {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  position: fixed;
  top: var(--header-height);
  left: 0;
  background-color: var(--theme-bg-secondary);
  border-right: 1px solid var(--theme-border);
  z-index: 1000;
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content.ms-0 {
  margin-left: 0 !important;
}

.sidebar-link {
  color: #495057;
  text-decoration: none;
  padding: 10px 15px;
  border-radius: 8px;
  display: block;
  margin-bottom: 5px;
  transition: all 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
  background-color: var(--theme-primary);
  color: white;
}

.sidebar-sublink {
  color: #6c757d;
  text-decoration: none;
  padding: 5px 15px;
  font-size: 0.9rem;
  display: block;
}

.sidebar-sublink.active {
  color: var(--theme-primary);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
  }
  .offcanvas.sidebar {
    display: block;
    height: 100vh;
    top: 0;
    z-index: 1100; /* Ensure it's above everything including backdrop */
  }
}

.theme-card {
    background: white;
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.theme-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* --- Premium Dashboard Styles --- */

.dashboard-hero {
    background: linear-gradient(135deg, #0d6efd 0%, #00458b 100%);
    border-radius: 20px;
    padding: 3rem 2rem;
    color: white;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 30px rgba(13, 110, 253, 0.15);
    position: relative;
    overflow: hidden;
}

.dashboard-hero::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: 1;
}

.dashboard-hero .hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.location-card {
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    animation: slideUp 0.5s ease-out;
    opacity: 1;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.location-card:nth-child(1) { animation-delay: 0.1s; }
.location-card:nth-child(2) { animation-delay: 0.2s; }
.location-card:nth-child(3) { animation-delay: 0.3s; }
.location-card:nth-child(4) { animation-delay: 0.4s; }
.location-card:nth-child(5) { animation-delay: 0.5s; }
.location-card:nth-child(6) { animation-delay: 0.6s; }

.location-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #0d6efd40;
    color: inherit;
}

.location-icon-container {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.6rem;
    transition: all 0.3s ease;
}

.location-card:hover .location-icon-container {
    background-color: #0d6efd !important;
    color: white !important;
    transform: scale(1.1);
}

.location-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.location-desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

.location-arrow {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0d6efd;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.location-card:hover .location-arrow {
    opacity: 1;
    transform: none;
}

.stat-card {
    padding: 20px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--theme-primary);
}

.stat-label {
    color: var(--theme-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Guide Render Styles --- */

.guide-page-title {
    font-size: 2.2rem;
    letter-spacing: -0.5px;
}

.guide-content {
    font-size: 1rem;
    color: #334155;
}

.guide-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #0f172a;
    font-weight: 700;
    font-size: 1.5rem;
}

.guide-content h3 {
    margin-top: 1.8rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--theme-border);
    padding-bottom: 0.4rem;
}

.guide-content p {
    margin-bottom: 1.2rem;
    line-height: 1.7;
}

/* Multi-layer list styles */
.guide-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.guide-content ul ul {
    list-style-type: circle;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
    padding-left: 1.5rem;
}

.guide-content ul ul ul {
    list-style-type: square;
    margin-top: 0.4rem;
    padding-left: 1.5rem;
}

.guide-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Subtle muted backgrounds/boundaries */
.guide-content blockquote {
    background-color: var(--theme-bg-primary);
    border-left: 4px solid #adb5bd;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    color: #495057;
    font-style: italic;
}

/* --- PWA Install Bottom Sheet --- */

.pwa-install-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1055;
    padding: 0 1rem 1rem;
    pointer-events: none;
}

.pwa-install-banner.show {
    pointer-events: auto;
}

.pwa-install-card {
    max-width: 560px;
    margin: 0 auto;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid var(--theme-border);
    border-top: 3px solid #2A5C8A;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(2, 44, 101, 0.22), 0 2px 6px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    animation: pwaSlideUp 0.3s ease-out;
}

@keyframes pwaSlideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
    background: #eaf1f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pwa-install-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-install-body {
    flex: 1 1 auto;
    min-width: 0;
}

.pwa-install-title {
    font-size: 1rem;
    font-weight: 700;
    color: #102a43;
    margin: 0 0 0.15rem;
}

.pwa-install-subtitle {
    font-size: 0.85rem;
    color: #486581;
    margin: 0 0 0.6rem;
    line-height: 1.45;
}

.pwa-ios-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #243b53;
}

.pwa-ios-steps li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pwa-step-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    background: #2A5C8A;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.pwa-install-close {
    flex-shrink: 0;
    margin-left: auto;
}

@media (max-width: 575.98px) {
    .pwa-install-banner {
        padding: 0 0.6rem 0.6rem;
    }
    .pwa-install-card {
        padding: 0.85rem 1rem;
    }
    .pwa-install-title {
        font-size: 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-install-card {
        animation: none;
    }
}

/* ── Clinical notification bell, badge & inbox (pwa-notifications.js) ── */
.pwa-notification-bell {
    line-height: 1;
    border-radius: 999px;
}

.pwa-notification-bell:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pwa-notification-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}

.pwa-notification-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
}

.pwa-notification-item {
    border-left: none;
    border-right: none;
    text-align: left;
    cursor: pointer;
}

.pwa-notification-item:first-child {
    border-top: none;
}

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

.pwa-notification-unread {
    background-color: #f0f4f8;
}

.pwa-notification-title {
    font-size: 0.9rem;
}

.pwa-notification-body {
    font-size: 0.82rem;
    color: #495057;
}

.pwa-notification-empty {
    font-size: 0.85rem;
    padding: 1rem;
}

.pwa-update-section {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 0.75rem 0.875rem;
}

.pwa-version-label {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.pwa-update-status[data-status="checking"],
.pwa-update-status[data-status="updating"] {
    color: #2a5c8a;
}

.pwa-update-status[data-status="ready"] {
    color: #856404;
}
