/* =====================================================
   ROOT
===================================================== */
:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;

  --text-main: #111827;
  --text-muted: #6b7280;
  --gold: #bfa642;

  --radius-xl: 22px;
  --radius-lg: 16px;

  --shadow-soft: 0 10px 30px rgba(0,0,0,.08);
  --shadow-hover: 0 18px 45px rgba(0,0,0,.15);

  --blur: saturate(180%) blur(20px);
  --transition: .35s cubic-bezier(.4,0,.2,1);
}

/* =====================================================
   RESET
===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
}

.no-copy {
  user-select: none;
  -webkit-user-select: none;
}

/* =====================================================
   APP SHELL
===================================================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =====================================================
   HEADER (APPLE STYLE)
===================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;

  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    0
    calc(1rem + env(safe-area-inset-right))
    0
    calc(1rem + env(safe-area-inset-left));

  background: rgba(255,255,255,.75);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.app-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.3px;
}

.app-title span {
  color: var(--gold);
}

.header-icon {
  position: absolute;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);

  padding: .5rem;
  transition: transform .25s ease, color .25s ease;
}

.header-icon:hover {
  transform: scale(1.15);
  color: var(--gold);
}

.home-btn { left: 1rem; }
.theme-btn { right: 1rem; }

/* =====================================================
   MAIN
===================================================== */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* =====================================================
   INTRO
===================================================== */
.page-intro {
  margin-bottom: 28px;
}

.section-title {
  font-size: clamp(1.6rem, 2vw, 2rem);
  font-weight: 600;
  color: var(--gold);
}

.section-subtitle {
  font-size: .95rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* =====================================================
   AZAN GRID
===================================================== */
.azan-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* =====================================================
   AZAN CARD
===================================================== */
.azan-card {
  border: none;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  text-align: left;

  box-shadow: var(--shadow-soft);
  cursor: pointer;

  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.azan-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.azan-title {
  font-size: 1.1rem;
  font-weight: 500;
}

.azan-preview {
  margin-top: 10px;
  font-family: "Amiri Quran", serif;
  font-size: 1.15rem;
  color: var(--text-muted);
  direction: rtl;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =====================================================
   MODAL (FULL SCREEN SHEET)
===================================================== */
.azan-modal {
  position: fixed;
  inset: 0;
  z-index: 200;

  background: var(--bg);
  overflow-y: auto;
}

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

/* ---------- MODAL HEADER ---------- */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;

  height: 64px;
  background: rgba(255,255,255,.8);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(0,0,0,.08);
}

body.dim .modal-header{
    background: rgba(17, 24, 39, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.dark .modal-header{
    background: #111827;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
body.dim .azan-title{
    color: var(--gold);
}
body.dark .azan-title{
    color: var(--gold);
}
.modal-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold);
}

.modal-close {
  position: absolute;
  right: 1rem;
  font-size: 2rem;
  line-height: 1;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem .5rem;
}

.modal-close:hover {
  color: var(--gold);
}

/* ---------- MODAL CONTENT ---------- */
.modal-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* =====================================================
   ARABIC AZAN TEXT
===================================================== */
.azan-arabic {
  font-family: "Amiri Quran", serif;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 2.1;
  text-align: center;
  direction: rtl;
}

.azan-arabic p {
  margin: 0 0 1.2rem;
}

/* =====================================================
   AUDIO PLAYER (PRO)
===================================================== */
.azan-audio {
  width: 100%;
  margin-top: 24px;
  border-radius: 14px;
  background: transparent;
}

/* DIM MODE */
body.dim .azan-audio {
  filter:
    invert(0.92)
    hue-rotate(180deg)
    brightness(0.80)
    contrast(1);
  opacity: 0.95;
}

/* DARK MODE */
body.dark .azan-audio {
  filter:
    invert(0.92)
    hue-rotate(180deg)
    brightness(0.75)
    contrast(1);
  opacity: 0.95;
}

/* =====================================================
   FOOTER
===================================================== */
.app-footer {
  text-align: center;
  padding: 20px;
  font-size: .85rem;
  color: var(--text-muted);
}

/* =====================================================
   DARK MODE
===================================================== */
body.dark {
  --bg: #0f172a;
  --card-bg: #0f1422;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
}

/* =====================================================
   DIM MODE
===================================================== */
body.dim {
  --bg: #111827;
  --card-bg: #1f2937;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 640px) {
  .app-header {
    height: 58px;
  }

  .app-main {
    padding: 24px 16px 40px;
  }

  .azan-card {
    padding: 18px 20px;
  }

  .azan-arabic {
    font-size: 1.7rem;
  }
}

@media (min-width: 1600px) {
  .app-main {
    max-width: 1600px;
  }
}
