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

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

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

/* ── 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); }

/* ── Files header ── */
.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;
}

/* ── Grille d'images ── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  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;
}

.image-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
}

.card-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  max-height: 260px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background:
    conic-gradient(var(--panel-2) 90deg, var(--bg) 90deg 180deg,
                   var(--panel-2) 180deg 270deg, var(--bg) 270deg)
    0 0 / 20px 20px;
}

.card-stage img {
  max-width: 100%;
  max-height: 244px;
  object-fit: contain;
  display: block;
}

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

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

@media (hover: none) { .remove-btn { display: flex; } }

.saved-badge {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 100px;
}

.card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sizes {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.card-sizes .from { color: var(--muted); text-decoration: line-through; }
.card-sizes .arrow { color: var(--muted); }
.card-sizes .to { color: var(--brand-strong); font-weight: 700; }

.card-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.card-download:hover { border-color: var(--accent); background: var(--surface2); }
.card-download svg { width: 15px; height: 15px; }

/* ── Contrôles sidebar ── */
.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;
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  min-width: 0;
}

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

input[type="range"]::-moz-range-thumb {
  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: 58px;
  text-align: right;
  font-weight: 700;
}

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

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

.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); }

/* ── Stats ── */
.stats { display: flex; flex-direction: column; gap: 10px; }

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.stat-label { font-size: 0.8rem; color: var(--muted); }

.stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
}

.stat-saved { color: var(--brand-strong); font-weight: 700; }

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

/* ── Boutons ── */
.btn-accent {
  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;
}

.btn-accent:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.btn-accent:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-ghost {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-ghost:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.btn-ghost:disabled { opacity: 0.3; cursor: not-allowed; }

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