/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --ink:      #2c1f14;
  --ink-soft: #7a5a3a;
  --paper:    #fdf6ec;
  --cream:    #f5ead8;
  --gold:     #c87941;
  --gold-lt:  #fae5c8;
  --green:    #5a7a3a;
  --green-lt: #e8f0d8;
  --red:      #a83228;
  --red-lt:   #faeae8;
  --highlight:#fad48c;
  --radius:   6px;
  --shadow:   0 2px 12px rgba(44,31,20,.1);
  --arabic:   'Scheherazade New', serif;
  --nav-fg:   rgba(253,246,236,0.9);
  --nav-muted:rgba(253,246,236,0.55);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--paper); color: var(--ink); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
html { font-size: 102%; scroll-behavior: smooth; }
a { color: inherit; text-decoration: none; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 64px;
  background: var(--ink);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}
.navbar-brand {
  display: flex; align-items: center; gap: .45rem;
  color: var(--nav-fg); font-weight: 600; font-size: 1rem;
  flex-shrink: 0; text-decoration: none;
}
.brand-ar  { font-family: var(--arabic); font-size: 1.35rem; color: var(--gold); }
.brand-sep { color: var(--gold); opacity: .4; }

.navbar-center {
  display: flex; align-items: center; gap: 2.5rem;
  flex: 1; justify-content: center; flex-wrap: wrap;
}
.nav-toggle-item { display: flex; align-items: center; gap: .55rem; }
.nav-toggle-label {
  font-size: .78rem; font-weight: 500; color: var(--nav-muted);
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}
.apple-toggle-wrap { display: flex; align-items: center; gap: .35rem; }
.toggle-side-label { font-size: .75rem; font-weight: 600; color: var(--nav-muted); transition: color .25s; }
.apple-toggle-wrap:has(.lang-toggle:not(.on)) .toggle-side-label:first-child { color: var(--gold); }
.apple-toggle-wrap:has(.lang-toggle.on) .toggle-side-label:last-child { color: var(--gold); }

.apple-toggle {
  position: relative; width: 40px; height: 24px; border-radius: 12px;
  background: rgba(255,255,255,.2); border: none; cursor: pointer;
  transition: background .25s; flex-shrink: 0; padding: 0;
}
.apple-toggle.on { background: var(--gold); }
.toggle-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .25s; pointer-events: none;
}
.apple-toggle.on .toggle-knob { transform: translateX(16px); }

.nav-home-btn {
  font-size: .78rem; font-weight: 600; color: var(--nav-fg);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  padding: .3rem .85rem; border-radius: 20px; white-space: nowrap; transition: background .15s;
}
.nav-home-btn:hover { background: rgba(255,255,255,.2); }

.navbar-cta {
  background: var(--gold); color: white; padding: .4rem 1rem;
  border-radius: 20px; font-size: .82rem; font-weight: 600;
  transition: background .2s; white-space: nowrap; flex-shrink: 0;
}
.navbar-cta:hover { background: #e0b85a; }

/* ─── Main ───────────────────────────────────────────────────────────────── */
main { flex: 1; width: 100%; margin: 0 0; padding: 2rem 1.5rem; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: var(--green-lt); color: var(--green); border-left: 3px solid var(--green); }
.alert-error   { background: var(--red-lt);   color: var(--red);   border-left: 3px solid var(--red); }

/* ─── Home hero ──────────────────────────────────────────────────────────── */
.home-hero { text-align: center; padding: 2rem 1rem 1.75rem; }
.hero-arabic { font-family: var(--arabic); font-size: 2.8rem; color: var(--gold); line-height: 1.5; margin-bottom: .5rem; direction: rtl; }
.hero-title  { font-size: 2rem; font-weight: 600; color: var(--ink); line-height: 1.25; margin-bottom: .75rem; }
.hero-title em { color: var(--gold); font-style: normal; }
.hero-sub { color: var(--ink-soft); font-size: 1rem; max-width: 700px; margin: 0 auto; }

/* ─── Accordéons ─────────────────────────────────────────────────────────── */
.levels-list { display: flex; flex-direction: column; gap: .75rem; max-width: 60%; margin: 0 auto 3rem; }
.level-accordion { background: #fff; border: 1px solid #e8e4dc; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.accordion-trigger { width: 100%; display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; background: none; border: none; cursor: pointer; font-family: inherit; text-align: left; transition: background .15s; }
.accordion-trigger:hover { background: var(--cream); }
.accordion-left { display: flex; align-items: center; gap: 1rem; flex: 1; }
.acc-level-num { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: white; font-family: var(--arabic); font-size: 1.4rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.acc-text  { display: flex; flex-direction: column; }
.acc-title { font-weight: 600; font-size: .95rem; color: var(--ink); }
.acc-desc  { font-size: .8rem; color: var(--ink-soft); margin-top: .1rem; }
.acc-count { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.acc-chevron { font-size: .9rem; color: var(--ink-soft); transition: transform .25s; flex-shrink: 0; }
.accordion-body { border-top: 1px solid var(--cream); padding: .5rem 0; }
.text-list { list-style: none; padding-left: 0; counter-reset: text-counter; }
.text-item { display: flex; align-items: flex-start; counter-increment: text-counter; padding: 0 1.5rem; }
.text-item::before { content: counter(text-counter) "."; min-width: 1.5rem; font-size: .88rem; color: var(--ink-soft); flex-shrink: 0; padding-top: .65rem;  }
.text-item:hover { background: none; }
.text-link { display: flex; align-items: baseline; gap: .75rem; padding: .5rem .5rem .5rem 0; flex: 1; color: var(--ink); border-radius: var(--radius); }
.text-link:hover { background: var(--cream); }
.text-title-lang { font-size: .92rem; text-align: left; }
.text-title-ar { font-family: var(--arabic); font-size: 1.15rem; color: var(--ink-soft); direction: rtl; text-align: right; }
.text-title-ar { font-family: var(--arabic); font-size: 1.15rem; color: var(--ink-soft); direction: rtl; }
.has-audio { font-size: .8rem; flex-shrink: 0; margin-left: .5rem; }
.text-empty { font-size: .85rem; color: var(--ink-soft); font-style: italic; padding: .75rem 1.5rem; }
.text-link { justify-content: space-between; }

/* ─── Badges niveau ──────────────────────────────────────────────────────── */
.level-badge { font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.level-badge-1 { background: var(--green-lt); color: var(--green); }
.level-badge-2 { background: var(--gold-lt);  color: #7a5c00; }
.level-badge-3 { background: var(--red-lt);   color: var(--red); }

/* ─── Page texte ─────────────────────────────────────────────────────────── */
.text-page { width: 80%; margin: 0 auto; }

.text-topbar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.text-topbar .nav-home-btn { background: var(--ink); color: #fff; border-color: var(--ink); }
.text-topbar .nav-home-btn:hover { background: #2d2d4e; }

.audio-player { background: #fff; border: 1px solid #e8e4dc; border-radius: var(--radius); padding: .85rem 1.25rem; margin-bottom: 1.25rem; }
.audio-label  { font-size: .85rem; font-weight: 500; margin-bottom: .5rem; }
.audio-elem   { width: 100%; }

/* ─── Colonnes lecteur ───────────────────────────────────────────────────── */
.reader-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: .75rem 1.25rem;
  align-items: stretch;
}
.col-left, .col-right { display: contents; }
.col-left  .col-title-block { grid-column: 1; grid-row: 1; }
.col-right .col-title-block { grid-column: 2; grid-row: 1; }
.col-left  .col-text-block  { grid-column: 1; grid-row: 2; }
.col-right .col-text-block  { grid-column: 2; grid-row: 2; }

/* Blocs titre */
.col-title-block {
  background: #fff; border: 1px solid #e8e4dc; border-radius: var(--radius);
  padding: .85rem 1.25rem; box-shadow: var(--shadow); display: flex; align-items: center;
}
.col-title-block-ar { direction: rtl; }
.col-title-text { font-size: 1.15rem; font-weight: 600; color: var(--ink); display: block; }
.col-title-text-ar { font-family: var(--arabic); font-size: 1.78rem; font-weight: 500; color: var(--ink); display: block; line-height: 1.6; }
.col-title-text-ar.vowels-off { font-size: 1.8rem; }

/* Blocs texte */
.col-text-block { background: #fff; border: 1px solid #e8e4dc; border-radius: var(--radius); box-shadow: var(--shadow); }

.col-translation {
  font-size: 1.04rem;
  line-height: 3.3;
  text-align: justify;
  padding: 1.25rem 1.5rem;
  color: var(--ink-soft);
}
.col-arabic {
  font-family: var(--arabic);
  font-size: 1.65rem;
  line-height: 2.3;
  text-align: justify;
  direction: rtl;
  padding: 1.25rem 1.5rem;
}
.col-arabic.vowels-on {
  font-size: 1.638rem;
}

/* ─── Phrases inline (spans) ─────────────────────────────────────────────── */
.sentence-ar, .sentence-tr {
  cursor: pointer; border-radius: 3px; padding: 0 2px; transition: background .15s;
}
.sentence-en { font-size: 1.09rem; }
.sentence-fr { font-size: 1.04rem; }
.sentence-ar::after { content: ' '; }
.sentence-tr::after { content: ' '; }
.sentence-ar:hover  { background: rgba(201,168,76,.15); }
.sentence-tr:hover  { background: rgba(201,168,76,.15); }
.sentence-ar.highlighted { background: var(--highlight); }
.sentence-tr.highlighted { background: var(--highlight); color: var(--ink); }

/* ─── Harakat invisibles (sans déplacer le texte) ────────────────────────── */
/* Méthode JS : suppression directe du texte via data-original */

/* ─── Footer Arabium ─────────────────────────────────────────────────────── */
.arabium-banner { background: var(--ink); color: #fff; padding: 2rem 1.5rem; margin-top: auto; }
.banner-inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.banner-logo  { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.banner-ar    { font-family: var(--arabic); font-size: 2rem; color: var(--gold); }
.banner-name  { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.banner-text  { flex: 1; min-width: 200px; }
.banner-tagline { font-weight: 600; margin-bottom: .35rem; }
.banner-desc    { font-size: .85rem; color: rgba(255,255,255,.65); }
.banner-btn { background: var(--gold); color: var(--ink); font-weight: 600; font-size: .88rem; padding: .65rem 1.4rem; border-radius: 20px; white-space: nowrap; transition: background .2s; flex-shrink: 0; }
.banner-btn:hover { background: #e0b85a; }

/* ─── Admin ──────────────────────────────────────────────────────────────── */
.admin-body { background: var(--cream); }
.login-card  { max-width: 360px; margin: 5rem auto; background: #fff; padding: 2.5rem; border-radius: 10px; box-shadow: var(--shadow); }
.login-logo  { font-family: var(--arabic); font-size: 2.5rem; color: var(--gold); text-align: center; margin-bottom: .5rem; }
.login-title { font-size: 1.1rem; font-weight: 600; text-align: center; margin-bottom: 1.5rem; }
.admin-wrap  { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.admin-heading { font-size: 1.4rem; font-weight: 600; }
.admin-actions-top { display: flex; gap: .75rem; align-items: center; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.admin-table th { background: var(--ink); color: #fff; padding: .7rem 1rem; text-align: left; font-size: .82rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.admin-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--cream); font-size: .9rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.table-link  { color: var(--ink); font-weight: 500; }
.table-link:hover { text-decoration: underline; }
.date-cell   { color: var(--ink-soft); font-size: .82rem; }
.table-actions { display: flex; gap: .5rem; align-items: center; }
.empty-state { text-align: center; padding: 3rem; color: var(--ink-soft); background: #fff; border-radius: 8px; }
.admin-form  { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: var(--shadow); }
.form-row    { display: flex; gap: 1rem; margin-bottom: 1.25rem; }
.flex-1 { flex: 1; } .flex-2 { flex: 2; }
.form-group  { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
label { font-size: .85rem; font-weight: 500; color: var(--ink); }
.label-hint  { font-weight: 400; color: var(--ink-soft); margin-left: .5rem; }
.form-input  { border: 1px solid #d0ccc0; border-radius: var(--radius); padding: .55rem .8rem; font-size: .95rem; font-family: inherit; background: var(--paper); color: var(--ink); transition: border-color .15s; width: 100%; }
.form-input:focus { outline: none; border-color: var(--gold); }
.form-textarea { border: 1px solid #d0ccc0; border-radius: var(--radius); padding: .75rem; font-size: .95rem; font-family: inherit; background: var(--paper); color: var(--ink); resize: vertical; transition: border-color .15s; width: 100%; }
.form-textarea:focus { outline: none; border-color: var(--gold); }
.arabic-textarea { font-family: var(--arabic); font-size: 1.2rem; line-height: 2; }
.arabic-input    { font-family: var(--arabic); font-size: 1.15rem; }
.line-count      { font-size: .78rem; color: var(--ink-soft); align-self: flex-end; }
.sentences-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.count-warning   { background: #fff3cd; color: #856404; border-left: 3px solid #ffc107; padding: .65rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .88rem; }
.audio-current   { font-size: .85rem; color: var(--ink-soft); margin-bottom: .5rem; }
.form-actions    { display: flex; gap: 1rem; align-items: center; }
.btn-primary { background: var(--ink); color: #fff; border: none; padding: .6rem 1.3rem; border-radius: var(--radius); font-size: .9rem; font-weight: 500; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; transition: background .2s; }
.btn-primary:hover { background: #2d2d4e; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-primary.full-width { width: 100%; text-align: center; }
.btn-ghost { background: none; border: 1px solid #d0ccc0; color: var(--ink-soft); padding: .55rem 1.1rem; border-radius: var(--radius); font-size: .9rem; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; transition: all .15s; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { font-size: .8rem; padding: .3rem .7rem; border-radius: 4px; border: 1px solid #d0ccc0; background: none; cursor: pointer; font-family: inherit; text-decoration: none; color: var(--ink-soft); transition: all .15s; }
.btn-sm:hover { background: var(--cream); color: var(--ink); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-lt); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  main { padding: .4rem .25rem; }
  .levels-list { width: 100%; max-width: none; }
  .home-hero { width: 100%; }
  .text-page { width: 100%; }
  .reader-columns { gap: 0.25rem .1rem; }
  .navbar { padding: 0 1rem; height: auto; min-height: 56px; flex-wrap: wrap; padding-block: .5rem; }
  .navbar-center { order: 3; width: 100%; justify-content: center; padding-bottom: .5rem; gap: 1rem; }
  .navbar-cta { display: none; }
  .navbar-brand { display: none; }
  .nav-toggle-label { display: none; }
  .vowels-label { display: block !important; }
  .apple-toggle-wrap { justify-content: center; }
  .col-left, .col-right { display: contents; }
  .reader-columns { grid-template-columns: 1fr 1fr; width: 100%; overflow: hidden; }
  .col-text-block { min-width: 0; width: 100%; padding: 1rem .2rem; }
  .col-title-block { padding: .6rem .2rem; }
  .col-arabic { font-size: 1.05rem !important; line-height: 2 !important; text-align: right;}
  .col-arabic.vowels-on { font-size: 0.9rem; }
  .col-text-block.col-translation { font-size: .74rem !important; line-height: 2.2 !important; }
  .sentence-tr { font-size: .74rem !important; }
  .col-title-text { font-size: .74rem; }
  .col-title-text-ar { font-size: 1.05rem; }
  .col-title-text-ar.vowels-off { font-size: 1.15rem !important; }
  .hero-title  { font-size: 1.4rem; }
  .banner-inner { flex-direction: column; text-align: center; }
  .form-row { flex-direction: column; }
  .arabiumplus-btn {
   text-align: center;
   font-size: .7rem !important;
 }
  .reader-segment {
    margin-top: -1rem !important;
  }

}


/* ─── Arabium+ ───────────────────────────────────────────────────────────── */
.arabiumplus-sep {
  margin-top: .75rem;
  display: flex;
  justify-content: center;
}
.arabiumplus-btn {
  background: var(--ink);
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  padding: .55rem 1.25rem;
  border-radius: 20px;
  text-decoration: none;
  transition: background .2s;
}
.arabiumplus-btn:hover { background: #4a3020; }

.level-arabiumplus {
  border-color: var(--ink);
  border-width: 2px;
  margin-top: 2rem;
}
.level-arabiumplus .accordion-trigger {
  background: var(--gold-lt);
}
.level-arabiumplus .accordion-trigger:hover {
  background: var(--cream);
}
.level-arabiumplus .acc-title {
  color: var(--ink);
  font-size: 1.05rem;
}


/* ─── Segments de texte séparés par --- ──────────────────────────────────── */
.reader-segment {
  margin-top: -2rem;
}

/* ─── Continuité visuelle entre segments ────────────────────────────────── */
.reader-segment .col-text-block {
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: none;
}
.reader-columns:not(.reader-segment) .col-text-block {
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: none;
}
/* Dernier segment : coins arrondis en bas */
.reader-columns:last-of-type .col-text-block {
  border-radius: 0 0 var(--radius) var(--radius);
}
/* Bloc unique (pas de ---) : tous les coins arrondis */
.reader-columns:only-of-type .col-text-block {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}


/* ─── Vidéo démo ─────────────────────────────────────────────────────────── */
.demo-section {
  margin-top: 4rem;
  text-align: center;
}
.demo-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
}
.demo-video {
  width: 80%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}