/* Nalios Clips — charte Nalios : Poppins, fond blanc, texte navy, accents teal à plat. */

@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --primary: #009AA2;
  --primary-strong: #007981;
  --secondary: #2AC2CB;
  --ink: #242D36;
  --ink-2: #4A5560;
  --ink-3: #7B8794;
  --line: #E2E7EC;
  --line-2: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --surface-3: #EDF1F4;
  --tint: #ECF8F9;
  --success: #1F9D62;
  --warning: #E0A100;
  --danger: #D5443B;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(36, 45, 54, .06), 0 4px 16px rgba(36, 45, 54, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-2);
}
h1 { font-size: 1.6rem; font-weight: 600; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.lead { color: var(--ink-2); font-size: 1.02rem; }

/* ---- Barre du haut ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand img { display: block; height: 26px; width: auto; }
.brand-product { font-weight: 600; color: var(--primary); font-size: 1.05rem; padding-left: 10px; border-left: 1px solid var(--line); }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav > a:not(.btn) { color: var(--ink-2); font-weight: 500; }
.topnav > a.active { color: var(--primary); }
.user-chip { color: var(--ink-2); font-size: .9rem; }
.muted-link { color: var(--ink-3) !important; font-size: .9rem; font-weight: 400 !important; }

.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.container.narrow { max-width: 980px; }
.center-page { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

/* ---- Boutons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: .95rem; line-height: 1;
  padding: 11px 18px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-record, .btn-record-sm { background: var(--ink); color: #fff; }
.btn-record:hover, .btn-record-sm:hover { background: #11171d; }
.btn-record-sm { padding: 8px 14px; font-size: .9rem; }
.btn-stop { background: var(--danger); color: #fff; }
.btn-stop:hover { background: #b9362e; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; }
.rec-dot.pulse { animation: pulse 1.2s infinite; }
.rec-dot.paused { animation: none; background: var(--warning); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- Cartes, formulaires ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.field-label { display: block; font-weight: 500; font-size: .88rem; margin: 16px 0 6px; color: var(--ink-2); }
input, select {
  font: inherit; color: var(--ink); width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
input:focus, select:focus { outline: 2px solid var(--tint); border-color: var(--primary); }
.alert { padding: 10px 14px; border-radius: 8px; margin: 14px 0; font-size: .9rem; }
.alert-danger { background: #FBEAE9; color: #8E2A23; }
.alert-warning { background: #FDF5E1; color: #7A5800; }
.alert-info { background: var(--tint); color: var(--primary-strong); }

/* ---- Connexion ---- */
.login-card { max-width: 440px; text-align: center; padding: 40px 32px; }
.login-mark { margin-bottom: 12px; object-fit: contain; }
.login-card .lead { margin: 0 0 24px; }

/* ---- Bibliothèque ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: .9rem; }
.tabs a.active { background: var(--tint); color: var(--primary-strong); }
.search input { width: 300px; max-width: 100%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.video-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.video-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge-duration { position: absolute; right: 8px; bottom: 8px; background: rgba(36, 45, 54, .85); color: #fff; font-size: .75rem; padding: 2px 7px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.badge-status { position: absolute; left: 8px; top: 8px; background: var(--surface); font-size: .75rem; font-weight: 500; padding: 3px 8px; border-radius: 4px; }
.badge-status.status-failed { background: var(--danger); color: #fff; }
.video-meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.video-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-client { color: var(--primary); font-size: .85rem; font-weight: 500; }
.video-sub { color: var(--ink-3); font-size: .82rem; margin: 0; }
.empty { text-align: center; padding: 56px 24px; }
.empty p { color: var(--ink-2); }

/* ---- Lecture ---- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.watch-public { display: block; }
.player { background: #11171d; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; display: block; background: #11171d; }
.player-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 24px; }
.player-placeholder .muted { color: #AEB8C2; max-width: 520px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--secondary); animation: spin 1s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.title-row { margin-top: 16px; }
.title-static { font-size: 1.4rem; margin: 16px 0 4px; }
.title-input { font-size: 1.35rem; font-weight: 600; border-color: transparent; padding: 4px 8px; margin-left: -8px; background: transparent; }
.title-input:hover { border-color: var(--line); }
.title-input.saved { border-color: var(--success); }
.transcript { margin-top: 20px; padding: 18px 20px; }
.transcript-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.transcript-head h2 { margin: 0; }
.transcript-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; font-size: .92rem; }
.segments { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; position: relative; }
.segment { display: flex; gap: 14px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: .92rem; line-height: 1.5; color: var(--ink); text-align: left; cursor: pointer; }
.segment:hover { background: var(--surface-2); }
.segment.active { background: var(--tint); }
.segment-time { flex: none; width: 44px; color: var(--primary); font-variant-numeric: tabular-nums; font-size: .82rem; padding-top: 2px; }
.watch-public .transcript { margin-top: 24px; }
.side-col { display: flex; flex-direction: column; gap: 16px; }
.side-card { padding: 18px; }
.side-card .field-label:first-of-type { margin-top: 0; }
.side-card h2 + .field-label { margin-top: 0; }
.folder-label { font-weight: 600; margin: 0; }
.side-card .btn-block { margin-top: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-ok { background: var(--success); }
.dot-busy { background: var(--warning); animation: pulse 1.2s infinite; }
.dot-err { background: var(--danger); }
.copy-row { display: flex; gap: 6px; }
.copy-row input { font-size: .82rem; color: var(--ink-2); background: var(--surface-2); }
#share-on .link-btn { margin-top: 8px; }
.side-col > .link-btn { align-self: flex-start; margin-left: 4px; }

/* ---- Enregistreur ---- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 520px) 1fr; gap: 32px; align-items: center; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode-box { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.mode-box strong { font-weight: 500; font-size: .9rem; }
.mode-box small { color: var(--ink-3); font-size: .78rem; }
.mode input:checked + .mode-box { border-color: var(--primary); background: var(--tint); }
.mode input:disabled + .mode-box { opacity: .4; cursor: not-allowed; }
.mode input:focus-visible + .mode-box { outline: 2px solid var(--primary); outline-offset: 2px; }
.meter { height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--primary); transition: width .08s; }
#start-btn { margin-top: 22px; }
.hint { margin: 12px 0 0; }
.cam-preview-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; }
.cam-bubble { width: 280px; height: 280px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); border: 4px solid var(--primary); background: var(--surface-3); box-shadow: var(--shadow); }
.ready-card, .recording-card { max-width: 560px; margin: 40px auto; text-align: center; padding: 36px 32px; }
.ready-actions { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.rec-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink-2); }
.rec-timer { font-size: 3.2rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: 6px 0 18px; }
.cam-large { width: 100%; max-height: 320px; border-radius: var(--radius); object-fit: cover; transform: scaleX(-1); margin-bottom: 18px; background: var(--surface-3); }
.rec-controls { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
#upload-state { margin: 16px 0 0; min-height: 1.3em; }
.countdown { position: fixed; inset: 0; z-index: 50; background: rgba(36, 45, 54, .72); display: flex; align-items: center; justify-content: center; }
.countdown span { color: #fff; font-size: 8rem; font-weight: 600; }

.finish-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.finish-grid .card .field-label:first-child { margin-top: 0; }
#finish-upload-state { margin: 10px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips:empty { display: none; }
.chip { font: inherit; font-size: .82rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.folder-selected { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--primary); background: var(--tint); border-radius: 8px; }
.folder-selected div { display: flex; flex-direction: column; min-width: 0; }
.folder-selected span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#save-btn { margin-top: 18px; }
.browse-btn { justify-content: flex-start; color: var(--ink-2); }
.browse-btn svg { color: var(--primary); }
#recent-block { margin-top: 12px; }
#recent-block .chips { margin-top: 4px; }

/* ---- Navigateur de dossiers (colonnes façon Finder) ---- */
.folder-dialog {
  width: min(1040px, calc(100vw - 32px)); height: min(600px, calc(100vh - 48px));
  padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink);
  box-shadow: 0 24px 64px rgba(36, 45, 54, .28);
}
.folder-dialog[open] { display: flex; flex-direction: column; }
.folder-dialog::backdrop { background: rgba(36, 45, 54, .45); }
.folder-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.folder-dialog-head h2 { margin: 0; }
.icon-btn { display: inline-flex; padding: 6px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.browser { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; background: var(--surface); outline: none; min-height: 0; }
.browser-col { flex: none; width: 250px; overflow-y: auto; border-right: 1px solid var(--line-2); padding: 6px; }
.browser-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: .88rem; color: var(--ink); text-align: left; cursor: pointer;
}
.browser-item svg:first-child { flex: none; color: var(--secondary); }
.browser-item svg:last-child:not(:first-child) { flex: none; margin-left: auto; color: var(--ink-3); }
.browser-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-item:hover { background: var(--surface-3); }
.browser-item.selected { background: var(--tint); color: var(--primary-strong); font-weight: 500; }
.browser:focus-visible .browser-item.selected, .browser:focus .browser-item.selected { background: var(--primary); color: #fff; }
.browser:focus .browser-item.selected svg { color: #fff; }
.browser-note { display: flex; align-items: center; gap: 8px; padding: 10px; color: var(--ink-3); font-size: .85rem; }
.browser-error { color: var(--danger); }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; margin: 0; border-color: var(--line); border-top-color: var(--primary); }
.folder-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.browser-path { font-size: .85rem; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-actions { display: flex; gap: 8px; flex: none; }
.finish-secondary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 14px; }
.finish-secondary .link-btn { white-space: nowrap; }

/* ---- Écrans étroits ---- */
@media (max-width: 860px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topnav { gap: 12px; flex-wrap: wrap; }
  .user-chip { display: none; }
  .container { padding: 20px 16px 48px; }
  .watch, .finish-grid, .setup-grid { grid-template-columns: 1fr; }
  .modes { grid-template-columns: 1fr; }
  .cam-bubble { width: 200px; height: 200px; }
  .search input { width: 100%; }
  .search { width: 100%; }
  .browser-col { width: 200px; }
  .folder-dialog-foot { flex-direction: column; align-items: stretch; }
  .browser-path { white-space: normal; }
  .browser-actions .btn { flex: 1; }
}
