/* ===========================================
   Cartographie de la Sunna — Institut Miftah
   Adapté du template Coran
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:wght@400;500;600;700&display=swap');

/* --- Variables --- */
:root {
  --bg: #ffffff;
  --cream: #f5f9f3;
  --card: #ffffff;
  --card-hover: #fafcf8;
  --border: #d1ddc9;
  --text: #1e3a2b;
  --dim: #6b7f6e;

  /* Palette Sunna — vert profond dominant */
  --accent: #2d7d4b;
  --accent-dark: #1f5a36;
  --accent-light: #4aa86a;
  --navy: #1e3a2b;

  /* Couleurs thématiques pour sections */
  --green: #2d7d4b;
  --gold: #c8984a;
  --blue: #3a8fc2;
  --red: #c25b6e;
  --orange: #d4783b;
  --purple: #7b5ea7;
  --teal: #0eb290;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Base --- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* =====================
   SITE HEADER
   ===================== */
.site-header {
  text-align: center;
  padding: 28px 24px 0;
}
.site-header a { text-decoration: none; display: inline-block; }
.site-header img {
  height: 80px;
  margin: 0 auto;
  transition: opacity .2s;
}
.site-header img:hover { opacity: .85; }

/* =====================
   HERO (page d'accueil)
   ===================== */
.hero {
  text-align: center;
  padding: 16px 24px 28px;
}
.hero-bismillah {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--accent);
  direction: rtl;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeDown .8s .1s ease forwards;
}
.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  opacity: 0;
  animation: fadeDown .8s .2s ease forwards;
}
.hero h1 span { color: var(--accent); }
.hero-sub {
  font-size: .92rem;
  color: var(--dim);
  margin-top: 10px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  opacity: 0;
  animation: fadeDown .8s .3s ease forwards;
}

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

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 22px;
  opacity: 0;
  animation: fadeDown .8s .4s ease forwards;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: .78rem;
  color: var(--dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Gold line */
.gold-line {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 20px auto;
}

/* =====================
   CARTE HADITH INTRO (page accueil)
   ===================== */
.hadith-card-intro {
  max-width: 820px;
  margin: 30px auto;
  padding: 0 20px;
}
.hadith-card-intro-inner {
  background: var(--cream);
  border: 1px solid var(--border);
  border-right: 4px solid var(--accent);
  border-radius: 10px;
  padding: 26px 30px;
}
.hadith-card-intro-inner .ar-text {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.15rem;
  line-height: 2;
  direction: rtl;
  color: var(--navy);
  text-align: right;
  margin-bottom: 14px;
}
.hadith-card-intro-inner .fr-text {
  font-size: .95rem;
  line-height: 1.75;
  color: var(--text);
  font-style: italic;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.hadith-card-intro-inner .source {
  font-size: .8rem;
  color: var(--dim);
  margin-top: 10px;
  text-align: right;
}

/* =====================
   SEARCH BAR
   ===================== */
.search-bar {
  max-width: 500px;
  margin: 20px auto;
  padding: 0 20px;
  text-align: center;
}
.search-bar input {
  width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 125, 75, 0.1);
}
.search-count {
  margin-top: 8px;
  font-size: .82rem;
  color: var(--dim);
  font-style: italic;
}

/* =====================
   SECTION TITLES (familles thématiques)
   ===================== */
.section-title {
  text-align: center;
  max-width: 800px;
  margin: 30px auto 20px;
  padding: 0 20px;
}
.section-title h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.section-title .ar-section {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.3rem;
  color: var(--accent);
  direction: rtl;
  margin-bottom: 10px;
}
.section-title p {
  font-size: .88rem;
  color: var(--dim);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
}

/* =====================
   GRID + CARDS (hadiths)
   ===================== */
.hadith-grid {
  max-width: 1100px;
  margin: 0 auto 20px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.hadith-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px 16px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.hadith-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(30, 58, 43, 0.1);
  border-color: var(--accent-light);
  background: var(--card-hover);
}
.card-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.ready-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: .65rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(45, 125, 75, 0.08);
  padding: 3px 8px;
  border-radius: 10px;
}

/* Badge "à venir" */
.coming-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: .65rem;
  color: var(--dim);
  font-weight: 600;
  background: rgba(107, 127, 110, 0.12);
  padding: 3px 8px;
  border-radius: 10px;
}

/* Cartes "à venir" : grisées et non cliquables */
.hadith-card.coming-soon {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(30%);
}

.hadith-card.coming-soon:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(30, 58, 43, 0.05);
  border-color: var(--border);
  background: var(--card);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 6px;
  margin-bottom: 10px;
}
.card-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-number .num {
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 1.1rem;
}
.card-meta { flex: 1; min-width: 0; }
.card-meta h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 2px;
}
.card-meta .ar-name {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: .95rem;
  color: var(--accent-dark);
  direction: rtl;
  display: block;
  margin-bottom: 4px;
}
.card-source {
  font-size: .7rem;
  color: var(--dim);
  font-style: italic;
}
.card-desc {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.5;
  margin-top: auto;
}

.footer-ar {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--accent);
  direction: rtl;
  margin-bottom: 14px;
}

/* =====================
   BREADCRUMB
   ===================== */
.breadcrumb {
  max-width: 900px;
  margin: 16px auto;
  padding: 0 24px;
  font-size: .85rem;
  color: var(--dim);
  text-align: center;
}
.breadcrumb a {
  color: var(--accent);
  transition: color .2s;
}
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb span { margin: 0 6px; color: var(--dim); }

/* =====================
   HEADER PAGE HADITH
   ===================== */
.header {
  text-align: center;
  padding: 20px 24px 30px;
  max-width: 900px;
  margin: 0 auto;
}
.bismillah {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--accent);
  direction: rtl;
  margin-bottom: 14px;
}
.header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.header h1 span { color: var(--accent); }
.header .ar-title {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.6rem;
  color: var(--accent-dark);
  direction: rtl;
  margin: 10px 0;
}
.header .sub {
  font-size: .95rem;
  color: var(--dim);
  margin-top: 10px;
  line-height: 1.6;
}
.header .sub strong { color: var(--accent-dark); }

/* =====================
   INTRO
   ===================== */
.intro {
  max-width: 820px;
  margin: 0 auto 30px;
  padding: 24px 28px;
  background: var(--cream);
  border-radius: 10px;
  border-right: 3px solid var(--accent);
}
.intro p {
  font-size: .98rem;
  line-height: 1.75;
  color: var(--text);
}

/* =====================
   BOUTON IMPRIMER
   ===================== */
.print-btn-wrap {
  text-align: center;
  margin: 20px auto 30px;
  max-width: 600px;
}
.print-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 30px;
  font-size: .95rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
}
.print-btn:hover { background: var(--accent-dark); }
.print-note {
  font-size: .8rem;
  color: var(--dim);
  margin-top: 8px;
  font-style: italic;
}

/* =====================
   HADITH CARD (arabe + trad)
   ===================== */
.hadith-main {
  max-width: 860px;
  margin: 0 auto 40px;
  padding: 0 20px;
}
.hadith-main-card {
  background: #fff;
  border: 1px solid var(--border);
  border-right: 4px solid var(--accent);
  border-radius: 10px;
  padding: 32px 36px;
  box-shadow: 0 2px 8px rgba(30, 58, 43, 0.06);
}
.hadith-main-card .ar-text {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.4rem;
  line-height: 2.2;
  direction: rtl;
  color: var(--navy);
  text-align: right;
  margin-bottom: 20px;
}
.hadith-main-card .fr-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  font-style: italic;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.hadith-main-card .source {
  font-size: .85rem;
  color: var(--dim);
  margin-top: 14px;
  text-align: right;
}
.hadith-main-card .source strong { color: var(--accent-dark); }

/* =====================
   BIOGRAPHIE + GLOSSAIRE (style Zad)
   ===================== */
.biographie-glossaire {
  max-width: 860px;
  margin: 0 auto 30px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .biographie-glossaire {
    grid-template-columns: 1fr;
  }
}

.biographie-card,
.glossaire-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(30, 58, 43, 0.04);
}

.biographie-header,
.glossaire-header {
  padding: 14px 20px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.biographie-header h3,
.glossaire-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

.biographie-icon,
.glossaire-icon {
  font-size: 1.2rem;
}

.biographie-body {
  padding: 18px 22px;
}

.biographie-body p {
  font-size: .92rem;
  line-height: 1.75;
  color: var(--text);
}

.glossaire-body {
  padding: 14px 20px;
}

.glossaire-list {
  margin: 0;
  padding: 0;
}

.glossaire-entry {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.glossaire-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.glossaire-entry:first-child {
  padding-top: 0;
}

.glossaire-entry dt {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.mot-ar {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.15rem;
  color: var(--accent-dark);
  direction: rtl;
  font-weight: 600;
}

.mot-fr {
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  color: var(--dim);
  font-style: italic;
}

.glossaire-entry dd {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text);
  margin-left: 0;
  padding-left: 0;
}

/* =====================
   SECTIONS DÉPLIABLES
   ===================== */
.sections {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

.block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
  cursor: pointer;
}
.block:hover {
  border-color: var(--accent-light);
  box-shadow: 0 3px 12px rgba(30, 58, 43, 0.08);
}

.b-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}
.b-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.b-meta { flex: 1; }
.b-meta h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 4px;
}
.bv {
  font-size: .8rem;
  color: var(--dim);
  margin-bottom: 6px;
  font-style: italic;
}
.b-summary {
  font-size: .92rem;
  color: var(--text);
  line-height: 1.6;
  margin-top: 8px;
}
.b-tags {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btag {
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}
.btag-theme {
  background: rgba(45, 125, 75, 0.1);
  color: var(--accent-dark);
}
.btag-key {
  background: rgba(200, 152, 74, 0.15);
  color: #8a6625;
}
.b-arrow {
  color: var(--accent);
  font-size: 1.2rem;
  transition: transform .3s;
  flex-shrink: 0;
}
.block.open .b-arrow {
  transform: rotate(180deg);
}

.b-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease;
}
.block.open .b-detail {
  max-height: 3000px;
}
.detail-inner {
  padding: 0 24px 24px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 0;
}

.d-section {
  margin-bottom: 24px;
}
.d-section:last-child { margin-bottom: 0; }
.d-section h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.d-section p {
  font-size: .94rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 12px;
}

.ayah {
  font-family: 'Noto Naskh Arabic', 'Amiri', serif;
  font-size: 1.05rem;
  line-height: 2;
  direction: rtl;
  text-align: right;
  padding: 14px 18px;
  border-right: 3px solid var(--accent);
  background: rgba(45, 125, 75, 0.06);
  border-radius: 6px;
  margin: 12px 0;
  color: var(--navy);
}

.rules-list {
  list-style: none;
  padding: 0;
  margin-top: 8px;
}
.rules-list li {
  position: relative;
  padding: 10px 14px 10px 32px;
  margin-bottom: 8px;
  background: var(--cream);
  border-radius: 6px;
  font-size: .92rem;
  line-height: 1.6;
}
.rules-list li::before {
  content: "◆";
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--accent);
  font-size: .8rem;
}

.link-box {
  background: rgba(45, 125, 75, 0.08);
  border-right: 3px solid var(--accent);
  padding: 12px 16px;
  margin-top: 14px;
  border-radius: 6px;
  font-size: .88rem;
  line-height: 1.6;
}
.link-box strong { color: var(--accent-dark); }

/* =====================
   GRILLE MNÉMOTECHNIQUE
   ===================== */
.mnemonic {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 20px;
}
.mnemonic-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
}
.mnemonic-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
  margin-bottom: 20px;
}
.m-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.m-item {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid;
  text-align: center;
}
.m-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.m-label {
  font-size: .88rem;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 500;
}
.m-verses {
  font-size: .75rem;
  color: var(--dim);
  font-style: italic;
}

/* =====================
   NAVIGATION HADITH
   ===================== */
.nav-hadith {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nav-hadith a {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  transition: all .2s;
}
.nav-hadith a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--cream);
}
.nav-home {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent) !important;
}
.nav-home:hover {
  background: var(--accent-dark) !important;
  color: #fff !important;
}

/* =====================
   FOOTER
   ===================== */
.footer {
  text-align: center;
  padding: 40px 24px 30px;
  font-size: .85rem;
  color: var(--dim);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer a {
  color: var(--accent);
}
.footer p {
  line-height: 1.7;
}

/* =====================
   PROGRESS BAR + SCROLL TOP
   ===================== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 999;
  transition: width .2s ease;
}
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .2s;
  box-shadow: 0 4px 12px rgba(30, 58, 43, 0.2);
  z-index: 998;
}
.scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.scroll-top:hover {
  transform: translateY(-2px);
  background: var(--accent-dark);
}

/* =====================
   IMPRESSION PDF
   ===================== */
@media print {
  body { background: #fff; }
  .site-header, .breadcrumb, .print-btn-wrap, .nav-hadith, .footer,
  .progress-bar, .scroll-top { display: none !important; }
  .block { page-break-inside: avoid; }
  .b-detail { max-height: none !important; }
  .b-arrow { display: none; }
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 640px) {
  .header h1 { font-size: 1.9rem; }
  .header .ar-title { font-size: 1.3rem; }
  .hadith-main-card { padding: 22px 20px; }
  .hadith-main-card .ar-text { font-size: 1.2rem; }
  .b-header { padding: 16px 18px; gap: 12px; }
  .b-icon { width: 36px; height: 36px; font-size: 1rem; }
  .b-meta h3 { font-size: 1.1rem; }
  .detail-inner { padding: 20px 18px; }
  .mnemonic-card { padding: 20px; }
}
