/* Qour'an Studio — thème studio sombre, or & émeraude */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --line: #2a2f3a;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, .14);
  --green: #3ddc84;
  --red: #e5484d;
  --txt: #e8e6e0;
  --muted: #9aa0ac;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #181c26 0%, var(--bg) 55%);
  color: var(--txt);
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 44px 48px; text-align: center; width: min(92vw, 380px);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  animation: rise .5s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-card .logo { font-size: 42px; }
.login-card h1 { margin: 8px 0 0; color: var(--gold); letter-spacing: .5px; }
.byline { margin: 2px 0 24px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font-size: 16px; margin-bottom: 14px;
}
.login-card button {
  width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--gold);
  color: #14161b; font-weight: 700; font-size: 16px; cursor: pointer; transition: filter .15s;
}
.login-card button:hover { filter: brightness(1.1); }
.login-err { color: var(--red); font-size: 14px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px; background: rgba(23, 26, 33, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 17px; white-space: nowrap; }
.brand b { color: var(--gold); }
.byline-inline { font-size: 11px; color: var(--muted); margin-inline-start: 8px; }
.topbar-controls { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 280px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
select {
  background: var(--panel-2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 10px; font-size: 14px; max-width: 300px;
}
.icon-btn {
  background: var(--panel-2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; font-size: 15px; cursor: pointer;
  text-decoration: none; transition: background .15s;
}
.icon-btn:hover { background: #262b37; }
.badge {
  background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(212,175,55,.35);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.mic-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 9px; padding: 9px 14px; cursor: pointer; font-size: 14px; transition: all .2s;
}
.mic-btn.ready { background: rgba(61,220,132,.12); border-color: rgba(61,220,132,.4); color: var(--green); }

/* ---------- Liste des ayahs ---------- */
main#ayahList {
  flex: 1; overflow-y: auto; padding: 26px clamp(14px, 6vw, 90px) 40px;
  scroll-behavior: smooth;
}
.ayah {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 24px; margin-bottom: 14px; cursor: pointer; position: relative;
  transition: border-color .25s, box-shadow .25s, transform .25s, background .25s;
}
.ayah:hover { border-color: #3a4252; }
.ayah.active {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 8px 40px rgba(212, 175, 55, .12);
  transform: scale(1.008);
}
.ayah.active.recording { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 8px 44px rgba(229,72,77,.22); }
.ayah-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ayah-ref { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .4px; }
.ayah.active .ayah-ref { color: var(--gold); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #3a4252; }
.status-dot.done { background: var(--green); box-shadow: 0 0 8px rgba(61,220,132,.6); }
.ayah-text {
  direction: rtl; text-align: right; line-height: 2.05; color: #f4f1e8;
  transition: font-size .2s;
}
.font-amiri .ayah-text { font-family: 'Amiri', serif; }
.font-scheherazade .ayah-text { font-family: 'Scheherazade New', serif; }
.font-noto .ayah-text { font-family: 'Noto Naskh Arabic', serif; }
.font-lateef .ayah-text { font-family: 'Lateef', serif; }
.font-indopak .ayah-text { font-family: 'PDMS Saleem QuranFont', 'Noto Naskh Arabic', serif; }
@font-face {
  font-family: 'PDMS Saleem QuranFont';
  src: url('../fonts/PDMS_Saleem_QuranFont.ttf') format('truetype');
  font-display: swap;
}

/* ---------- Transport ---------- */
.transport {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line);
  background: rgba(23, 26, 33, .96); backdrop-filter: blur(8px);
  position: sticky; bottom: 0; z-index: 20;
}
.transport-left { display: flex; align-items: center; gap: 10px; }
.t-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--txt);
  width: 44px; height: 44px; border-radius: 50%; font-size: 16px; cursor: pointer; transition: background .15s;
}
.t-btn:hover:not(:disabled) { background: #262b37; }
.t-btn:disabled { opacity: .35; cursor: default; }
.rec-btn {
  width: 62px; height: 62px; border-radius: 50%; border: 2px solid #5c2427;
  background: #2a1416; cursor: pointer; display: grid; place-items: center; transition: all .2s;
}
.rec-btn:disabled { opacity: .35; cursor: default; }
.rec-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--red); transition: border-radius .2s; }
.rec-btn.recording { background: var(--red); border-color: var(--red); animation: recpulse 1.1s infinite; }
.rec-btn.recording .rec-dot { background: #fff; border-radius: 4px; width: 18px; height: 18px; }
@keyframes recpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .55); }
  50% { box-shadow: 0 0 0 16px rgba(229, 72, 77, 0); }
}
.timer { font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 700; min-width: 74px; color: var(--muted); }
body.is-recording .timer { color: var(--red); }

.transport-center { display: flex; flex-direction: column; gap: 3px; }
#vuCanvas { background: #0b0d11; border: 1px solid var(--line); border-radius: 8px; }
.meter-info { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
#clipCount { color: var(--red); font-weight: 700; }

/* ---------- Panneau de prise ---------- */
.take-panel {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--gold); border-radius: 14px;
  padding: 10px 16px; animation: rise .3s ease; flex: 1; min-width: 320px;
}
.take-label { font-size: 13px; color: var(--muted); }
.take-label b { color: var(--txt); }
#takeAudio { height: 38px; max-width: 300px; }
.v-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter .15s;
}
.v-btn:hover { filter: brightness(1.2); }
.v-btn.ok { background: rgba(61,220,132,.14); border-color: rgba(61,220,132,.45); color: var(--green); }
.v-btn.danger { background: rgba(229,72,77,.12); border-color: rgba(229,72,77,.4); color: var(--red); }

/* ---------- Modales ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(8, 9, 12, .72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 50; animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 30px; width: min(94vw, 520px); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.55); animation: rise .25s ease;
}
.modal-card.center { text-align: center; }
.modal-card h2 { margin-top: 0; color: var(--gold); font-size: 19px; }
.modal-card label { display: block; font-size: 13.5px; color: var(--muted); margin: 14px 0 4px; }
.modal-card label select, .modal-card label input[type=range] { width: 100%; margin-top: 5px; }
.modal-card input[type=text] {
  width: 100%; padding: 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--txt); font-size: 15px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--txt) !important; margin-top: 18px !important; }
.localdir { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.localdir button { border: 1px solid var(--line); background: var(--panel-2); color: var(--txt); border-radius: 9px; padding: 10px 14px; cursor: pointer; }
#localDirStatus { font-size: 12.5px; color: var(--muted); }
#localDirStatus.ok { color: var(--green); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 16px; }
.modal-close { margin-top: 18px; border: 1px solid var(--line); background: var(--panel-2); color: var(--txt); border-radius: 9px; padding: 10px 22px; cursor: pointer; }
.remote-code { font-size: 44px; font-weight: 800; letter-spacing: 10px; color: var(--gold); margin: 8px 0 4px; }
.remote-url { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: monospace; font-size: 15px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 96px; right: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  color: var(--txt); padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: rise .25s ease; max-width: 360px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2c3240; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4252; }
