/* ════════════════════════════════════════════════════════════════════════
   Spotlite Smartlink — Studio (builder). Chrome sobre + éditeur WYSIWYG direct.
   Le canvas (#st-canvas.sl-scope) est stylé par smartlink.css ; ici on ne gère
   QUE l'habillage éditeur (.st-*), les poignées, zones « + » et le drag & drop.
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #0b0b0d;
  --panel: #141417;
  --panel-2: #1c1c21;
  --border: #2a2a31;
  --text: #f4f4f6;
  --muted: #9a9aa5;
  --accent: #1da1f2;
  --danger: #ff5a5f;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }

.st-brand { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.st-brand b { font-weight: 800; }
.st-brand span { color: var(--muted); font-weight: 500; margin-left: 4px; }
.st-brand.big { font-size: 24px; }

/* ── Barre du haut ───────────────────────────────────────────────────────── */
.st-top {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.st-top-right { display: flex; align-items: center; gap: 10px; }
.st-url { color: var(--accent); font-size: 13px; text-decoration: none; font-weight: 600; }
.st-saved { color: var(--muted); font-size: 12px; min-width: 54px; }

.st-btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: filter .15s ease, background .15s ease;
}
.st-btn:hover { filter: brightness(1.15); }
.st-btn:disabled { opacity: .5; cursor: not-allowed; }
.st-btn.block { width: 100%; }
.st-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-ghost { background: transparent; }
.st-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.st-google { background: #fff; color: #1f1f1f; border: none; display: inline-flex; align-items: center; gap: 10px; justify-content: center; width: 100%; padding: 12px; }
.st-avatar-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; }

/* ── Auth gate (inchangé) ────────────────────────────────────────────────── */
.st-gate { position: fixed; inset: 58px 0 0; display: grid; place-items: center; padding: 20px; background: var(--bg); z-index: 5; }
.st-gate-card { width: 100%; max-width: 380px; text-align: center; }
.st-gate-lead { color: var(--muted); margin: 12px 0 22px; }
.st-or { position: relative; margin: 18px 0; color: var(--muted); font-size: 13px; }
.st-or::before, .st-or::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.st-or::before { left: 0; } .st-or::after { right: 0; }
#st-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
#st-form input { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 15px; }
.st-err { color: var(--danger); font-size: 13px; margin: 4px 0 0; }
.st-authtabs { margin-bottom: 16px; }
.st-linkbtn { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; padding: 4px; }
.st-linkbtn:hover { color: var(--text); }
.st-qr-open { margin-top: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.st-fineprint { color: var(--muted); font-size: 12px; text-align: center; margin-top: 16px; }
.st-qr-panel { text-align: center; padding: 6px 0 2px; }
.st-qr-title { font-size: 17px; margin: 12px 0 6px; }
.st-qr-sub { color: var(--muted); font-size: 13px; margin: 0 auto 16px; max-width: 34ch; }
.st-qr-img { width: 216px; height: 216px; margin: 0 auto 12px; background: #fff; border-radius: 14px; display: grid; place-items: center; padding: 8px; }
.st-qr-img img { border-radius: 6px; }
.st-qr-codelbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.st-qr-code { font-size: 34px; font-weight: 800; letter-spacing: .08em; margin: 2px 0 10px; }
.st-qr-status { color: var(--muted); font-size: 13px; min-height: 18px; }

/* ── Création (slug) ─────────────────────────────────────────────────────── */
.st-onboard { max-width: 620px; margin: 0 auto; padding: 72px 20px; text-align: center; }
.st-onboard h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.02em; }
.st-onboard-sub { color: var(--muted); margin: 0 0 30px; }
.st-slug-row { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.st-slug-row label { color: var(--muted); }
.st-slug-row input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.st-slug-state { font-size: 13px; min-width: 90px; text-align: left; }
.st-slug-state.ok { color: #35c46a; }
.st-slug-state.no { color: var(--danger); }

/* ── Éditeur : canvas (gauche) + inspecteur (droite) ─────────────────────── */
.st-editor { display: grid; grid-template-columns: 1fr 360px; height: calc(100vh - 58px); }
.st-canvas-scroll { overflow: auto; background: radial-gradient(circle at 50% 0%, #17171c, #0b0b0d); padding: 18px 18px 80px; }
.st-canvas-hint { color: var(--muted); font-size: 12.5px; text-align: center; margin: 2px 0 14px; }
.st-canvas-hint b { color: var(--text); }
.st-device { display: inline-flex; gap: 4px; margin-left: 10px; vertical-align: middle; background: var(--panel); border-radius: 8px; padding: 3px; }
.st-device button { border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.st-device button.active { background: var(--panel-2); color: var(--text); }

.st-canvas-frame {
  max-width: 900px; margin: 0 auto; border-radius: 24px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0,0,0,.5);
  transition: max-width .28s cubic-bezier(.2,.7,.3,1);
}
.st-canvas-frame.mobile { max-width: 400px; }
#st-canvas { position: relative; overflow: hidden; min-height: 70vh; }
#st-canvas .sl-bg-image { position: absolute; }
/* Empêche le drag natif des images de court-circuiter le drag du slot. */
#st-canvas img { -webkit-user-drag: none; user-drag: none; }

/* Slots éditables : poignée + actions au survol / à la sélection. */
.sl-slot { border-radius: 14px; transition: box-shadow .15s ease; }
.sl-slot:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.sl-slot.selected { box-shadow: 0 0 0 2px var(--accent); }
.sl-slot.dragging { opacity: .35; }
.sl-slot.drop-before { box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 99px transparent; outline: 2px dashed var(--accent); outline-offset: 2px; }
.sl-slot.drop-after { outline: 2px dashed var(--accent); outline-offset: 2px; }

.st-slotbar {
  position: absolute; top: 6px; right: 6px; z-index: 5; display: none; align-items: center; gap: 4px;
  background: rgba(12,12,16,.82); border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  padding: 3px 4px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sl-slot:hover .st-slotbar, .sl-slot.selected .st-slotbar { display: flex; }
.st-drag { cursor: grab; color: #fff; font-size: 14px; padding: 2px 5px; opacity: .85; }
.st-slot-actions { display: inline-flex; gap: 2px; }
.st-slot-actions button { width: 26px; height: 26px; border: none; background: transparent; color: #fff; cursor: pointer; border-radius: 7px; font-size: 13px; }
.st-slot-actions button:hover { background: rgba(255,255,255,.16); }

/* Zones d'insertion « + » en pointillés. */
.st-ins {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 34px; margin: 6px 0; padding: 6px;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 12px;
  background: transparent; color: color-mix(in srgb, var(--muted) 80%, transparent);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  opacity: .5; transition: opacity .15s ease, border-color .15s ease, background .15s ease;
}
.st-ins:hover { opacity: 1; border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.st-ins span { font-size: 17px; line-height: 1; }
.st-ins-end { min-height: 46px; opacity: .8; }

/* Popover d'ajout. */
.st-addmenu {
  position: fixed; z-index: 50; width: 220px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 16px); overflow-y: auto;
}
.st-addmenu button { text-align: left; border: none; background: transparent; color: var(--text); padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; font-family: inherit; }
.st-addmenu button:hover { background: var(--panel-2); }

/* ── Inspecteur ──────────────────────────────────────────────────────────── */
.st-inspector { border-left: 1px solid var(--border); background: var(--panel); overflow-y: auto; padding: 16px; }
.st-itabs { display: flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.st-itab { flex: 1; padding: 8px; border: none; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13px; }
.st-itab.active { background: var(--panel-2); color: var(--text); }

.st-field { margin-bottom: 16px; }
.st-field > label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.st-field input[type="color"] { width: 100%; height: 42px; padding: 4px; cursor: pointer; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); }
.st-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.st-readonly { padding: 10px 13px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.st-hint { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }

.st-mfield { margin-bottom: 12px; }
.st-mfield label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.st-mfield input, .st-mfield select, .st-mfield textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px; font-family: inherit; resize: vertical;
}
/* Palette de nuances de bloc */
.st-tints { display: flex; gap: 6px; flex-wrap: wrap; }
.st-tint { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.st-tint.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.st-tint-none { background: var(--panel-2); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; }

/* Badge de type dans le sélecteur de contenu Spotlite */
.st-vid-badge { position: absolute; top: 6px; left: 6px; z-index: 2; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }

.st-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.st-preset { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; }
.st-preset.active { border-color: #fff; }
.st-seg { display: flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; }
.st-seg button { flex: 1; padding: 8px; border: none; background: transparent; color: var(--muted); border-radius: 7px; cursor: pointer; font-family: inherit; font-weight: 600; }
.st-seg button.active { background: var(--panel-2); color: var(--text); }

/* Unsplash */
.st-uns-search { display: flex; gap: 6px; }
.st-uns-search input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; }
.st-uns-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.st-uns-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.st-uns-grid img:hover { border-color: var(--accent); }

/* ── Modales ─────────────────────────────────────────────────────────────── */
.st-modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 40; padding: 20px; }
.st-modal[hidden] { display: none; }
.st-modal-card { width: 100%; max-width: 720px; max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.st-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.st-modal-head h3 { margin: 0; }
.st-modal-close { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--panel-2); color: var(--text); font-size: 20px; cursor: pointer; }
.st-modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.st-video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.st-vid { position: relative; aspect-ratio: 9/16; border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--panel-2); border: 2px solid transparent; }
.st-vid:hover { border-color: var(--accent); }
.st-vid img { width: 100%; height: 100%; object-fit: cover; }
.st-vid span { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px; font-size: 12px; background: linear-gradient(transparent, rgba(0,0,0,.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-video-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.st-video-empty a { color: var(--accent); }

.st-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: 0 8px 30px rgba(0,0,0,.3); opacity: 0; transition: opacity .2s ease; }
.st-toast.show { opacity: 1; }

/* ── Responsive : inspecteur en drawer bas ───────────────────────────────── */
@media (max-width: 880px) {
  .st-editor { grid-template-columns: 1fr; height: auto; }
  .st-inspector { border-left: none; border-top: 1px solid var(--border); max-height: 60vh; }
  .st-canvas-frame, .st-canvas-frame.mobile { max-width: 480px; }
}
