/* ==========================================================================
   SALAM — Responsive Application Shell, Sidebar, Header & Mobile Navigation
   ========================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   DESKTOP SIDEBAR (>= 1024px)
   ========================================================================== */
.app-sidebar {
  display: none;
  flex-direction: column;
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  background-color: var(--emerald-900);
  color: #ffffff;
  border-right: 1px solid rgba(212, 175, 55, 0.2);
  z-index: 40;
  user-select: none;
}

[data-theme="dark"] .app-sidebar {
  background-color: #011813;
}

.sidebar-brand {
  padding: 1.35rem 1.35rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  color: #ffffff;
}

.brand-logo-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background-color: var(--emerald-800);
  border: 1px solid rgba(212, 175, 55, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.brand-btn:hover .brand-logo-box {
  transform: scale(1.05);
}

.brand-logo-box img {
  width: 30px;
  height: 30px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #ffffff;
}

.brand-badge {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(212, 175, 55, 0.22);
  color: var(--gold-300);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--emerald-200);
  margin-top: 2px;
}

.sidebar-prayer-pill {
  margin-top: 1rem;
  width: 100%;
  border-radius: var(--radius-md);
  background: rgba(2, 44, 34, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.28);
  padding: 0.75rem 0.9rem;
  text-align: left;
  color: #ffffff;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-prayer-pill:hover {
  background: rgba(2, 44, 34, 0.9);
  border-color: var(--gold-400);
}

.sidebar-prayer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--emerald-200);
}

.sidebar-prayer-time {
  color: var(--gold-300);
  font-weight: 600;
}

.sidebar-prayer-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.sidebar-countdown {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-city {
  font-size: 0.7rem;
  color: var(--emerald-400);
  max-width: 115px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.nav-section-label {
  padding: 0 0.75rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(167, 243, 208, 0.65);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
}

.nav-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(236, 253, 245, 0.86);
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item-btn svg {
  width: 18px;
  height: 18px;
  color: var(--gold-400);
  flex-shrink: 0;
}

.nav-item-btn:hover {
  background: rgba(6, 95, 70, 0.65);
  color: #ffffff;
}

.nav-item-btn.active {
  background: var(--gold-400);
  color: var(--emerald-950);
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}

.nav-item-btn.active svg {
  color: var(--emerald-950);
}

.sidebar-footer {
  padding: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.install-sidebar-btn {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(6, 95, 70, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-200);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.install-sidebar-btn:hover {
  background: var(--emerald-800);
  border-color: var(--gold-400);
}

/* ==========================================================================
   MAIN CONTENT AREA & HEADER
   ========================================================================== */
.app-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
  width: 100%;
}

.offline-banner {
  background: #d97706;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.offline-banner.hidden {
  display: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-brand-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  min-width: 0;
}

.mobile-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--emerald-900);
  border: 1px solid rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-logo img {
  width: 22px;
  height: 22px;
}

.mobile-brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  display: block;
  line-height: 1.1;
}

.mobile-hijri-sub {
  font-size: 0.65rem;
  color: var(--text-accent);
  font-weight: 600;
  display: block;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-header-dates {
  display: none;
}

.desktop-hijri-date {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-accent);
}

.desktop-greg-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.location-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.36rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast);
  max-width: 98px;
}

.location-pill-btn:hover {
  border-color: var(--emerald-600);
}

.location-pill-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-accent);
  flex-shrink: 0;
}

.location-pill-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.icon-action-btn:hover {
  border-color: var(--emerald-600);
  color: var(--text-primary);
}

.icon-action-btn.active {
  background: var(--emerald-900);
  color: var(--gold-300);
  border-color: var(--gold-400);
}

.icon-action-btn svg {
  width: 17px;
  height: 17px;
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-500);
  border: 2px solid var(--bg-surface);
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION BAR (< 1024px)
   ========================================================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
  padding: 0.25rem 0.5rem env(safe-area-inset-bottom, 0);
  display: flex;
  align-items: center;
}

.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  gap: 0.15rem;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.15rem;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  gap: 0.2rem;
  transition: all var(--transition-fast);
}

.mobile-nav-icon-pill {
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.mobile-nav-btn svg {
  width: 19px;
  height: 19px;
}

.mobile-nav-btn.active {
  color: var(--text-accent);
  font-weight: 700;
}

.mobile-nav-btn.active .mobile-nav-icon-pill {
  background: rgba(6, 95, 70, 0.14);
}

[data-theme="dark"] .mobile-nav-btn.active {
  color: var(--gold-300);
}

[data-theme="dark"] .mobile-nav-btn.active .mobile-nav-icon-pill {
  background: rgba(212, 175, 55, 0.18);
}

/* ==========================================================================
   PERSISTENT QURAN AUDIO RECITATION DOCK
   ========================================================================== */
.audio-player-dock {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 0.65rem);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 1.5rem);
  max-width: 720px;
  background: var(--emerald-900);
  color: #ffffff;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: var(--radius-lg);
  padding: 0.7rem 1rem 0.6rem;
  box-shadow: var(--shadow-elevated);
  z-index: 38;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.audio-dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.audio-dock-progress-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.audio-time-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--emerald-200);
  min-width: 34px;
  text-align: center;
}

.audio-seek-slider {
  flex: 1;
  height: 5px;
  accent-color: var(--gold-400);
  cursor: pointer;
}

.audio-player-dock.hidden {
  display: none;
}

.audio-dock-info {
  min-width: 0;
  flex: 1;
}

.audio-dock-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-dock-sub {
  font-size: 0.7rem;
  color: var(--emerald-200);
}

.audio-dock-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.audio-ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.audio-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.audio-ctrl-btn.primary {
  background: var(--gold-400);
  color: var(--emerald-950);
}

.audio-ctrl-btn.active-toggle {
  background: rgba(52, 211, 153, 0.3);
  border: 1px solid var(--emerald-400);
}

.audio-ctrl-btn svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   MODAL & DRAWER OVERLAYS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 22, 17, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: var(--bg-hero);
  color: #ffffff;
  padding: 1.35rem 1.5rem;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal-body {
  padding: 1.35rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==========================================================================
   DESKTOP BREAKPOINT (>= 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
  .app-sidebar {
    display: flex;
  }

  .app-main-wrapper {
    padding-left: var(--sidebar-width);
    padding-bottom: 2rem;
  }

  .mobile-bottom-nav {
    display: none;
  }

  .mobile-brand-trigger {
    display: none;
  }

  .desktop-header-dates {
    display: block;
  }

  .app-header {
    padding: 0 2rem;
  }

  .app-content {
    padding: 1.75rem 2rem 3rem;
  }

  .audio-player-dock {
    bottom: 1.25rem;
    left: calc(50% + (var(--sidebar-width) / 2));
  }
}
