/* 
  Offline Prayer Times PWA / Android APK
  Created by: Youssef Mahmoud (تم الإنشاء بواسطة يوسف محمود)
  Aesthetic: Minimalist Sleek Dark Slate & Emerald Islamic Theme
*/

:root {
  --bg-primary: #070d12;
  --bg-secondary: #0d1720;
  --surface-card: rgba(17, 28, 38, 0.85);
  --surface-card-hover: rgba(23, 38, 51, 0.95);
  --surface-card-active: rgba(16, 185, 129, 0.12);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-card-active: rgba(16, 185, 129, 0.45);
  
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-900: #064e3b;
  --emerald-glow: rgba(16, 185, 129, 0.25);

  --gold-300: #fde68a;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-glow: rgba(251, 191, 36, 0.2);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--emerald-glow);

  --font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Arabic', sans-serif;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(circle at 50% 0%, #0d2822 0%, var(--bg-secondary) 45%, var(--bg-primary) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  padding-bottom: 70px; /* Room for fixed branding footer */
  user-select: none;
  -webkit-user-select: none;
}

/* Custom modern scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-500);
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  padding: 16px 16px 24px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Ambient glow orb behind hero */
.app-container::before {
  content: '';
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 220px;
  background: radial-gradient(ellipse, var(--emerald-glow) 0%, rgba(16, 185, 129, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* App Header */
.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px 0;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-900), #08211b);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.4);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-titles h1 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-titles .brand-tagline {
  font-size: 0.72rem;
  color: var(--emerald-400);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--emerald-400);
  box-shadow: 0 0 8px var(--emerald-400);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.btn-icon:hover, .btn-icon:focus-visible {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-400);
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(1px);
}

.btn-icon.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  border-color: var(--emerald-500);
}

/* Quick Bar: Location & Dates */
.quick-meta-bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.meta-location {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  outline: none;
}

.meta-location:hover {
  background: rgba(255, 255, 255, 0.06);
}

.location-icon-wrap {
  color: var(--emerald-400);
  display: flex;
  align-items: center;
}

.location-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.location-badge {
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.18);
  color: var(--emerald-400);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-right: 4px;
}

.meta-date {
  text-align: left;
  direction: ltr;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.hijri-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-400);
  direction: rtl;
}

.gregorian-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
  direction: rtl;
}

/* Hero Countdown Card */
.hero-card {
  position: relative;
  z-index: 5;
  background: linear-gradient(170deg, rgba(16, 44, 36, 0.85) 0%, rgba(13, 23, 32, 0.95) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 20px;
  overflow: hidden;
}

/* Subtle Islamic Star Background Watermark */
.hero-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 140px;
  height: 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' opacity='0.05'%3E%3Cpolygon points='50,0 62,38 100,50 62,62 50,100 38,62 0,50 38,38' fill='%2334d399'/%3E%3Cpolygon points='50,15 58,42 85,50 58,58 50,85 42,58 15,50 42,42' fill='%23fbbf24'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

.hero-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.hero-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald-300);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-prayer-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 12px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.hero-countdown-box {
  background: rgba(7, 13, 18, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 0 auto 16px auto;
  max-width: 380px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.countdown-digits {
  font-family: var(--font-family);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  direction: ltr;
  display: inline-block;
  color: var(--gold-400);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px var(--gold-glow);
  line-height: 1.1;
}

.countdown-labels {
  display: flex;
  justify-content: space-around;
  direction: ltr;
  margin-top: 4px;
  padding: 0 20px;
}

.countdown-labels span {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.hero-meta-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding-top: 4px;
}

.hero-meta-target {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--emerald-400);
  font-weight: 600;
}

.hero-meta-current {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Prayer Window Progress Bar */
.progress-container {
  margin-top: 14px;
  position: relative;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald-600), var(--emerald-400));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 1s linear;
  box-shadow: 0 0 10px var(--emerald-500);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Section Title */
.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px 0;
}

.section-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  color: var(--emerald-400);
}

.section-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Prayer Schedule Cards Container */
.prayer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Individual Prayer Card */
.prayer-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-normal);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.prayer-card:hover {
  background: var(--surface-card-hover);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

/* Current Active Prayer Styling */
.prayer-card.is-current {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.35) 0%, rgba(13, 23, 32, 0.95) 100%);
  border: 1.5px solid var(--emerald-500);
  box-shadow: 0 4px 18px var(--emerald-glow);
}

.prayer-card.is-current::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: var(--emerald-500);
  box-shadow: 0 0 10px var(--emerald-400);
}

/* Next Upcoming Prayer Styling */
.prayer-card.is-next {
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(13, 23, 32, 0.9) 100%);
}

.prayer-card.is-next::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold-400);
}

/* Completed Prayer Styling */
.prayer-card.is-passed {
  opacity: 0.65;
}

.prayer-card-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.prayer-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.prayer-card.is-current .prayer-icon-wrap {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  border-color: rgba(16, 185, 129, 0.4);
}

.prayer-card.is-next .prayer-icon-wrap {
  background: rgba(251, 191, 36, 0.15);
  color: var(--gold-400);
  border-color: rgba(251, 191, 36, 0.3);
}

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

.prayer-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prayer-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.prayer-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.prayer-badge.badge-current {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.prayer-badge.badge-next {
  background: rgba(251, 191, 36, 0.2);
  color: var(--gold-400);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.prayer-badge.badge-passed {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.prayer-en-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.prayer-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prayer-time {
  font-size: 1.25rem;
  font-weight: 700;
  direction: ltr;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.prayer-card.is-current .prayer-time {
  color: var(--emerald-400);
}

.prayer-card.is-next .prayer-time {
  color: var(--gold-400);
}

.prayer-sound-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.prayer-sound-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.prayer-sound-btn.mode-adhan {
  color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
}

.prayer-sound-btn.mode-beep {
  color: var(--gold-400);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
}

.prayer-sound-btn.mode-silent {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Quick Feature Navigation Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.feature-btn {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.feature-btn:hover, .feature-btn:focus-visible {
  background: var(--surface-card-hover);
  color: var(--emerald-400);
  border-color: rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

.feature-btn svg {
  width: 22px;
  height: 22px;
}

.feature-btn span {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

/* Offline & Background Status Card */
.bg-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(13, 23, 32, 0.8) 100%);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bg-banner:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16) 0%, rgba(13, 23, 32, 0.9) 100%);
  border-color: var(--emerald-500);
}

.bg-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bg-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald-400);
  flex-shrink: 0;
}

.bg-banner-text h4 {
  font-size: 0.84rem;
  font-weight: 700;
  color: #ffffff;
}

.bg-banner-text p {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.bg-banner-arrow {
  color: var(--emerald-400);
  display: flex;
  align-items: center;
}

/* Fixed Footer Branding */
.fixed-branding-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(7, 13, 18, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-card);
  padding: 10px 16px;
  text-align: center;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-branding-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.footer-branding-name {
  color: var(--emerald-400);
  font-weight: 700;
}

.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.footer-offline-tag {
  font-size: 0.7rem;
  color: var(--gold-400);
}

/* Active Adhan Player Floating Overlay */
.adhan-player-overlay {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  width: calc(100% - 32px);
  max-width: 480px;
  background: linear-gradient(135deg, #064e3b 0%, #0d2822 60%, #071018 100%);
  border: 1.5px solid var(--emerald-400);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 30px var(--emerald-glow);
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.adhan-player-overlay.visible {
  transform: translateX(-50%) translateY(0);
}

.adhan-player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.adhan-player-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-wave-anim {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.wave-bar {
  width: 4px;
  background: var(--emerald-400);
  border-radius: 2px;
  animation: wave 1.2s infinite ease-in-out;
}
.wave-bar:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.wave-bar:nth-child(2) { height: 18px; animation-delay: 0.3s; }
.wave-bar:nth-child(3) { height: 12px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 20px; animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.adhan-player-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.adhan-player-subtitle {
  font-size: 0.75rem;
  color: var(--emerald-300);
}

.btn-stop-adhan {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-stop-adhan:hover {
  background: var(--danger);
  color: #ffffff;
}

.adhan-player-dua {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.76rem;
  color: var(--gold-300);
  line-height: 1.6;
  text-align: center;
}

/* Modals System */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease-out;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-sheet {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.open .modal-sheet {
  transform: translateY(0);
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal-sheet {
    border-radius: var(--radius-xl);
    max-height: 80vh;
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title svg {
  color: var(--emerald-400);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Modal Form Controls */
.settings-group {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-group-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--emerald-400);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-label {
  display: flex;
  flex-direction: column;
}

.form-label span {
  font-size: 0.88rem;
  font-weight: 600;
  color: #ffffff;
}

.form-label small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.form-select, .form-input {
  background: rgba(7, 13, 18, 0.8);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.84rem;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
  min-width: 140px;
}

.form-select:focus, .form-input:focus {
  border-color: var(--emerald-500);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #1e293b;
  transition: 0.3s;
  border-radius: 34px;
  border: 1px solid var(--border-card);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--emerald-600);
  border-color: var(--emerald-500);
}

input:checked + .slider:before {
  transform: translateX(19px);
}

/* City Picker Tabs & List */
.city-search-box {
  position: relative;
  margin-bottom: 12px;
}

.city-search-box input {
  width: 100%;
  background: rgba(7, 13, 18, 0.8);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 38px 10px 14px;
  border-radius: var(--radius-md);
  outline: none;
}

.city-search-box input:focus {
  border-color: var(--emerald-500);
}

.city-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.city-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.city-tab-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.city-tab-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  border-color: var(--emerald-500);
}

.city-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.city-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.city-item:hover {
  background: var(--surface-card-hover);
  border-color: rgba(16, 185, 129, 0.35);
}

.city-item.selected {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--emerald-500);
}

.city-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.city-item-country {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Qibla Compass UI */
.qibla-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.compass-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-dial {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed rgba(16, 185, 129, 0.4);
  background: radial-gradient(circle, #0e1e24 0%, #081016 100%);
  position: relative;
  transition: transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.compass-pointer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 100px;
  margin-top: -50px;
  margin-left: -5px;
  transform-origin: center center;
  transition: transform 0.3s ease-out;
}

.qibla-meta-card {
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.qibla-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-400);
}

.qibla-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Background Android Guide Instructions */
.guide-step {
  background: var(--surface-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  gap: 14px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 0.92rem;
  color: #ffffff;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.diagnostic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

.status-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.status-tag.ok {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
}
.status-tag.warn {
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold-400);
}

/* Toast notifications */
.toast-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(13, 23, 32, 0.95);
  border: 1px solid var(--emerald-500);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 500;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}

/* Adhkar Counter */
.tasbeeh-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #0e2a22 0%, #071018 100%);
  border: 2px solid var(--emerald-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px auto;
  cursor: pointer;
  box-shadow: 0 0 20px var(--emerald-glow);
  transition: transform 0.1s ease;
}
.tasbeeh-circle:active {
  transform: scale(0.95);
}
.tasbeeh-count {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-400);
}
.tasbeeh-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Primary Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Offline Places Picker (all Egyptian villages + world cities)
   ========================================================================== */
.db-badge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  color: var(--emerald-400);
  font-size: 0.72rem;
  line-height: 1.55;
}

.db-badge svg { flex: 0 0 auto; margin-top: 2px; opacity: 0.9; }

.gov-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.gov-chips::-webkit-scrollbar { display: none; }

.gov-chip {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.gov-chip.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-400);
  border-color: var(--emerald-500);
}

.gov-chip small { color: var(--text-muted); font-size: 0.65rem; margin-inline-start: 4px; }

.picker-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.picker-near-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--gold-400);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.picker-near-btn:active { transform: translateY(1px); }

.city-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.city-item-gov {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--emerald-400);
  background: rgba(16, 185, 129, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}

.city-item-dist {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--gold-400);
  background: rgba(251, 191, 36, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}

.city-item-country {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.load-more-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  color: var(--emerald-400);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.load-more-btn:active { transform: translateY(1px); }

.picker-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 22px 10px;
  font-size: 0.82rem;
  line-height: 1.7;
}

.world-db-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  color: var(--emerald-400);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.world-db-btn.done {
  color: var(--gold-400);
  border-style: solid;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  cursor: default;
}

.world-db-btn:disabled { opacity: 0.85; }
