@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --emerald-dark: #12453B;
  --emerald-mid: #1A5C4F;
  --emerald-soft: rgba(255, 255, 255, 0.11);
  --bg-page: #F7F5EE;
  --bg-card: #FFFFFF;
  --text-main: #1C2B27;
  --text-muted: #64746F;
  --gold: #C8A96E;
  --gold-soft: rgba(200, 169, 110, 0.18);
  --border-soft: #E8E4D8;
  --nav-bg: rgba(255, 255, 255, 0.96);
  --shadow-card: 0 8px 24px rgba(18, 69, 59, 0.07);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

body.dark-mode {
  --bg-page: #0D1916;
  --bg-card: #142622;
  --text-main: #F1EFE7;
  --text-muted: #9DB3AC;
  --border-soft: #213B35;
  --nav-bg: rgba(20, 38, 34, 0.96);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  direction: rtl;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 14px 96px;
  position: relative;
}

/* Top Update & Install Banners */
.banner-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  animation: slideDown 0.3s ease;
}

.banner-bar.show {
  display: flex;
}

.banner-update {
  background: linear-gradient(135deg, #1A5C4F, #12453B);
  color: #F7F5EE;
  border: 1px solid var(--gold);
}

.banner-install {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.banner-btn {
  background: var(--gold);
  color: #12453B;
  border: none;
  padding: 7px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.banner-close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.7;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* Progress Modal / Bar */
.progress-box {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.progress-box.show {
  display: block;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--emerald-dark);
}

body.dark-mode .progress-header {
  color: var(--gold);
}

.progress-track {
  width: 100%;
  height: 9px;
  background: var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald-dark), var(--gold));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Hero Prayer Card (Inspired by Masjiduk - Compact & Balanced) */
.hero-card {
  background: radial-gradient(circle at top left, rgba(200, 169, 110, 0.14), transparent 55%),
              linear-gradient(160deg, #165246 0%, #12453B 55%, #0D352D 100%);
  color: #FFFFFF;
  border-radius: 22px;
  padding: 13px 14px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(18, 69, 59, 0.20);
  margin-bottom: 12px;
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: radial-gradient(#C8A96E 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(200, 169, 110, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Amiri', serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.brand-title {
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-sub {
  font-size: 10.5px;
  opacity: 0.78;
}

.location-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(200, 169, 110, 0.4);
  color: #fff;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, transform 0.12s ease;
}

.location-pill:active {
  transform: scale(0.96);
}

.location-pill.loading {
  opacity: 0.75;
  pointer-events: none;
}

.next-prayer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
}

.next-prayer-label {
  font-size: 11.5px;
  opacity: 0.85;
  margin-bottom: 1px;
}

.next-prayer-name {
  font-size: 25px;
  font-weight: 800;
  line-height: 1.15;
}

.next-prayer-time {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.4px;
  direction: ltr;
}

.countdown-pill {
  background: #F7F5EE;
  color: #12453B;
  border-radius: 999px;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.countdown-timer {
  font-size: 15.5px;
  font-weight: 800;
  direction: ltr;
  letter-spacing: 0.6px;
}

.prayers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.prayer-cell {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
}

.prayer-cell.active {
  background: rgba(200, 169, 110, 0.24);
  border-color: rgba(200, 169, 110, 0.65);
}

.prayer-cell-name {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.prayer-cell-time {
  font-size: 13.5px;
  font-weight: 700;
  direction: ltr;
}

.hero-date {
  text-align: center;
  font-size: 11.5px;
  opacity: 0.9;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.hero-reminder {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

/* Section & Cards */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 2px 10px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.section-link {
  font-size: 13px;
  color: var(--emerald-dark);
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

body.dark-mode .section-link {
  color: var(--gold);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 15px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

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

.offline-status-title {
  font-weight: 800;
  font-size: 14.5px;
  margin-bottom: 3px;
}

.offline-status-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-primary {
  background: var(--emerald-dark);
  color: #fff;
  border: none;
  padding: 9px 15px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--emerald-mid);
}

.btn-soft {
  background: var(--gold-soft);
  color: var(--emerald-dark);
  border: 1px solid rgba(200, 169, 110, 0.4);
  padding: 8px 13px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

body.dark-mode .btn-soft {
  color: var(--gold);
}

/* Quick Action Row */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  color: var(--text-main);
  transition: transform 0.15s ease;
}

.quick-card:active {
  transform: scale(0.98);
}

.quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--gold-soft);
  color: var(--emerald-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 8px;
}

body.dark-mode .quick-icon {
  color: var(--gold);
}

.quick-title {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 2px;
}

.quick-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Featured Announcement Card (like Al-Shafi card in Masjiduk) */
.featured-card {
  background: linear-gradient(135deg, #12453B 0%, #1F6A5B 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.featured-badge {
  display: inline-block;
  background: rgba(200, 169, 110, 0.25);
  color: #F3DFB5;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.featured-title {
  font-family: 'Amiri', serif;
  font-size: 28px;
  font-weight: 700;
  color: #E7CCA0;
  margin: 0 0 6px;
}

.featured-body {
  font-size: 13.5px;
  line-height: 1.7;
  opacity: 0.94;
  margin: 0;
}

/* Tabs Visibility */
.tab-view {
  display: none;
  animation: fadeIn 0.22s ease;
}

.tab-view.active {
  display: block;
}

/* Quran Styling */
.search-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
}

.surah-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
}

.surah-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--emerald-dark);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
}

body.dark-mode .surah-num {
  color: var(--gold);
}

.surah-meta {
  display: flex;
  align-items: center;
}

.surah-name {
  font-family: 'Amiri', serif;
  font-size: 20px;
  font-weight: 700;
}

.surah-info {
  font-size: 11.5px;
  color: var(--text-muted);
}

.quran-reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.quran-paper {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  line-height: 2.35;
  font-family: 'Amiri', serif;
  font-size: 24px;
  text-align: justify;
  box-shadow: var(--shadow-card);
}

.bismillah {
  text-align: center;
  font-family: 'Amiri', serif;
  font-size: 25px;
  color: var(--emerald-dark);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-soft);
}

body.dark-mode .bismillah {
  color: var(--gold);
}

.ayah-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  margin: 0 5px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  color: var(--emerald-dark);
  font-family: 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

body.dark-mode .ayah-num {
  color: var(--gold);
}

/* Adhkar Styling */
.cat-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.cat-pills::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  padding: 8px 15px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.cat-pill.active {
  background: var(--emerald-dark);
  color: #fff;
  border-color: var(--emerald-dark);
}

.dhikr-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, opacity 0.25s ease;
}

.dhikr-card:active {
  transform: scale(0.985);
}

.dhikr-card.done {
  opacity: 0.55;
  border-color: #16A34A;
}

.dhikr-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--emerald-dark);
  margin-bottom: 8px;
}

body.dark-mode .dhikr-title {
  color: var(--gold);
}

.dhikr-text {
  font-family: 'Amiri', serif;
  font-size: 21px;
  line-height: 1.95;
  margin-bottom: 10px;
}

.dhikr-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.dhikr-fadl {
  font-size: 11.5px;
  color: var(--text-muted);
  flex: 1;
}

.dhikr-counter-badge {
  background: var(--emerald-dark);
  color: #fff;
  min-width: 44px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
}

.dhikr-card.done .dhikr-counter-badge {
  background: #16A34A;
}

/* Tasbih */
.tasbih-ring {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  margin: 18px auto;
  background: radial-gradient(circle, #1A5C4F, #12453B);
  border: 6px solid var(--gold);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 12px 30px rgba(18, 69, 59, 0.28);
  transition: transform 0.08s ease;
}

.tasbih-ring:active {
  transform: scale(0.94);
}

.tasbih-count {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}

.tasbih-target {
  font-size: 13px;
  color: #E7CCA0;
  margin-top: 6px;
}

/* Settings Rows */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-page);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
}

/* Bottom Navigation Bar (4 Tabs like Masjiduk) */
.bottom-nav {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 496px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  box-shadow: 0 10px 30px rgba(18, 69, 59, 0.14);
  z-index: 100;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 16px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item.active {
  background: rgba(18, 69, 59, 0.1);
  color: var(--emerald-dark);
}

body.dark-mode .nav-item.active {
  background: rgba(200, 169, 110, 0.18);
  color: var(--gold);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: #12453B;
  color: #F7F5EE;
  border: 1px solid var(--gold);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  z-index: 999;
  max-width: 90%;
  text-align: center;
  transition: transform 0.35s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Never show Install Banner when running as an installed PWA */
@media all and (display-mode: standalone) {
  #installBanner {
    display: none !important;
  }
}
