/* =============================================================
 * shared.css — Onboarding proto (consultant + admin review)
 * Reprend les tokens visuels de portail/admin/index.html pour
 * rester cohérent avec le portail prod.
 * ============================================================= */

:root {
  --av-red:        #DA2921;
  --av-red-hover:  #B81F18;
  --av-red-soft:   rgba(218,41,33,0.08);
  --av-red-border: rgba(218,41,33,0.25);
  --av-red-glow:   rgba(218,41,33,0.18);
  --av-falu:       #7E1E17;
  --av-black:      #141313;
  --av-gray:       #F1F1F1;

  --bg:            #FAFAF8;
  --surface:       #FFFFFF;
  --text:          #141313;
  --text-secondary:#4B4B4B;
  --text-muted:    #7A7A7A;
  --text-light:    #A8A8A8;
  --border:        #E8E5E0;
  --border-soft:   #F1EFEB;

  --green:         #2D6A2D;
  --green-soft:    #DCFCE7;
  --green-text:    #166534;
  --amber-soft:    #FEF3C7;
  --amber-text:    #B45309;

  --shadow-sm:     0 1px 2px rgba(20,19,19,0.04);
  --shadow-md:     0 4px 14px rgba(20,19,19,0.06);
  --shadow-lg:     0 12px 32px rgba(20,19,19,0.10);

  --r-sm: 8px;
  --r:    10px;
  --r-lg: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* =================== Topbar =================== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex; align-items: center; gap: 14px;
}
.topbar-brand img { height: 28px; width: auto; display: block; }
.topbar-brand .vsep {
  width: 1px; height: 22px; background: var(--border);
}
.topbar-brand .brand-label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 600;
}
.topbar-mode {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 600;
}

/* =================== Page layout =================== */
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 80px;
}
.page-head { margin-bottom: 20px; }
.page-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--av-red); font-weight: 700; margin-bottom: 6px;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-secondary); margin: 0; }

/* Two-column form + preview */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

.col-form, .col-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.col-preview { position: sticky; top: 24px; }
@media (max-width: 900px) {
  .col-preview { position: static; }
}

/* =================== Sections inside form =================== */
.section { margin-bottom: 28px; }
.section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--av-red); font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

/* =================== Fields =================== */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit; font-size: 14px;
  background: #FAFAF8;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--av-red);
  box-shadow: 0 0 0 3px var(--av-red-soft);
  background: #fff;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
.field input[type="file"] { padding: 8px; background: #fff; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.field .hint.error { color: var(--av-falu); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.input-with-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.input-with-button button {
  white-space: nowrap;
}

/* Couleur : color picker + champ texte hex synchronisés */
.color-input {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: stretch;
}
.color-input input[type="color"] {
  height: 40px; padding: 4px; cursor: pointer;
}
.color-input input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.color-input input[type="text"].invalid {
  border-color: var(--av-falu);
  background: #FFF5F4;
}

/* Checkbox inline avec son label (case à gauche, texte à droite) */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-transform: none;       /* override le uppercase global des labels */
  letter-spacing: normal;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--av-red);
  cursor: pointer;
}

/* Palette de couleurs prédéfinies (swatches) */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.color-swatches .swatch {
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, box-shadow 0.15s;
}
.color-swatches .swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 1px var(--text-muted);
}
.color-swatches .swatch.active {
  box-shadow: 0 0 0 2px var(--av-red);
  transform: scale(1.05);
}

/* Mode tabs (nouveau client vs mandat pour client existant) */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}
.mode-tab {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: all 0.2s;
}
.mode-tab:hover { border-color: var(--text-muted); }
.mode-tab.active {
  border-color: var(--av-red);
  background: var(--av-red-soft);
  box-shadow: 0 0 0 3px var(--av-red-glow);
}
.mode-tab .mt-emoji {
  font-size: 20px; line-height: 1; padding-top: 2px;
}
.mode-tab .mt-body { flex: 1; }
.mode-tab .mt-title {
  font-weight: 700; font-size: 13px; color: var(--text);
  margin-bottom: 2px;
}
.mode-tab.active .mt-title { color: var(--av-falu); }
.mode-tab .mt-sub {
  font-size: 12px; color: var(--text-muted);
  font-weight: 400; line-height: 1.4;
}

/* Phase inputs (dynamic list) */
.phase-list { display: grid; gap: 8px; margin-top: 4px; }
.phase-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px; align-items: center;
}
.phase-item .phase-num {
  font-size: 12px; font-weight: 700;
  color: var(--av-red);
  padding: 10px 12px;
  background: var(--av-red-soft);
  border-radius: var(--r-sm);
  text-align: center;
}

/* =================== Buttons =================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: var(--av-gray); color: var(--text);
}
.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--av-red); color: #fff; }
.btn-primary:hover { background: var(--av-red-hover); transform: translateY(-1px); box-shadow: 0 6px 16px var(--av-red-glow); filter: none; }
.btn-secondary { background: #fff; border-color: var(--border); }
.btn-secondary:hover { border-color: var(--text-muted); filter: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--av-red); background: var(--av-red-soft); filter: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.actions {
  display: flex; gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* =================== Errors / messages =================== */
.form-error {
  display: none;
  padding: 10px 12px;
  background: var(--av-red-soft);
  border: 1px solid var(--av-red-border);
  border-radius: var(--r-sm);
  color: var(--av-falu);
  font-size: 13px; font-weight: 500;
  margin-bottom: 14px;
}
.form-error.visible { display: block; }
.form-success {
  padding: 10px 12px;
  background: var(--green-soft);
  border: 1px solid #BBF7D0;
  border-radius: var(--r-sm);
  color: var(--green-text);
  font-size: 13px;
  margin-bottom: 14px;
}
.form-info {
  padding: 10px 12px;
  background: var(--amber-soft);
  border: 1px solid #FCD34D;
  border-radius: var(--r-sm);
  color: var(--amber-text);
  font-size: 13px;
  margin-bottom: 14px;
}

/* =================== Gate (password overlay) =================== */
.gate-backdrop {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #FAFAF8 0%, #F1EFEB 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%; max-width: 380px;
  text-align: center;
}
.gate-card h2 { margin: 0 0 6px; font-size: 18px; }
.gate-card p { margin: 0 0 18px; color: var(--text-secondary); font-size: 13px; }
.gate-card input {
  width: 100%; padding: 10px 12px;
  font: inherit; font-size: 14px;
  background: #FAFAF8;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  outline: none;
  margin-bottom: 12px;
}
.gate-card input:focus {
  border-color: var(--av-red);
  box-shadow: 0 0 0 3px var(--av-red-soft);
  background: #fff;
}
.gate-card .gate-err {
  display: none;
  color: var(--av-falu); font-size: 12px; margin-bottom: 10px;
}
.gate-card .gate-err.visible { display: block; }

/* =================== Drop zone (admin review) =================== */
.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  transition: all 0.2s;
  cursor: pointer;
}
.dropzone span { display: block; margin-top: 4px; font-size: 13px; }
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--av-red);
  background: var(--av-red-soft);
  color: var(--av-falu);
}
.dropzone strong { color: var(--text); display: block; margin-bottom: 4px; }
.dropzone input[type="file"] { display: none; }

/* =================== Preview (mini landing client) =================== */
.preview-frame {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}
.preview-bar {
  height: 8px;
  background: var(--p-color, var(--av-red));
}
.preview-body {
  padding: 28px 24px 32px;
}
.preview-logo {
  height: 44px;
  margin-bottom: 22px;
  display: flex; align-items: center;
}
.preview-logo svg,
.preview-logo img { max-height: 44px; width: auto; max-width: 220px; }

/* Frame "client existant" (sans bandeau couleur ni mock login) */
.preview-frame.existing-mode .preview-body {
  padding-top: 22px;
}
.preview-tagline-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}
.preview-tagline-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 22px;
}
.preview-form-mock {
  background: #FAFAF8;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
}
.preview-form-mock label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-muted); font-weight: 600;
  display: block; margin-bottom: 6px;
}
.preview-form-mock .mock-input {
  width: 100%; padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-muted);
}
.preview-form-mock .mock-button {
  margin-top: 12px; width: 100%; padding: 10px;
  background: var(--p-color, var(--av-red));
  color: #fff;
  border: 0; border-radius: var(--r-sm);
  font-weight: 600; font-size: 13px;
  text-align: center;
}

.preview-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: #FAFAF8;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.preview-summary dt {
  text-transform: uppercase; letter-spacing: 0.4px;
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  margin-top: 8px;
}
.preview-summary dt:first-child { margin-top: 0; }
.preview-summary dd {
  margin: 2px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}
.preview-summary dd.muted { color: var(--text-muted); font-style: italic; }

.preview-phases {
  margin-top: 14px;
}
.preview-phase {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 12px;
}
.preview-phase:last-child { border-bottom: 0; }
.preview-phase .pp-num {
  font-weight: 700;
  color: var(--av-red);
}
.preview-phase .pp-name { color: var(--text); }
.preview-phase .pp-name.muted { color: var(--text-muted); font-style: italic; }

/* =================== Info dialog (post-download) =================== */
.info-dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,19,19,0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 20px;
}
.info-dialog {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 460px;
  text-align: center;
  animation: modalIn 0.25s cubic-bezier(0.22,1,0.36,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.info-dialog-icon { font-size: 36px; margin-bottom: 14px; line-height: 1; }
.info-dialog-title { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.info-dialog-msg {
  color: var(--text-secondary);
  font-size: 14px; line-height: 1.55;
  margin: 0 0 22px;
}
.info-dialog-msg strong { color: var(--text); }

/* =================== Toast =================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--av-black); color: #fff;
  padding: 12px 18px; border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  max-width: 360px;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--av-falu); }
.toast.success { background: var(--green); }

/* =================== SSH command box (admin review) =================== */
.ssh-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #1A1818;
  color: #FAFAF8;
  border-radius: var(--r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
}
.ssh-box .ssh-comment { color: #9CA3AF; }
.ssh-box .ssh-copy {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.08); color: #fff;
  border: 0; padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.ssh-box .ssh-copy:hover { background: rgba(255,255,255,0.16); }
