/* ============================================================
   GIF Editor — Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0f;
  --surface:   #111118;
  --surface2:  #18181f;
  --surface3:  #22222d;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --accent:    #7c6dfa;
  --accent2:   #a695ff;
  --text:      #e8e6f0;
  --muted:     #7b7990;
  --danger:    #f07070;
  --success:   #5cd6a0;
  --warn:      #f0c060;
  --mono:      'Space Mono', monospace;
  --display:   'Syne', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
header h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; }
header h1 span { color: var(--accent2); }
.badge-version, a {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: auto;
}

/* ── Layout ── */
.app {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - 65px);
}

/* ── Zone centrale ── */
.main {
  padding: 28px 32px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

/* ── Drop zone ── */
#drop-zone {
  border: 2px dashed var(--border2);
  border-radius: 16px;
  padding: 60px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
  position: relative;
}
#drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,109,250,.06);
}
#drop-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-icon { font-size: 44px; margin-bottom: 14px; display: block; }
.drop-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.drop-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* Spinner interne à la drop zone */
.dz-uploading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(10,10,15,.82);
  pointer-events: none;
}
.dz-uploading.show { display: flex; }
#drop-zone.dz-loading input[type="file"] { pointer-events: none; }

/* ── Prévisualisation ── */
#preview-area { display: none; margin-top: 24px; }
.preview-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Barre de méta (poids, dimensions, durée) ── */
.meta-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.meta-chip {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 3px 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.meta-chip .chip-label { color: var(--muted); }
.meta-chip.chip-size   { border-color: rgba(124,109,250,.35); color: var(--accent2); }
.meta-chip.chip-size .chip-label { color: var(--accent); }

.preview-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}
#preview-img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 6px;
  object-fit: contain;
}
.spinner-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(10,10,15,.78);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.spinner-overlay.show { display: flex; }
.spinner-ring {
  width: 34px; height: 34px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.spinner-msg {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Historique des étapes ── */
#steps-area { margin-top: 22px; display: none; }
.steps-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.step-tag {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--accent2);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── Bouton petit ── */
.btn-sm {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-sm:hover { color: var(--text); border-color: var(--accent); }

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow-y: auto;
}
.sidebar-top { padding: 20px 18px 0; flex: 1; }
.sidebar-title {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

/* ── Tabs opérations ── */
.op-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 18px;
}
.op-tab {
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  padding: 7px 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all .15s;
  user-select: none;
}
.op-tab:hover { border-color: var(--accent); color: var(--text); }
.op-tab.active {
  background: rgba(124,109,250,.15);
  border-color: var(--accent);
  color: var(--accent2);
}
.op-emoji { font-size: 15px; display: block; margin-bottom: 3px; }

/* ── Panneaux ── */
.op-panel { display: none; flex-direction: column; gap: 13px; }
.op-panel.active { display: flex; }

/* ── Champs de formulaire ── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.field input[type="number"],
.field input[type="text"],
.field select {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 11px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input[type="color"] {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  height: 36px;
  width: 100%;
  padding: 3px 6px;
  cursor: pointer;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Range slider ── */
.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
}
.range-header { display: flex; justify-content: space-between; align-items: baseline; }
.range-val { font-family: var(--mono); font-size: 12px; color: var(--accent2); }

/* ── Timeline durée ── */
.timeline-wrap {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px;
}
.timeline-info {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.timeline-info strong { color: var(--accent2); }
.timeline-bar {
  position: relative;
  height: 6px;
  background: var(--surface3);
  border-radius: 4px;
  margin: 8px 0 16px;
  overflow: visible;
}
.timeline-selection {
  position: absolute;
  top: 0; height: 100%;
  background: var(--accent);
  border-radius: 4px;
  opacity: .7;
  pointer-events: none;
}
.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ── Bouton appliquer ── */
.btn-apply {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  margin-top: 2px;
}
.btn-apply:hover:not(:disabled) { opacity: .88; }
.btn-apply:active:not(:disabled) { transform: scale(.98); }
.btn-apply:disabled { opacity: .3; cursor: not-allowed; }

/* ── Optimisation ── */
.optim-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}
.optim-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  transition: all .2s;
}

/* ── Export ── */
.sidebar-export {
  padding: 18px;
  border-top: 1px solid var(--border);
}
.format-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.fmt-btn {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.fmt-btn.active {
  background: rgba(124,109,250,.12);
  border-color: var(--accent);
  color: var(--accent2);
}
.btn-download {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #5cd6a0, #3ab87e);
  border: none;
  border-radius: 10px;
  color: #0a1a12;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-download:hover:not(:disabled) { opacity: .88; }
.btn-download:disabled { opacity: .3; cursor: not-allowed; }

/* ── Notification toast ── */
#notif {
  position: fixed;
  top: 76px; right: 20px;
  max-width: 300px;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .22s, transform .22s;
  z-index: 999;
  pointer-events: none;
}
#notif.show { opacity: 1; transform: translateY(0); }
#notif.error   { background: rgba(240,112,112,.15); border: 1px solid rgba(240,112,112,.35); color: var(--danger); }
#notif.success { background: rgba(92,214,160,.15);  border: 1px solid rgba(92,214,160,.35);  color: var(--success); }

/* ── Verrou sidebar (avant upload) ── */
.sidebar-locked { opacity: .3; pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .main { border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar { height: auto; }
}
