/* =========================================================
   CORAN READER PREMIUM  —  css/quran-premium.css
   Esthétique : Manuscrit islamique de luxe, tons parchemin
   ========================================================= */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --qp-bg:          #F5F0E8;
  --qp-surface:     #FDFAF5;
  --qp-surface2:    #F0EAD8;
  --qp-border:      rgba(139,107,60,.20);
  --qp-primary:     #2D5F4F;
  --qp-primary2:    #3D7A65;
  --qp-gold:        #B8892A;
  --qp-gold-lt:     #E2B84A;
  --qp-gold-dim:    rgba(184,137,42,.12);
  --qp-text:        #1C1710;
  --qp-text2:       #4A4035;
  --qp-text3:       #7A6E60;
  --qp-arabic:      'Amiri', serif;
  --qp-ui:          'Outfit', sans-serif;
  --qp-r:           14px;
  --qp-r2:          22px;
  --qp-sh:          0 4px 20px rgba(45,95,79,.10);
  --qp-sh2:         0 12px 44px rgba(45,95,79,.16);
  --qp-t:           .28s cubic-bezier(.4,0,.2,1);
}
[data-theme="dark"] {
  --qp-bg:       #0D1710;
  --qp-surface:  #131F17;
  --qp-surface2: #182115;
  --qp-border:   rgba(184,137,42,.20);
  --qp-text:     #EDE7DB;
  --qp-text2:    #C0B49E;
  --qp-text3:    #7A7060;
  --qp-sh:       0 4px 20px rgba(0,0,0,.35);
  --qp-sh2:      0 12px 44px rgba(0,0,0,.45);
}

/* ── Wrapper ────────────────────────────────────────────── */
.qp-wrap {
  font-family: var(--qp-ui);
  background: var(--qp-bg);
  min-height: 60vh;
}

/* ═══════════════════════════════════════════════════════
   VUE 1 — LISTE DES SOURATES
   ═══════════════════════════════════════════════════════ */

/* Hero search */
.qp-hero {
  background: linear-gradient(150deg, #1A3A2E 0%, #2D5F4F 55%, #1A4232 100%);
  padding: 2.8rem 2rem 4rem;
  position: relative;
  overflow: hidden;
}
.qp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 60%, rgba(184,137,42,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(184,137,42,.12) 0%, transparent 45%);
  pointer-events: none;
}
/* motif géométrique décoratif */
.qp-hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 48px;
  background: var(--qp-bg);
  clip-path: ellipse(54% 100% at 50% 100%);
}

.qp-bismillah {
  text-align: center;
  font-family: var(--qp-arabic);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--qp-gold-lt);
  text-shadow: 0 2px 16px rgba(184,137,42,.45);
  margin-bottom: .35rem;
  position: relative; z-index: 1;
  animation: fadeDown .6s ease both;
}
.qp-hero-label {
  text-align: center;
  color: rgba(255,255,255,.55);
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  position: relative; z-index: 1;
}

/* Barre de recherche */
.qp-search-wrap {
  max-width: 540px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  animation: fadeUp .5s .15s ease both;
}
.qp-search {
  width: 100%;
  padding: 1.05rem 3.5rem 1.05rem 3.2rem;
  background: rgba(255,255,255,.13);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(184,137,42,.45);
  border-radius: 50px;
  color: #fff;
  font-size: .98rem;
  font-family: var(--qp-ui);
  outline: none;
  transition: var(--qp-t);
  box-shadow: 0 4px 24px rgba(0,0,0,.22);
}
.qp-search::placeholder { color: rgba(255,255,255,.45); }
.qp-search:focus {
  background: rgba(255,255,255,.20);
  border-color: var(--qp-gold-lt);
  box-shadow: 0 0 0 4px rgba(184,137,42,.22), 0 4px 24px rgba(0,0,0,.28);
}
.qp-search-ico {
  position: absolute;
  left: 1.1rem; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.5);
  font-size: 1rem;
  pointer-events: none;
}
.qp-search-count {
  position: absolute;
  right: 1.2rem; top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  font-weight: 600;
  pointer-events: none;
}

/* Filtres Mecquoise/Médinoise */
.qp-filters {
  display: flex;
  gap: .6rem;
  justify-content: center;
  margin-top: 1.2rem;
  position: relative; z-index: 1;
  flex-wrap: wrap;
  animation: fadeUp .5s .25s ease both;
}
.qp-filter-btn {
  padding: .45rem 1.2rem;
  border-radius: 50px;
  border: 1.5px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.75);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--qp-t);
  font-family: var(--qp-ui);
}
.qp-filter-btn:hover,
.qp-filter-btn.active {
  background: var(--qp-gold);
  border-color: var(--qp-gold);
  color: #fff;
  box-shadow: 0 4px 14px rgba(184,137,42,.4);
}

/* Grille de sourates */
.qp-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.8rem 1.6rem .8rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.qp-grid-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--qp-text2);
  letter-spacing: .04em;
}
.qp-juz-select {
  padding: .45rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--qp-border);
  background: var(--qp-surface);
  color: var(--qp-text2);
  font-size: .82rem;
  font-family: var(--qp-ui);
  cursor: pointer;
  outline: none;
  transition: var(--qp-t);
}
.qp-juz-select:focus { border-color: var(--qp-gold); }

.qp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 0 1.4rem 2rem;
}

/* Carte sourate */
.qp-surah-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1.1rem 1.25rem;
  background: var(--qp-surface);
  border: 1.5px solid var(--qp-border);
  border-radius: var(--qp-r2);
  cursor: pointer;
  transition: var(--qp-t);
  position: relative;
  overflow: hidden;
  animation: cardIn .4s ease both;
  text-decoration: none;
}
.qp-surah-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--qp-primary), var(--qp-gold));
  opacity: 0;
  transition: opacity var(--qp-t);
  border-radius: 0 2px 2px 0;
}
.qp-surah-card:hover {
  border-color: var(--qp-gold);
  box-shadow: var(--qp-sh2);
  transform: translateY(-3px) translateX(2px);
}
.qp-surah-card:hover::before { opacity: 1; }

.qp-surah-num {
  min-width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--qp-gold-dim);
  border: 1.5px solid rgba(184,137,42,.25);
  border-radius: 50%;
  font-size: .88rem;
  font-weight: 800;
  color: var(--qp-gold);
  flex-shrink: 0;
  transition: var(--qp-t);
}
.qp-surah-card:hover .qp-surah-num {
  background: var(--qp-gold);
  color: #fff;
  border-color: var(--qp-gold);
}

.qp-surah-info { flex: 1; min-width: 0; }
.qp-surah-name-fr {
  font-size: .96rem;
  font-weight: 700;
  color: var(--qp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qp-surah-meta {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .25rem;
  flex-wrap: wrap;
}
.qp-surah-verses {
  font-size: .75rem;
  color: var(--qp-text3);
}
.qp-surah-type {
  font-size: .68rem;
  padding: .18rem .55rem;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: .06em;
}
.qp-type-mecca {
  background: rgba(184,137,42,.12);
  color: var(--qp-gold);
  border: 1px solid rgba(184,137,42,.25);
}
.qp-type-medina {
  background: rgba(45,95,79,.10);
  color: var(--qp-primary);
  border: 1px solid rgba(45,95,79,.20);
}

.qp-surah-name-ar {
  font-family: var(--qp-arabic);
  font-size: 1.35rem;
  color: var(--qp-primary);
  line-height: 1;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   VUE 2 — LECTEUR VERSETS
   ═══════════════════════════════════════════════════════ */
.qp-reader { display: none; }
.qp-reader.active { display: block; animation: fadeIn .4s ease; }
.qp-list.hidden { display: none; }

/* Header du lecteur */
.qp-reader-header {
  background: linear-gradient(150deg, #1A3A2E 0%, #2D5F4F 100%);
  padding: 1.8rem 1.6rem 2.8rem;
  position: relative;
  overflow: hidden;
}
.qp-reader-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 40px;
  background: var(--qp-bg);
  clip-path: ellipse(54% 100% at 50% 100%);
}
.qp-reader-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(184,137,42,.15) 0%, transparent 60%);
  pointer-events: none;
}

.qp-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.1rem;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50px;
  color: rgba(255,255,255,.85);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--qp-t);
  margin-bottom: 1.2rem;
  font-family: var(--qp-ui);
  position: relative; z-index: 1;
}
.qp-back-btn:hover {
  background: rgba(255,255,255,.22);
  color: #fff;
}

.qp-reader-title {
  text-align: center;
  position: relative; z-index: 1;
}
.qp-reader-surah-ar {
  font-family: var(--qp-arabic);
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: var(--qp-gold-lt);
  text-shadow: 0 2px 16px rgba(184,137,42,.4);
  display: block;
  line-height: 1.2;
}
.qp-reader-surah-fr {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  display: block;
  margin-top: .4rem;
}
.qp-reader-surah-meta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: .75rem;
  flex-wrap: wrap;
}
.qp-reader-chip {
  padding: .3rem .9rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  font-size: .75rem;
  color: rgba(255,255,255,.7);
  font-weight: 600;
}

/* Contrôles de vue */
.qp-view-controls {
  display: flex;
  gap: .5rem;
  justify-content: center;
  padding: 1.4rem 1.6rem .6rem;
  flex-wrap: wrap;
}
.qp-view-btn {
  padding: .55rem 1.4rem;
  border-radius: 50px;
  border: 1.5px solid var(--qp-border);
  background: var(--qp-surface);
  color: var(--qp-text2);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--qp-t);
  font-family: var(--qp-ui);
}
.qp-view-btn.active,
.qp-view-btn:hover {
  background: var(--qp-primary);
  border-color: var(--qp-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(45,95,79,.3);
}

/* Bismillah décorative */
.qp-basmala {
  text-align: center;
  font-family: var(--qp-arabic);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--qp-primary);
  padding: 1.8rem 1.6rem .4rem;
  position: relative;
}
.qp-basmala::before,
.qp-basmala::after {
  content: '✦';
  font-family: serif;
  font-size: 1rem;
  color: var(--qp-gold);
  margin: 0 .8rem;
  vertical-align: middle;
}

/* Carte verset */
.qp-verses-list {
  padding: .8rem 1.4rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qp-verse {
  background: var(--qp-surface);
  border: 1.5px solid var(--qp-border);
  border-radius: var(--qp-r2);
  overflow: hidden;
  transition: var(--qp-t);
  animation: cardIn .35s ease both;
}
.qp-verse:hover {
  border-color: rgba(184,137,42,.35);
  box-shadow: var(--qp-sh);
}

/* Numéro + actions */
.qp-verse-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--qp-border);
  background: var(--qp-surface2);
}
.qp-verse-num-badge {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--qp-primary), var(--qp-primary2));
  color: #fff;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(45,95,79,.3);
}
.qp-verse-actions {
  display: flex;
  gap: .5rem;
}
.qp-verse-tag {
  padding: .25rem .7rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--qp-gold-dim);
  color: var(--qp-gold);
  border: 1px solid rgba(184,137,42,.2);
}

/* Arabe */
.qp-verse-arabic {
  font-family: var(--qp-arabic);
  font-size: clamp(1.55rem, 4vw, 2.2rem);
  line-height: 2;
  color: var(--qp-text);
  text-align: right;
  direction: rtl;
  padding: 1.4rem 1.6rem 1rem;
  letter-spacing: .02em;
}

/* Translittération */
.qp-verse-translit {
  font-size: .88rem;
  font-style: italic;
  color: var(--qp-text3);
  padding: .2rem 1.6rem .8rem;
  line-height: 1.7;
  border-bottom: 1px dashed var(--qp-border);
}
.qp-verse-translit.hidden { display: none; }

/* Traduction */
.qp-verse-translation {
  padding: 1rem 1.6rem;
  font-size: .97rem;
  color: var(--qp-text2);
  line-height: 1.75;
  font-weight: 500;
  border-bottom: 1px solid var(--qp-border);
}
.qp-verse-translation strong {
  color: var(--qp-primary);
  font-size: .7rem;
  font-weight: 800;
  display: block;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .4rem;
}
.qp-verse-translation.hidden { display: none; }

/* Explication */
.qp-verse-tafsir {
  padding: .9rem 1.6rem 1.1rem;
  background: rgba(45,95,79,.04);
  border-top: 1px solid var(--qp-border);
}
.qp-verse-tafsir strong {
  display: block;
  font-size: .7rem;
  font-weight: 800;
  color: var(--qp-gold);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .5rem;
}
.qp-verse-tafsir p {
  font-size: .88rem;
  color: var(--qp-text2);
  line-height: 1.75;
  margin: 0;
}
.qp-verse-tafsir.hidden { display: none; }

/* Navigation bas de page */
.qp-reader-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.4rem;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--qp-border);
  background: var(--qp-surface2);
}
.qp-nav-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: 50px;
  border: 1.5px solid var(--qp-border);
  background: var(--qp-surface);
  color: var(--qp-text2);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--qp-t);
  font-family: var(--qp-ui);
}
.qp-nav-btn:hover:not(:disabled) {
  background: var(--qp-primary);
  border-color: var(--qp-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(45,95,79,.3);
}
.qp-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.qp-nav-info {
  font-size: .82rem;
  color: var(--qp-text3);
  font-weight: 600;
}

/* Etat vide */
.qp-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--qp-text3);
}
.qp-empty-ico { font-size: 3rem; margin-bottom: 1rem; display: block; }
.qp-empty-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; color: var(--qp-text2); }

/* Spinner */
.qp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1.2rem;
  color: var(--qp-text3);
}
.qp-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--qp-border);
  border-top-color: var(--qp-gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Délai staggered pour les cartes */
.qp-surah-card:nth-child(1)  { animation-delay: .03s }
.qp-surah-card:nth-child(2)  { animation-delay: .06s }
.qp-surah-card:nth-child(3)  { animation-delay: .09s }
.qp-surah-card:nth-child(4)  { animation-delay: .12s }
.qp-surah-card:nth-child(5)  { animation-delay: .15s }
.qp-surah-card:nth-child(6)  { animation-delay: .18s }
.qp-surah-card:nth-child(7)  { animation-delay: .21s }
.qp-surah-card:nth-child(8)  { animation-delay: .24s }
.qp-verse:nth-child(1)  { animation-delay: .04s }
.qp-verse:nth-child(2)  { animation-delay: .08s }
.qp-verse:nth-child(3)  { animation-delay: .12s }
.qp-verse:nth-child(4)  { animation-delay: .16s }
.qp-verse:nth-child(5)  { animation-delay: .20s }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .qp-grid {
    grid-template-columns: 1fr;
    padding: 0 .8rem 2rem;
  }
  .qp-verse-arabic { font-size: 1.45rem; }
  .qp-view-controls { gap: .35rem; }
  .qp-view-btn { padding: .5rem 1rem; font-size: .78rem; }
}