/* Foxalia Radio CMS — administration */
:root {
  --ad-ink: #15161b;
  --ad-ink-2: #2b2d35;
  --ad-muted: #6b6e78;
  --ad-faint: #9a9ca5;
  --ad-line: #e6e4df;
  --ad-line-2: #d9d6cf;
  --ad-bg: #f6f5f2;
  --ad-panel: #ffffff;
  --ad-side: #111216;
  --ad-side-ink: #c9cad0;
  --ad-accent: #ff5b2e;
  --ad-accent-soft: #fff0ea;
  --ad-blue: #2f5bff;
  --ad-green: #1c8a4c;
  --ad-green-soft: #e6f5ec;
  --ad-red: #c62828;
  --ad-red-soft: #fdeceb;
  --ad-amber: #a86400;
  --ad-amber-soft: #fff4dc;
  --ad-radius: 12px;
  --ad-shadow: 0 1px 2px rgba(20,20,30,.05), 0 8px 24px rgba(20,20,30,.06);
  --ad-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ad-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--ad-font); color: var(--ad-ink); background: var(--ad-bg); -webkit-font-smoothing: antialiased; }
a { color: var(--ad-blue); }
h1, h2, h3, h4, p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.ad-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ad-muted { color: var(--ad-muted); }
.ad-mono { font-family: var(--ad-mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--ad-accent); outline-offset: 2px; }

/* Marque */
.ad-logo-mark { width: 28px; height: 28px; border-radius: 9px; flex: none; position: relative;
  background: conic-gradient(from 200deg, var(--ad-accent), #ffb347, var(--ad-accent)); }
.ad-logo-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2.5px solid #111216; }

/* Structure */
.ad-body { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.ad-side { background: var(--ad-side); color: var(--ad-side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ad-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff; text-decoration: none; font-size: 14px; letter-spacing: -.01em; }
.ad-brand strong { font-weight: 700; }
.ad-radio-switch { margin: 4px 14px 10px; padding: 12px; border-radius: 12px; background: #1b1c22; display: grid; gap: 8px; }
.ad-radio-switch select { width: 100%; background: #24252c; border: 1px solid #33343c; color: #fff; border-radius: 8px; padding: 7px 10px; font-weight: 600; }
.ad-radio-name { color: #fff; font-weight: 600; }
.ad-radio-visit { color: #ff9b7a; font-size: 12.5px; text-decoration: none; }
.ad-radio-visit:hover { color: #fff; }
.ad-nav { padding: 4px 10px 16px; flex: 1; }
.ad-nav-label { padding: 14px 12px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #6e7079; }
.ad-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.ad-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--ad-side-ink); text-decoration: none; font-size: 13.5px; }
.ad-nav a:hover { background: #1c1d23; color: #fff; }
.ad-nav a[aria-current="page"] { background: #23242b; color: #fff; box-shadow: inset 2px 0 0 var(--ad-accent); }
.ad-nav a svg { opacity: .75; flex: none; }
.ad-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid #22232a; }
.ad-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #2a2b33; color: #fff; font-weight: 700; flex: none; }
.ad-user-meta { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.ad-user-meta strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-user-meta span { font-size: 11.5px; color: #7d7f88; }
.ad-user .ad-icon-btn { color: var(--ad-side-ink); }

.ad-main { min-width: 0; display: flex; flex-direction: column; }
.ad-top { display: flex; align-items: center; gap: 16px; padding: 22px 36px 18px; }
.ad-top-title { flex: 1; min-width: 0; }
.ad-top h1 { font-size: 24px; letter-spacing: -.02em; font-weight: 700; }
.ad-crumb { font-size: 12.5px; color: var(--ad-muted); margin-bottom: 2px; }
.ad-crumb a { color: inherit; text-decoration: none; }
.ad-crumb a:hover { color: var(--ad-ink); }
.ad-top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ad-content { padding: 0 36px 56px; }
.ad-menu-toggle { display: none; }

/* Boutons */
.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--ad-line-2);
  background: var(--ad-panel); color: var(--ad-ink); font-weight: 600; font-size: 13px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.ad-btn:hover { border-color: #bdb9b0; background: #fbfaf8; }
.ad-btn:active { transform: translateY(1px); }
.ad-btn-primary { background: var(--ad-ink); border-color: var(--ad-ink); color: #fff; }
.ad-btn-primary:hover { background: #2a2b33; border-color: #2a2b33; }
.ad-btn-accent { background: var(--ad-accent); border-color: var(--ad-accent); color: #fff; }
.ad-btn-accent:hover { background: #f04a1c; border-color: #f04a1c; }
.ad-btn-danger { color: var(--ad-red); }
.ad-btn-danger:hover { background: var(--ad-red-soft); border-color: #f1b8b4; }
.ad-btn-ghost { border-color: transparent; background: transparent; }
.ad-btn-ghost:hover { background: rgba(0,0,0,.04); border-color: transparent; }
.ad-btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.ad-btn-block { width: 100%; padding: 11px 16px; }
.ad-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ad-icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--ad-muted); }
.ad-icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ad-ink); }
.ad-inline-form { display: inline; }

/* Alertes */
.ad-alert { margin: 0 36px 16px; padding: 11px 14px; border-radius: 10px; font-weight: 500; border: 1px solid transparent; }
.ad-alert-success { background: var(--ad-green-soft); color: #145c34; border-color: #cbe9d6; }
.ad-alert-error { background: var(--ad-red-soft); color: #8d1f1f; border-color: #f3c9c6; }
.ad-alert-info { background: #eef2ff; color: #2a3f9a; border-color: #d8e0ff; }
.ad-alert-warning { background: var(--ad-amber-soft); color: #7a4a00; border-color: #f4dfaa; }
.ad-login .ad-alert, .ad-panel .ad-alert { margin: 0 0 16px; }

/* Panneaux, grilles */
.ad-panel { background: var(--ad-panel); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); padding: 22px 24px; }
.ad-panel + .ad-panel { margin-top: 18px; }
.ad-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ad-panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ad-panel-head p { color: var(--ad-muted); font-size: 13px; margin-top: 2px; }
.ad-grid { display: grid; gap: 18px; }
.ad-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ad-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* Statistiques du tableau de bord */
.ad-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--ad-line); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); overflow: hidden; margin-bottom: 18px; }
.ad-stat { background: var(--ad-panel); padding: 18px 20px; display: grid; gap: 4px; text-decoration: none; color: inherit; }
.ad-stat:hover { background: #fcfbf9; }
.ad-stat span { font-size: 12.5px; color: var(--ad-muted); }
.ad-stat strong { font-size: 26px; letter-spacing: -.02em; font-weight: 700; }
.ad-stat em { font-style: normal; font-size: 12px; color: var(--ad-amber); }
.ad-hero { display: flex; align-items: center; gap: 22px; padding: 22px 24px; border-radius: var(--ad-radius); background: var(--ad-ink); color: #fff; margin-bottom: 18px; position: relative; overflow: hidden; }
.ad-hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(255,91,46,.45), transparent 65%); }
.ad-hero img { height: 44px; width: auto; background: #fff; border-radius: 10px; padding: 6px 10px; }
.ad-hero h2 { font-size: 20px; letter-spacing: -.02em; }
.ad-hero p { color: #b5b7bf; }
.ad-hero .ad-btn { position: relative; z-index: 1; margin-left: auto; }

/* Tableaux */
.ad-table-wrap { background: var(--ad-panel); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; }
.ad-table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ad-faint); padding: 12px 16px; border-bottom: 1px solid var(--ad-line); white-space: nowrap; }
.ad-table td { padding: 12px 16px; border-bottom: 1px solid #f0eee9; vertical-align: middle; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table tbody tr:hover { background: #fcfbf9; }
.ad-table .ad-actions { text-align: right; white-space: nowrap; }
.ad-table .ad-actions > * { margin-left: 4px; }
.ad-table a.ad-row-title { color: var(--ad-ink); font-weight: 600; text-decoration: none; }
.ad-table a.ad-row-title:hover { color: var(--ad-blue); }
.ad-thumb { width: 52px; height: 36px; border-radius: 6px; object-fit: cover; background: #eee; }
.ad-empty { padding: 48px 24px; text-align: center; color: var(--ad-muted); }
.ad-empty strong { display: block; color: var(--ad-ink); font-size: 15px; margin-bottom: 4px; }

/* Badges */
.ad-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #efeee9; color: var(--ad-ink-2); white-space: nowrap; }
.ad-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.ad-badge-green { background: var(--ad-green-soft); color: var(--ad-green); }
.ad-badge-amber { background: var(--ad-amber-soft); color: var(--ad-amber); }
.ad-badge-red { background: var(--ad-red-soft); color: var(--ad-red); }
.ad-badge-blue { background: #eaf0ff; color: #2747c8; }
.ad-badge-plain::before { display: none; }
.ad-badge-demo { background: #f3e8ff; color: #7a36c4; }
.ad-badge-demo::before { display: none; }

/* Formulaires */
.ad-form { display: grid; gap: 16px; }
.ad-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ad-field { display: grid; gap: 6px; }
.ad-field > span, .ad-label { font-size: 12.5px; font-weight: 600; color: var(--ad-ink-2); }
.ad-field small, .ad-help { font-size: 12px; color: var(--ad-muted); }
.ad-field input[type=text], .ad-field input[type=email], .ad-field input[type=password], .ad-field input[type=url], .ad-field input[type=number],
.ad-field input[type=datetime-local], .ad-field input[type=time], .ad-field input[type=search], .ad-field select, .ad-field textarea, .ad-input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--ad-line-2); border-radius: 9px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.ad-field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.ad-field textarea.ad-tall { min-height: 260px; }
.ad-field input:focus, .ad-field select:focus, .ad-field textarea:focus, .ad-input:focus { outline: none; border-color: var(--ad-ink); box-shadow: 0 0 0 3px rgba(21,22,27,.08); }
.ad-field.has-error input, .ad-field.has-error textarea, .ad-field.has-error select { border-color: var(--ad-red); }
.ad-field .ad-error { color: var(--ad-red); font-size: 12px; font-weight: 500; }
.ad-check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.ad-check input { width: 16px; height: 16px; accent-color: var(--ad-ink); }
.ad-form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.ad-form-actions .ad-spacer { flex: 1; }
.ad-fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
.ad-fieldset legend { font-size: 13px; font-weight: 700; margin-bottom: 10px; padding: 0; }
.ad-image-field { display: flex; gap: 10px; align-items: center; }
.ad-image-field img { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--ad-line); background: #f1f0ec; }
.ad-image-field input { flex: 1; }

/* Onglets */
.ad-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--ad-line); margin-bottom: 18px; overflow-x: auto; }
.ad-tabs a, .ad-tabs button { padding: 10px 14px; border: 0; background: none; color: var(--ad-muted); font-weight: 600; text-decoration: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ad-tabs a:hover, .ad-tabs button:hover { color: var(--ad-ink); }
.ad-tabs [aria-current="page"], .ad-tabs [aria-selected="true"] { color: var(--ad-ink); border-bottom-color: var(--ad-accent); }

/* Catalogue */
.ad-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.ad-tpl-card { background: var(--ad-panel); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; }
.ad-tpl-card:hover { box-shadow: var(--ad-shadow); transform: translateY(-2px); }
.ad-tpl-thumb { position: relative; height: 190px; overflow: hidden; background: #ece9e2; border-bottom: 1px solid var(--ad-line); }
.ad-tpl-thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 760px; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; }
.ad-tpl-thumb.is-wide iframe { transform: scale(var(--thumb-scale, .25)); }
.ad-tpl-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; }
.ad-tpl-body h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ad-tpl-body p { font-size: 12.5px; color: var(--ad-muted); }
.ad-tpl-id { font-family: var(--ad-mono); font-size: 11px; color: var(--ad-faint); text-transform: uppercase; letter-spacing: .06em; }
.ad-tpl-foot { display: flex; gap: 6px; align-items: center; padding: 0 16px 16px; flex-wrap: wrap; }
.ad-family-head { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 14px; }
.ad-family-head:first-child { margin-top: 0; }
.ad-family-head h2 { font-size: 17px; letter-spacing: -.01em; }
.ad-family-head span { color: var(--ad-muted); font-size: 13px; }

/* Médiathèque */
.ad-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.ad-media-item { background: var(--ad-panel); border: 1px solid var(--ad-line); border-radius: 10px; overflow: hidden; display: grid; }
.ad-media-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #f1efea; }
.ad-media-meta { padding: 8px 10px; font-size: 11.5px; color: var(--ad-muted); display: grid; gap: 2px; }
.ad-media-meta strong { color: var(--ad-ink); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-media-actions { display: flex; gap: 4px; padding: 0 8px 8px; }
.ad-dropzone { border: 2px dashed var(--ad-line-2); border-radius: var(--ad-radius); padding: 22px; text-align: center; color: var(--ad-muted); background: #fbfaf7; }
.ad-dropzone.is-over { border-color: var(--ad-accent); background: var(--ad-accent-soft); }

/* Modale */
.ad-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(15,16,20,.5); display: grid; place-items: center; padding: 24px; }
.ad-modal[hidden] { display: none; }
.ad-modal-box { background: #fff; border-radius: 16px; width: min(920px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.ad-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ad-line); }
.ad-modal-head h2 { font-size: 16px; }
.ad-modal-body { padding: 18px 20px; overflow-y: auto; }
.ad-modal-foot { padding: 14px 20px; border-top: 1px solid var(--ad-line); display: flex; justify-content: flex-end; gap: 8px; }
.ad-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ad-pick-grid button { border: 2px solid transparent; border-radius: 10px; padding: 0; background: #f1efea; cursor: pointer; overflow: hidden; }
.ad-pick-grid button:hover { border-color: var(--ad-accent); }
.ad-pick-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }

/* Listes triables (menus) */
.ad-sortable { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ad-sortable li { background: #fff; border: 1px solid var(--ad-line); border-radius: 10px; }
.ad-sortable li.is-dragging { opacity: .4; }
.ad-menu-row { display: grid; grid-template-columns: 22px 1.2fr 1.4fr 110px auto; gap: 10px; align-items: center; padding: 8px 10px; }
.ad-menu-row.is-child { margin-left: 34px; }
.ad-handle { cursor: grab; color: var(--ad-faint); display: grid; place-items: center; }
.ad-handle:active { cursor: grabbing; }

/* Connexion */
.ad-login { display: grid; grid-template-columns: minmax(0, 520px) 1fr; min-height: 100vh; background: #fff; }
.ad-login-card { padding: 64px clamp(28px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.ad-login-card h1 { font-size: 30px; letter-spacing: -.03em; margin-top: 40px; }
.ad-login-card .ad-form { margin-top: 18px; }
.ad-login-brand { display: flex; align-items: center; gap: 12px; }
.ad-login-brand div { display: grid; line-height: 1.15; }
.ad-login-brand strong { font-size: 16px; }
.ad-login-brand span { font-size: 12.5px; color: var(--ad-muted); }
.ad-login .ad-logo-mark::after { border-color: #fff; }
.ad-login-side { background: #111216; color: #c9cad0; display: flex; align-items: flex-end; padding: 56px; position: relative; overflow: hidden; }
.ad-login-side p { position: relative; max-width: 420px; font-size: 20px; line-height: 1.45; color: #fff; letter-spacing: -.01em; }
.ad-login-wave { position: absolute; inset: 0;
  background:
    radial-gradient(circle at 75% 25%, rgba(255,91,46,.55), transparent 40%),
    radial-gradient(circle at 25% 65%, rgba(47,91,255,.45), transparent 42%),
    repeating-radial-gradient(circle at 75% 25%, transparent 0 22px, rgba(255,255,255,.05) 22px 23px); }

/* Responsive */
@media (max-width: 1100px) {
  .ad-grid-main { grid-template-columns: 1fr; }
  .ad-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .ad-body { grid-template-columns: 1fr; }
  .ad-side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 900; transform: translateX(-100%); transition: transform .2s; }
  .ad-side-open .ad-side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .ad-menu-toggle { display: inline-grid; }
  .ad-top { padding: 16px 18px; flex-wrap: wrap; }
  .ad-content { padding: 0 18px 40px; }
  .ad-alert { margin: 0 18px 14px; }
  .ad-grid-2, .ad-grid-3, .ad-form-row { grid-template-columns: 1fr; }
  .ad-login { grid-template-columns: 1fr; }
  .ad-login-side { display: none; }
  .ad-menu-row { grid-template-columns: 22px 1fr auto; }
  .ad-menu-row > :nth-child(3), .ad-menu-row > :nth-child(4) { grid-column: 2 / -1; }
}

/* Notifications éphémères */
.ad-toast { position: fixed; right: 20px; bottom: 20px; z-index: 2000; padding: 11px 16px; border-radius: 10px; background: var(--ad-ink); color: #fff; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); transition: opacity .4s, transform .4s; }
.ad-toast-error { background: var(--ad-red); }
.ad-toast.is-out { opacity: 0; transform: translateY(8px); }
