/* Basma : couleurs reprises de la charte du site Collectif HOPE (src/styles/hope.css). */
:root {
  --paper: #ffffff;
  --ground: #f6f9f7;
  --mint: #def7f2;
  --brand: #084042;
  --teal: #027878;
  --teal-dark: #015f5f;
  --ink: #0f262f;
  --muted: #557078;
  --line: #dae7e7;
  --coral: #e7533c;
  --coral-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --ok: #0d6b4f;
  --ok-bg: #e3f6ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 38, 47, .06), 0 4px 16px rgba(15, 38, 47, .05);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --title: "Poppins", "Inter", system-ui, sans-serif;
  --arabic: "Noto Naskh Arabic", "Segoe UI", "Geeza Pro", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1, h2, h3 { font-family: var(--title); color: var(--brand); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* --- en-tête --- */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand); font: 600 1.2rem var(--title); }
.brand img { height: 30px; }
.ar-name { font-family: var(--arabic); font-weight: 700; color: var(--teal); margin-left: 4px; }
.brand span small { display: block; font: 400 .7rem var(--sans); color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--ground); color: var(--brand); }
.nav a.active { background: var(--mint); color: var(--brand); }
.badge { display: inline-block; min-width: 1.5em; padding: 0 .45em; border-radius: 99px; background: var(--coral); color: #fff; font-size: .75rem; font-weight: 600; text-align: center; line-height: 1.5em; margin-left: 4px; }
.me { display: flex; align-items: center; gap: 10px; }
.me img, .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--mint); color: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: .85rem; object-fit: cover; }
.me form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

/* --- éléments --- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.stat b { display: block; font: 600 1.7rem var(--title); color: var(--brand); }
a.stat:hover { border-color: var(--teal); }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--brand); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; }
.hero h2 { color: #fff; font-size: 1.35rem; margin: 0; }
.hero p { margin: 4px 0 0; color: #cfe7e5; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; background: var(--teal); color: #fff; }
.btn:hover { background: var(--teal-dark); color: #fff; }
.btn.light { background: var(--paper); color: var(--brand); border-color: var(--line); }
.btn.light:hover { border-color: var(--teal); color: var(--teal); }
.btn.white { background: #fff; color: var(--brand); }
.btn.danger { background: var(--paper); color: var(--coral); border-color: #f3c3ba; }
.btn.danger:hover { background: var(--coral-bg); }
.btn.big { padding: 13px 22px; font-size: 1rem; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.ghost { background: none; color: var(--muted); padding: 6px 8px; font-weight: 500; }
.btn.ghost:hover { color: var(--brand); background: var(--ground); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--ground); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok, .pill.done, .pill.approved { background: var(--ok-bg); color: var(--ok); }
.pill.processing, .pill.new, .pill.review { background: var(--mint); color: var(--teal-dark); }
.pill.failed, .pill.off, .pill.rejected { background: var(--coral-bg); color: #b73a26; }
.pill.ignored { background: #eef1f2; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--ok-bg); color: var(--ok); font-weight: 500; }
.flash.error { background: var(--coral-bg); color: #b73a26; }
.alert { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 12px 14px; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--teal); }
.tabs a span { color: var(--muted); font-weight: 400; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.error-text { color: #b73a26; font-size: .85rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; }
.list li:last-child { border-bottom: 0; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--brand); }

/* --- grille de clips --- */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.clip-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.clip-card:hover { border-color: var(--teal); transform: translateY(-2px); color: var(--ink); }
.thumb { position: relative; aspect-ratio: 9 / 16; background: #0f262f; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .7); color: #fff; font-size: .75rem; padding: 1px 6px; border-radius: 6px; }
.thumb .warn { position: absolute; left: 8px; top: 8px; background: var(--warn-bg); color: var(--warn); font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.clip-card .meta { padding: 10px 12px 12px; font-size: .85rem; }
.clip-card .meta b { display: block; font-size: .9rem; margin-bottom: 2px; line-height: 1.3; }

/* --- relecture d'un clip --- */
.review-layout { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 24px; align-items: start; }
.player { position: sticky; top: 80px; }
.player video { width: 100%; aspect-ratio: 9 / 16; max-height: 78vh; object-fit: contain; background: #000; border-radius: var(--radius); display: block; }
.facts { margin-top: 12px; font-size: .9rem; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.facts div span:first-child { color: var(--muted); }
.lang { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--paper); }
.lang h3 { display: flex; justify-content: space-between; align-items: center; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
label:first-of-type { margin-top: 0; }
input[type=text], input[type=email], textarea, select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; color: var(--ink); background: #fff; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); outline: 2px solid var(--mint); }
textarea { min-height: 96px; resize: vertical; }
[dir=rtl] { font-family: var(--arabic); font-size: 1.05rem; }
.counter { font-weight: 400; color: var(--muted); font-size: .8rem; float: right; }
.counter.over { color: var(--coral); font-weight: 600; }
.actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--ground) 30%); padding: 20px 0 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions .spacer { flex: 1; }
details.reject { background: var(--paper); border: 1px solid #f3c3ba; border-radius: var(--radius); padding: 12px 16px; margin-top: 8px; }
details.reject summary { cursor: pointer; color: var(--coral); font-weight: 600; }
.status-banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-banner.approved { background: var(--ok-bg); color: var(--ok); }
.status-banner.rejected { background: var(--coral-bg); color: #b73a26; }
.status-banner form { margin: 0; }
.subs { font-size: .9rem; color: var(--muted); }
.subs li { margin-bottom: 4px; }

/* --- connexion --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--mint), var(--ground) 60%); }
.login .card { width: 100%; max-width: 420px; text-align: center; padding: 36px 28px; }
.login img { height: 64px; margin-bottom: 12px; }
.login h1 { font-size: 1.9rem; margin-bottom: 4px; }
.google-btn { width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line); margin-top: 20px; }
.google-btn:hover { background: var(--ground); color: var(--ink); border-color: var(--teal); }
.google-btn svg { width: 18px; height: 18px; }
.hint { margin-top: 12px; }
.dev-box { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--line); text-align: left; }
.dev-box .btn { width: 100%; margin-top: 8px; }

@media (max-width: 820px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  .player video { max-height: 58vh; }
  .me { margin-left: auto; }
  .review-layout { grid-template-columns: 1fr; }
  .player { position: static; max-width: 360px; margin: 0 auto; width: 100%; }
  .hide-mobile { display: none; }
}

/* --- traductions : éditeur de sous-titres --- */
.lang-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lang-switch .btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.cues { display: grid; gap: 10px; }
.cue { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; transition: border-color .15s, box-shadow .15s; }
.cue.current { border-color: var(--teal); box-shadow: 0 0 0 3px var(--mint); }
.cue-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cue-head .spacer { flex: 1; }
.cue-n { font: 600 .85rem var(--title); color: var(--brand); min-width: 1.6em; }
input.time { width: 6.2em; padding: 6px 8px; font-variant-numeric: tabular-nums; text-align: center; }
.cue-langs { display: grid; grid-template-columns: 2.2em 1fr; gap: 6px 8px; align-items: start; }
.cue-langs textarea { min-height: 0; padding: 7px 10px; }
.cue-langs textarea[readonly] { background: var(--ground); color: var(--muted); }
.tag { font: 600 .75rem var(--sans); color: var(--muted); padding-top: 9px; }
.cue-alerts { margin-top: 8px; font-size: .82rem; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; }
.danger-text { color: var(--coral); }
.share-box { background: var(--ok-bg); border-radius: var(--radius); padding: 12px 14px; }
.share-box b { display: block; color: var(--ok); margin-bottom: 8px; }

/* --- envoi de vidéos --- */
.upload { display: grid; gap: 16px; }
.drop { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 24px 16px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--ground); cursor: pointer; margin: 0; }
.drop:hover { border-color: var(--teal); }
.drop input { max-width: 100%; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.choices legend { font-weight: 600; margin-bottom: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; font-weight: 400; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--mint); }
.choice input { margin-top: 4px; }
.choice small { display: block; color: var(--muted); }
progress { width: 100%; height: 10px; accent-color: var(--teal); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }
@media (max-width: 820px) {
  .topbar-inner > .btn.small { order: 2; }
}
@media (max-width: 1150px) {
  .me .hide-mobile { display: none; }
  .nav a { padding: 8px 9px; }
}
/* sept onglets ne tiennent sur une ligne avec le logo qu'à partir de 1280 px : en dessous, la navigation
   passe sur sa propre ligne */
@media (max-width: 1279px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
  .nav a { white-space: nowrap; }
  .me { margin-left: auto; }
  .topbar-inner > .btn.small { order: 2; }
  .player { top: 116px; }
}

/* --- consignes de l'équipe --- */
.analysis { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.analysis p:last-child { margin-bottom: 0; }
.guidelines { display: grid; gap: 12px; }
.guideline.proposed { border-left: 4px solid var(--teal); }
.g-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.guideline textarea, .g-edit textarea { min-height: 0; }
.why { font-size: .9rem; margin: 8px 0 4px; }
.g-sources { margin-bottom: 10px; }
.g-list li { display: block; }
.g-edit .btn-row { margin-top: 6px; gap: 6px; }
.guideline select { width: auto; max-width: 100%; }
label.inline { display: inline; margin: 0; font-weight: 500; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.alert.notice { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* --- planning --- */
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.day { padding: 14px; }
.day h3 { margin-bottom: 8px; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slot { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 0; border-top: 1px solid var(--line); }
.slot:first-child { border-top: 0; }
.slot form { margin: 0 0 0 auto; }
.slot.past { opacity: .55; }
.slot-time { font: 600 .85rem var(--title); color: var(--brand); min-width: 3.2em; font-variant-numeric: tabular-nums; }
.slot-clip { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; text-decoration: none; color: var(--ink); }
.slot-clip img { width: 30px; height: 53px; object-fit: cover; border-radius: 4px; background: var(--ink); flex: none; }
.slot-clip span { min-width: 0; font-size: .85rem; line-height: 1.3; }
.slot-clip b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.slot-clip small { color: var(--muted); }
.ok-text { color: var(--ok); font-weight: 600; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0 0; }
fieldset.checks { border: 0; padding: 0; margin: 12px 0 0; display: flex; gap: 4px 16px; flex-wrap: wrap; }
fieldset.checks legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 2px; }
fieldset.checks label.check { margin: 0; }
div.clip-card .thumb { display: block; }
