/* ══════════════════════════════════════════════════════════════════════════════
   GIF Maker — CSS spécifique à l'outil.
   Le chrome commun (tokens :root, header, boutons, hero, FAQ, footer, toast…)
   vient de ../shared/innospira-ui.css, lié AVANT ce fichier. Ne pas le redéfinir.
   ══════════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; }

.toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Footer : compléments propres à l'outil (icône + flèche) ── */
.footer-link { display: flex; align-items: center; gap: 6px; }
.footer-link svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }
.footer-link--arrow::after { content: '↗'; font-size: 0.7rem; margin-left: 6px; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 20px auto 40px;
  padding: 0 24px;
  align-items: start;
  flex: 1;
}

/* ── Panel ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── Dropzone ── */
#dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 20px;
}

#dropzone:hover, #dropzone.drag-over {
  border-color: var(--brand);
  background: var(--brand-wash);
}

#dropzone .drop-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

#dropzone p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

#dropzone strong { color: var(--brand-strong); }

/* ── Frame Count Bar ── */
.frames-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ── Grid frames ── */
#framesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  min-height: 100px;
}

#emptyState {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: var(--muted);
  font-size: 0.82rem;
}

.frame-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: grab;
  transition: border-color 0.2s, transform 0.15s;
  aspect-ratio: 1;
  background: var(--surface2);
}

.frame-card:hover       { border-color: var(--spark); }
.frame-card.dragging    { opacity: 0.4; transform: scale(0.95); }
.frame-card.drag-target { border-color: var(--accent); }

.frame-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.frame-number {
  position: absolute;
  top: 5px; left: 5px;
  background: rgba(0,0,0,0.7);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}

.remove-btn {
  position: absolute;
  top: 5px; right: 5px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 20px; height: 20px;
  font-size: 0.6rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.frame-card:hover .remove-btn,
.frame-card:focus-within .remove-btn { display: flex; }

/* Sans souris (tactile) : pas de survol, le bouton doit rester visible et atteignable */
@media (hover: none) {
  .remove-btn { display: flex; width: 28px; height: 28px; font-size: 0.75rem; }
}

/* ── Sidebar Controls ── */
.control-group { margin-bottom: 18px; }

.control-group label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  flex: 1;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  min-width: 0;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.range-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--brand-strong);
  white-space: nowrap;
  min-width: 52px;
  text-align: right;
  font-weight: 700;
}

select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus { border-color: var(--accent2); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label { font-size: 0.88rem; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--spark); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Generate Button ── */
#generateBtn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: var(--brand-ink);
  border: none;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

#generateBtn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
#generateBtn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Progress ── */
#progressSection {
  margin-top: 20px;
  display: none;
}

.progress-track {
  background: var(--border);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

#progressBar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-2), var(--accent));
  border-radius: 100px;
  transition: width 0.3s;
  width: 0%;
}

#progressText {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

/* ── Result ── */
.main-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

#resultSection { display: none; }

.result-panel {
  border-color: oklch(0.7 0.12 60 / .5);
  box-shadow: 0 0 0 1px var(--brand-wash), var(--shadow-lg);
  animation: result-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--brand-strong);
  background: var(--brand-wash);
  border: 1px solid oklch(0.7 0.12 60 / .35);
  padding: 3px 10px;
  border-radius: 100px;
}

.result-stage {
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    conic-gradient(var(--surface2) 90deg, var(--bg) 90deg 180deg,
                   var(--surface2) 180deg 270deg, var(--bg) 270deg)
    0 0 / 22px 22px;
}

#resultImg {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  display: block;
  box-shadow: var(--shadow-lg);
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.file-size-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.78rem;
}

.file-size-label { color: var(--muted); }

.file-size-value {
  font-family: var(--font-mono);
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 0.9rem;
}

#downloadBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--brand-ink);
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: opacity 0.2s, transform 0.1s;
}

#downloadBtn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── Responsive ── */
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }

  .result-footer { flex-direction: column; align-items: stretch; }
  #downloadBtn   { justify-content: center; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .result-panel { animation: none; }
}
