/* ═══════════════════════════════════════════════════════════════
   Kiwi Studio — Formulaire Débadge
   ═══════════════════════════════════════════════════════════════ */
:root {
  --bg:           #0e0f13;
  --surface:      #16181e;
  --surface2:     #1e2028;
  --border:       #2a2d38;
  --accent:       #5865f2;
  --accent-hover: #6d78f5;
  --accent-light: rgba(88,101,242,.15);
  --green:        #2ecc71;
  --green-light:  rgba(46,204,113,.15);
  --orange:       #e67e22;
  --orange-light: rgba(230,126,34,.15);
  --red:          #e74c3c;
  --red-light:    rgba(231,76,60,.15);
  --text:         #e2e4ed;
  --text-muted:   #888da0;
  --radius:       12px;
  --shadow:       0 8px 32px rgba(0,0,0,.45);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.header-logo img {
  height: 32px;
  width: auto;
  border-radius: 4px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--text-muted);
}

.header-user img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.header-user .username {
  color: var(--text);
  font-weight: 600;
}

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px 16px;
}

.steps {
  display: flex;
  align-items: flex-start;
  max-width: 720px;
  margin: 0 auto;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  gap: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Ligne de connexion entre les cercles */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left:   calc(50% + 16px);
  right:  calc(-50% + 16px);
  top:    14px;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step.active:not(:last-child)::after,
.step.done:not(:last-child)::after {
  background: var(--accent);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  background: var(--surface2);
  border: 2px solid var(--border);
  z-index: 1;
  flex-shrink: 0;
  position: relative;
}

.step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step.done .step-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.step.done .step-num::before { content: "✓"; }
.step.done .step-num span    { display: none; }

.step-label {
  display: block;
  line-height: 1.2;
  padding: 0 2px;
}

/* ── Main layout ─────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 720px;
  overflow: hidden;
}

.card-head {
  padding: 28px 32px 0;
}

.card-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-head p {
  color: var(--text-muted);
  font-size: .93rem;
  line-height: 1.5;
}

.card-body {
  padding: 24px 32px;
}

.card-foot {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ── Conditions ──────────────────────────────────────────────── */
.conditions-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  max-height: 320px;
  overflow-y: auto;
  font-size: .88rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.conditions-box h3 {
  color: var(--text);
  margin-bottom: 8px;
  font-size: 1rem;
}

.conditions-box ul {
  padding-left: 18px;
  margin-bottom: 14px;
}

.conditions-box li { margin-bottom: 4px; }

/* ── Options ─────────────────────────────────────────────────── */
.option-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 14px;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}

.option-card:hover { border-color: var(--accent); }

.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-card.locked {
  cursor: default;
  opacity: .85;
}

/* ── Priority option cards ─────────────────────────────────── */
.option-card.priority-card {
  border-color: rgba(243,156,18,.45);
  background: rgba(243,156,18,.06);
}
.option-card.priority-card:hover { border-color: #f39c12; }
.option-card.priority-card.selected {
  border-color: #f39c12;
  background: rgba(243,156,18,.18);
}
.option-card.priority-card .option-price {
  color: #f39c12;
  border-color: rgba(243,156,18,.4);
  background: rgba(243,156,18,.12);
}
.option-card.priority-card .option-title { color: #f5c842; }

.option-card.express-card {
  border-color: rgba(26,188,156,.45);
  background: rgba(26,188,156,.06);
}
.option-card.express-card:hover { border-color: #1abc9c; }
.option-card.express-card.selected {
  border-color: #1abc9c;
  background: rgba(26,188,156,.18);
}
.option-card.express-card .option-price {
  color: #1abc9c;
  border-color: rgba(26,188,156,.4);
  background: rgba(26,188,156,.12);
}
.option-card.express-card .option-title { color: #48d1b5; }

.option-desc {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  pointer-events: none;
}

.option-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-check {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.option-title {
  font-weight: 600;
  font-size: .95rem;
  flex: 1;
}

.option-price {
  font-size: .83rem;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}

.option-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: none;
}

.option-body.visible { display: block; }

.option-body label  {
  display: block;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.option-body textarea,
.option-body input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: .88rem;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}

.option-body textarea:focus,
.option-body input:focus {
  border-color: var(--accent);
}

.option-info-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: .75rem;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.option-info-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Images upload dans option plaque */
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  margin-top: 10px;
  cursor: pointer;
  transition: border-color .15s;
  font-size: .83rem;
  color: var(--text-muted);
}
.img-upload-area:hover { border-color: var(--accent); }
.img-previews {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.img-previews img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Upload / Analyse ────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .9rem;
  color: var(--text-muted);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone .icon { font-size: 2.5rem; margin-bottom: 12px; }

.drop-zone .hint {
  font-size: .8rem;
  margin-top: 8px;
  opacity: .7;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 14px;
  font-size: .9rem;
}

.file-info .file-icon { font-size: 1.4rem; }

.file-name { font-weight: 600; }
.file-size { color: var(--text-muted); font-size: .82rem; }

.analysis-log {
  background: #0a0b0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: .8rem;
  color: #a8b2d8;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.6;
}

.analysis-log .log-line { display: block; }
.analysis-log .log-ok    { color: var(--green); }
.analysis-log .log-warn  { color: var(--orange); }
.analysis-log .log-err   { color: var(--red); }

.verdict-box {
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.verdict-box.clean  { background: var(--green-light);  border: 1px solid var(--green); }
.verdict-box.locked { background: var(--red-light);    border: 1px solid var(--red); }
.verdict-box.warn   { background: var(--orange-light); border: 1px solid var(--orange); }

.verdict-icon { font-size: 1.8rem; flex-shrink: 0; }
.verdict-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.verdict-desc  { font-size: .86rem; color: var(--text-muted); line-height: 1.5; }

.missing-files {
  margin-top: 10px;
  font-size: .83rem;
  color: var(--red);
}

/* ── Récapitulatif ────────────────────────────────────────────── */
.recap-section {
  margin-bottom: 22px;
}

.recap-section h3 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
}

.recap-row:last-child { border-bottom: none; }
.recap-label { color: var(--text-muted); flex-shrink: 0; }
.recap-value { text-align: right; font-weight: 500; }

.devis-box {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 20px;
}

.devis-box .total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.devis-note {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

.option-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .82rem;
  margin: 2px;
}

/* ── Alert box ────────────────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 14px 16px;
  font-size: .88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-warn  { background: var(--orange-light); border: 1px solid var(--orange); color: var(--orange); }
.alert-error { background: var(--red-light);    border: 1px solid var(--red);    color: var(--red); }
.alert-info  { background: var(--accent-light); border: 1px solid var(--accent); color: var(--accent); }
.alert-success { background: var(--green-light); border: 1px solid var(--green); color: var(--green); }

/* ── Loader ──────────────────────────────────────────────────── */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error / Success pages ───────────────────────────────────── */
.center-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 40px 16px;
  gap: 16px;
}

.center-page .icon-big { font-size: 4rem; }
.center-page h2 { font-size: 1.5rem; }
.center-page p  { color: var(--text-muted); max-width: 440px; line-height: 1.6; }

/* ── Modal (exemples plaques) ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  margin: 0 16px;
}

.modal h3     { margin-bottom: 14px; }
.modal-close  { float: right; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }
.modal-imgs   { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-imgs img { border-radius: 8px; width: 160px; height: 90px; object-fit: cover; border: 1px solid var(--border); cursor: zoom-in; display: block; }
.modal-img-fig { display: inline-flex; flex-direction: column; align-items: center; margin: 0; }
.modal-img-fig figcaption { font-size: .73rem; color: var(--text-muted); text-align: center; margin-top: 5px; max-width: 160px; word-break: break-word; line-height: 1.3; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card-head,
  .card-body,
  .card-foot { padding-left: 18px; padding-right: 18px; }
  .card-foot { flex-direction: column-reverse; }
  .btn { width: 100%; justify-content: center; }
  .header { padding: 0 14px; }
  .progress-bar { padding: 12px 14px; }
}

/* ── Feedback FAB ────────────────────────────────────────────── */
.feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.45);
  transition: background .15s, transform .1s;
  letter-spacing: .01em;
}
.feedback-fab:hover { background: #cf6d17; transform: translateY(-2px); }

/* ── Feedback Popup ──────────────────────────────────────────── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 950;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
}
.feedback-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.feedback-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
}
.feedback-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s;
}
.feedback-close:hover { background: var(--surface2); }
.feedback-hint {
  font-size: .84rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.feedback-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}
.feedback-textarea:focus { border-color: var(--accent); }
.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.feedback-status {
  font-size: .82rem;
  color: var(--text-muted);
  flex: 1;
}

/* ── Bannière post-feedback ──────────────────────────────────── */
.feedback-sent-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 910;
  display: flex;
  max-width: 380px;
  width: calc(100vw - 48px);
}
.fsb-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.fsb-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
}
.fsb-close:hover { background: var(--surface2); }
.fsb-title {
  font-weight: 700;
  font-size: .95rem;
  color: var(--green);
}
.fsb-body {
  font-size: .83rem;
  color: var(--text-muted);
  line-height: 1.45;
  padding-right: 18px;
}
.fsb-link {
  display: inline-block;
  margin-top: 2px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color .15s;
}
.fsb-link:hover { color: var(--accent-hover); text-decoration: underline; }
