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

:root {
  --bg:        #0c0d0f;
  --surface:   #131417;
  --surface2:  #1a1c20;
  --surface3:  #212429;
  --border:    rgba(255,255,255,0.09);
  --border2:   rgba(255,255,255,0.18);
  --fg:        rgba(255,255,255,0.92);
  --fg-mid:    rgba(255,255,255,0.55);
  --fg-dim:    rgba(255,255,255,0.30);
  --accent:    #6c8cff;
  --accent-soft: rgba(108,140,255,0.16);
  --danger:    #e05c5c;
  --font:      'Space Grotesk', -apple-system, sans-serif;
  --sidebar-w: 256px;
  --save-h:    64px;
  --content-w: 760px;
}

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

/* ── LAYOUT ──────────────────────────────────────────────────────── */

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */

.admin-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border);
}

.admin-logo {
  height: 24px;
  width: auto;
  mix-blend-mode: screen;
}

.admin-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  gap: 18px;
  overflow-y: auto;
}

/* Grouped navigation */
.nav-group { display: flex; flex-direction: column; gap: 3px; }

.nav-group-label {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 0 12px 6px;
}

.admin-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--fg-mid);
  font-family: var(--font);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.nav-btn-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-btn-sub {
  font-size: 10.5px;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
}

.admin-nav-btn:hover {
  color: var(--fg);
  background: rgba(255,255,255,0.05);
}

.admin-nav-btn.active {
  color: var(--fg);
  background: var(--accent-soft);
}
.admin-nav-btn.active .nav-btn-sub { color: rgba(255,255,255,0.5); }
.admin-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 3px; border-radius: 3px;
  background: var(--accent);
}

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.view-site-link {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.view-site-link:hover { color: var(--fg); }

/* ── MAIN ────────────────────────────────────────────────────────── */

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── SAVE BAR ────────────────────────────────────────────────────── */

.save-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--save-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 0 40px;
  background: rgba(12,13,15,0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Back-to-site link — desktop uses the sidebar "View site" link, so this only
   appears on mobile (where the sidebar collapses to a tab bar). */
.save-bar-site {
  display: none;
  margin-right: auto;             /* push it to the far left of the save bar */
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-mid);
  text-decoration: none;
  transition: color 0.2s;
}
.save-bar-site:hover { color: var(--fg); }

.save-status {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #7ddf9e;
  transition: opacity 0.3s;
}

.save-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 11px 26px;
  transition: filter 0.2s, transform 0.05s;
}
.save-btn:hover { filter: brightness(1.12); }
.save-btn:active { transform: translateY(1px); }

/* ── SECTIONS ────────────────────────────────────────────────────── */

.admin-section { display: none; padding: 40px 40px 100px; }
.admin-section.active { display: block; animation: secIn 0.25s ease; }
@keyframes secIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Constrain readable content width and center it */
.admin-section > .sec-header,
.admin-section > .field-group,
.admin-section > .field-row-2,
.admin-section > .field-row-3,
.admin-section > .subsec-title,
.admin-section > .carousel-editor,
.admin-section > .header-preview,
.admin-section > .pp-project-fields,
.admin-section > .add-nav-btn,
.admin-section > .add-field-btn { max-width: var(--content-w); margin-left: auto; margin-right: auto; }

/* two-column and three-column field rows */
.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.field-row-2 .field-group,
.field-row-3 .field-group { margin-bottom: 0; }

/* small hint text under a field */
.field-hint {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  min-height: 16px;
}

.sec-header {
  margin-bottom: 34px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.sec-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.sec-title {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.sec-desc {
  font-size: 13.5px;
  color: var(--fg-mid);
  line-height: 1.65;
}
.sec-desc code {
  font-size: 12px; background: var(--surface3); padding: 2px 6px; border-radius: 4px;
  color: var(--fg); font-family: 'Courier New', monospace;
}

/* ── FIELDS ──────────────────────────────────────────────────────── */

/* Each setting sits in a subtle card so it's clear what each control is */
.field-group {
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
/* grouped rows: the cards sit side by side, no double padding */
.field-row-2, .field-row-3 { margin-bottom: 18px; }
.field-row-2 .field-group, .field-row-3 .field-group { margin-bottom: 0; height: 100%; }

/* nested field-groups (a group inside a group/row inside a group) are flat —
   no card-within-a-card */
.field-group .field-group {
  background: none; border: none; padding: 0; margin: 0;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--fg);
  margin-bottom: 12px;
}

.field-note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 300;
  color: var(--fg-dim);
  font-size: 11.5px;
}

.field-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 300;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  border-radius: 7px;
}

.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-input::placeholder { color: var(--fg-dim); }
.field-textarea { resize: vertical; line-height: 1.65; }
select.field-input { cursor: pointer; }

/* ── URL + UPLOAD ROW ────────────────────────────────────────────── */

.url-upload-row {
  display: flex;
  gap: 8px;
}

.url-upload-row .field-input { flex: 1; }

.upload-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  height: 42px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
  background: var(--surface3);
  border: 1px solid var(--border2);
  cursor: pointer;
  transition: filter 0.2s, border-color 0.2s;
  border-radius: 7px;
  white-space: nowrap;
}

.upload-btn:hover { filter: brightness(1.3); border-color: var(--accent); }

/* ── IMAGE PREVIEW ───────────────────────────────────────────────── */

.img-preview {
  margin-top: 10px;
  min-height: 0;
  transition: min-height 0.2s;
}

.img-preview img {
  display: block;
  max-height: 160px;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid var(--border);
}

.img-preview:empty { display: none; }

/* ── HERO PREVIEW ────────────────────────────────────────────────── */

.field-preview {
  margin-top: 10px;
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

/* ── CAROUSEL EDITOR ─────────────────────────────────────────────── */

.carousel-editor {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 520px;
  background: var(--surface);
}
/* The editor needs more room than the standard form width */
.admin-section > .carousel-editor { max-width: 1040px; }

.item-list {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.item-card {
  padding: 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  border-left: 3px solid transparent;
  display: flex; align-items: center; gap: 8px;
}
.item-card-text { flex: 1; min-width: 0; }
.item-card-del {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: 1px solid var(--border); border-radius: 6px;
  background: none; color: var(--fg-dim);
  font-size: 15px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity 0.15s, color 0.2s, border-color 0.2s;
}
.item-card:hover .item-card-del { opacity: 1; }
.item-card-del:hover { color: var(--danger); border-color: var(--danger); }

.item-card:hover { background: rgba(255,255,255,0.04); }
.item-card.selected { background: var(--accent-soft); border-left-color: var(--accent); }

.item-card-client {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.item-card-title {
  font-size: 13px;
  font-weight: 400;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-item-btn {
  margin-top: auto;
  padding: 14px 16px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--fg-mid);
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, background 0.15s;
}

.add-item-btn:hover { color: var(--fg); background: rgba(255,255,255,0.04); }

.item-editor {
  padding: 28px 28px 40px;
  overflow-y: auto;
}

.item-editor-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-editor-empty p {
  font-size: 13px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

/* ── EDITOR ROWS ─────────────────────────────────────────────────── */

.editor-row { margin-bottom: 0; }
.editor-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor-row.two-col .field-group { margin-bottom: 0; }

/* ── PHOTO GRID ──────────────────────────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.photo-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-slot-preview {
  aspect-ratio: 4/3;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 2px;
}

.photo-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-slot-preview .slot-empty-text {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}

.photo-slot-inputs {
  display: flex;
  gap: 5px;
}

.photo-slot-url {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font);
  font-size: 11px;
  padding: 6px 8px;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.photo-slot-url:focus { border-color: var(--border2); }
.photo-slot-url::placeholder { color: var(--fg-dim); }

.photo-slot-upload {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 30px;
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-mid);
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  border-radius: 2px;
  white-space: nowrap;
}

.photo-slot-upload:hover { color: var(--fg); border-color: var(--border2); }

.photo-slot-clear {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: none;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}

.photo-slot-clear:hover { color: var(--danger); border-color: var(--danger); }

/* ── EDITOR ACTIONS ──────────────────────────────────────────────── */

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.danger-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--danger);
  background: none;
  border: 1px solid var(--danger);
  cursor: pointer;
  padding: 9px 20px;
  transition: background 0.2s, color 0.2s;
  border-radius: 2px;
}

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

.reorder-btns { display: flex; gap: 8px; }

.icon-btn {
  width: 34px;
  height: 34px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg-mid);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  border-radius: 2px;
}

.icon-btn:hover { color: var(--fg); border-color: var(--border2); }

/* ── REPRESENTATION EDITOR ───────────────────────────────────────── */

.rep-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rep-slot { display: flex; flex-direction: column; gap: 6px; }

.rep-slot-label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.rep-slot-inputs { display: flex; gap: 8px; }

.rep-slot-region,
.rep-slot-name {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.rep-slot-region { flex: 0 0 80px; }
.rep-slot-region:focus,
.rep-slot-name:focus { border-color: var(--border2); }
.rep-slot-region::placeholder,
.rep-slot-name::placeholder { color: var(--fg-dim); }

/* ── RADIO GROUP ─────────────────────────────────────────────────── */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-mid);
  transition: color 0.2s;
  user-select: none;
}

.radio-item:hover { color: var(--fg); }

.radio-item input[type="radio"] { display: none; }

.radio-box {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border2);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.radio-item input[type="radio"]:checked + .radio-box {
  border-color: var(--accent);
}

.radio-item input[type="radio"]:checked + .radio-box::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.radio-item input[type="radio"]:checked ~ * { color: var(--fg); }

/* Square variant for checkboxes (e.g. Bold title) */
.radio-item input[type="checkbox"] { display: none; }
.radio-box.square { border-radius: 5px; }
.radio-item input[type="checkbox"]:checked + .radio-box.square {
  border-color: var(--accent);
  background: var(--accent);
}
.radio-item input[type="checkbox"]:checked + .radio-box.square::after {
  content: '';
  position: absolute;
  top: 2px; left: 5.5px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ── SUBSECTION TITLE ────────────────────────────────────────────── */

.subsec-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 8px 0 16px;
}
.subsec-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.subsec-title:not(:first-of-type) { margin-top: 34px; }

/* ── TITLE PREVIEW ───────────────────────────────────────────────── */

.title-preview-text {
  /* font-family / size / weight set live by JS */
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--fg);
  transition: font-size 0.15s;
}

/* ── LOGIN GATE ──────────────────────────────────────────────────── */

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-gate.hidden { display: none; }

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(320px, 86vw);
  text-align: center;
}

.login-logo {
  height: 40px;
  width: auto;
  mix-blend-mode: screen;
  margin-bottom: 4px;
}

.login-title {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mid);
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 13px 16px;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--border2); }
.login-input::placeholder { color: var(--fg-dim); }

.login-btn {
  width: 100%;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--fg);
  border: none;
  cursor: pointer;
  padding: 13px;
  border-radius: 2px;
  transition: opacity 0.2s;
}
.login-btn:hover { opacity: 0.82; }

.login-error {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #e05c5c;
  opacity: 0;
  transition: opacity 0.2s;
  min-height: 16px;
}
.login-error.visible { opacity: 1; }

/* ── LOGO SIZE SLIDER ────────────────────────────────────────────── */

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.slider-min, .slider-max {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.range-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: var(--surface3);
  outline: none;
  border-radius: 3px;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  transition: transform 0.15s;
}

.range-slider::-webkit-slider-thumb:hover { transform: scale(1.18); }
.range-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
}

.logo-preview {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-preview img {
  display: block;
  height: auto;
  max-height: 80px;
  mix-blend-mode: screen;
  filter: invert(1);
  transition: width 0.1s;
}

/* ── NAV EDITOR ──────────────────────────────────────────────────── */

.nav-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.nav-item-row {
  display: grid;
  grid-template-columns: 22px 1fr 1fr 1fr 1.6fr 32px; /* handle, EN, ES, FR, href, del */
  gap: 6px;
  align-items: center;
}

.nav-item-text-fr,
.nav-item-text-es,
.nav-item-text,
.nav-item-href,
.nav-item-size {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.2s;
  width: 100%;
}

.nav-item-text-es:focus,
.nav-item-text:focus,
.nav-item-href:focus,
.nav-item-size:focus  { border-color: var(--border2); }
.nav-item-text-es::placeholder,
.nav-item-text::placeholder,
.nav-item-href::placeholder { color: var(--fg-dim); }

.nav-item-size {
  text-align: center;
  -moz-appearance: textfield;
}
.nav-item-size::-webkit-outer-spin-button,
.nav-item-size::-webkit-inner-spin-button { -webkit-appearance: none; }

.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.add-nav-btn {
  align-self: flex-start;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 9px 18px;
  transition: filter 0.2s;
  border-radius: 8px;
  margin-top: 8px;
}
.add-nav-btn:hover { filter: brightness(1.25); }

/* ── HEADER LIVE PREVIEW ─────────────────────────────────────────── */

.header-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 22px;
  min-height: 60px;
  margin-top: 10px;
  overflow-x: auto;
}
.header-preview-brand {
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}
.header-preview-brand img { height: 24px; width: auto; display: block; mix-blend-mode: screen; }
.header-preview-nav {
  display: flex;
  align-items: center;
  /* gap set inline from the spacing slider */
}
.hp-chip {
  text-transform: uppercase;
  color: var(--fg-mid);
  cursor: grab;
  white-space: nowrap;
  padding: 4px 6px;
  border-radius: 3px;
  border: 1px dashed transparent;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.hp-chip:hover { color: var(--fg); border-color: rgba(255,255,255,0.25); }
.hp-chip.dragging { opacity: 0.4; }
.hp-chip.drop-target { border-color: var(--fg); background: rgba(255,255,255,0.06); }

/* ── DRAGGABLE NAV ROWS ──────────────────────────────────────────── */

.nav-item-row[draggable="true"] { cursor: default; }
.nav-item-row.dragging { opacity: 0.4; }
.nav-item-row.drop-target { box-shadow: inset 0 2px 0 var(--fg); }
.nav-drag-handle {
  cursor: grab;
  color: var(--fg-dim);
  font-size: 14px;
  padding: 0 4px;
  user-select: none;
  display: flex; align-items: center; justify-content: center;
}
.nav-drag-handle:hover { color: var(--fg); }
.nav-drag-handle:active { cursor: grabbing; }

/* ── FLOATING TEXT — per-project list ────────────────────────────── */
.ft-project-list { display: flex; flex-direction: column; gap: 10px; }
.ft-project-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 32px; /* name, EN, ES, FR, clear */
  gap: 8px; align-items: center;
}
.ft-project-name {
  font-size: 12px; color: var(--fg); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.ft-project-name small { display: block; color: var(--fg-dim); font-size: 10.5px; }
.ft-project-row .field-input { padding: 9px 11px; }

/* ── SOCIAL LINKS EDITOR ─────────────────────────────────────────── */
.socials-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
/* Contact image slideshow rows: [enable] [thumb] [url] [upload] [×] */
.ci-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ci-row { display: grid; grid-template-columns: auto 46px 1fr auto 34px; gap: 10px; align-items: center; }
.ci-enable { display: inline-flex; align-items: center; cursor: pointer; }
.ci-thumb { width: 46px; height: 46px; border-radius: 6px; overflow: hidden; background: var(--surface2); flex-shrink: 0; }
.ci-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci-row .ci-upload { padding: 0 12px; height: 38px; }
.social-row {
  display: grid; grid-template-columns: 150px 1fr 34px; gap: 8px; align-items: center;
}
.social-row select.field-input { padding: 9px 10px; }

/* ── CONTACT FIELDS EDITOR ───────────────────────────────────────── */

.contact-field-row {
  display: grid;
  grid-template-columns: 22px 1fr 120px auto 32px;
  gap: 8px;
  align-items: center;
}
.contact-field-row select.field-input { padding: 8px 10px; }
/* Stacked EN/ES/FR label inputs inside the label column */
.cf-labels { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.contact-field-req {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--fg-mid); white-space: nowrap; cursor: pointer;
  user-select: none;
}

.contact-preview {
  display: flex; flex-direction: column;
  background: #000; border: 1px solid var(--border);
  border-radius: 3px; padding: 22px 24px;
}
.contact-preview .form-row { border-top: 1px solid var(--border); }
.contact-preview .form-row:last-of-type { border-bottom: 1px solid var(--border); }
.contact-preview input, .contact-preview textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--font); font-size: 13px; font-weight: 300;
  padding: 12px 0; resize: none;
}
.contact-preview input::placeholder, .contact-preview textarea::placeholder { color: var(--fg-dim); }
.contact-preview .form-submit {
  margin-top: 18px; align-self: flex-start;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #000; background: #fff; border: none; padding: 10px 26px; border-radius: 2px;
}

/* ── PROJECT INFO (description vs specs) ─────────────────────────── */
.specs-grid {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.spec-field { display: flex; flex-direction: column; gap: 6px; }
.spec-field span {
  font-size: 11px; letter-spacing: 0.04em; color: var(--fg-mid);
}
/* JS toggles which one shows (per-project block now lives in the Project Page panel) */
.pp-project-fields.info-specs #ei-desc,
.pp-project-fields.info-specs #ei-desc-es { display: none; }
.pp-project-fields.info-specs .specs-grid { display: grid; }

/* ── MEDIA TYPE TOGGLE (carousel editor) ────────────────────────── */

.media-type-toggle {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.media-type-label {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

/* ── COLOR ROW ───────────────────────────────────────────────────── */

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.color-picker {
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  padding: 2px;
  background: var(--surface2);
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; border-radius: 1px; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 1px; }

.color-value {
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--fg-mid);
  letter-spacing: 0.05em;
}

/* Favicon preview — checkerboard shows the transparent background */
.favicon-preview {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid var(--border2); border-radius: 7px; overflow: hidden;
  background-color: #2a2a2a;
  background-image:
    linear-gradient(45deg, #3a3a3a 25%, transparent 25%, transparent 75%, #3a3a3a 75%),
    linear-gradient(45deg, #3a3a3a 25%, transparent 25%, transparent 75%, #3a3a3a 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px;
  display: flex; align-items: center; justify-content: center;
}
.favicon-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ── DESCRIPTION PREVIEW ─────────────────────────────────────────── */

.desc-preview {
  background: #000;
  border: 1px solid var(--border);
  padding: 24px 28px;
  border-radius: 2px;
  margin-top: 10px;
}

.desc-preview-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  line-height: 1.82;
  letter-spacing: 0.01em;
  /* font-size + color set by JS live preview */
  transition: color 0.15s, font-size 0.15s;
}

code {
  font-size: 11px;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--fg-mid);
  font-family: 'Courier New', monospace;
}

/* ── FREE PHOTO LAYOUT (drag & scale) ────────────────────────────── */
.arrange-canvas {
  position: relative;
  width: 100%;
  min-height: 120px;        /* height is set inline by JS to fit the photos */
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
}
.arrange-box {
  position: absolute;
  overflow: hidden;
  cursor: grab;
  outline: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.arrange-box:hover { outline-color: var(--accent); }
.arrange-box.dragging { cursor: grabbing; outline: 2px solid var(--accent); z-index: 5; }
.arrange-box img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; pointer-events: none;
}
.arrange-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  background: var(--accent);
  border-top-left-radius: 4px;
  cursor: nwse-resize;
  opacity: 0.85;
}
.arrange-handle:hover { opacity: 1; }

/* ── RESPONSIVE (tablet / mobile) ────────────────────────────────── */

@media (max-width: 768px) {
  /* iOS auto-zooms the page when focusing an input under 16px — keep all admin inputs
     at 16px so entering settings never zooms in. */
  .field-input, .login-input, textarea.field-input, select.field-input { font-size: 16px; }

  /* Sidebar becomes a horizontal tab bar at the top; content stacks below. */
  .admin-layout { flex-direction: column; }

  .admin-sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    position: static;          /* only the save bar stays sticky on mobile */
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .admin-brand { padding: 14px 18px; }

  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-group { flex-direction: row; gap: 6px; }
  .nav-group-label { display: none; }   /* free up horizontal room */
  .nav-btn-sub { display: none; }        /* one-line compact tabs */
  .admin-nav-btn {
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface2);
  }
  .admin-nav-btn.active::before { display: none; } /* no left bar on a tab row */
  .sidebar-footer { display: none; }

  /* Save bar sticks to the top so Save is always reachable on long forms */
  .save-bar { padding: 0 18px; }
  .save-bar-site { display: inline-flex; align-items: center; } /* back-to-site link */

  /* Sections + multi-column field rows collapse to one column */
  .admin-section { padding: 24px 16px 80px; }
  .field-row-2, .field-row-3 { grid-template-columns: 1fr; }

  /* Carousel editor: project list above, editor below */
  .carousel-editor { grid-template-columns: 1fr; min-height: 0; }
  .admin-section > .carousel-editor { max-width: var(--content-w); }
  .item-list {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 230px;
    overflow-y: auto;
  }
  .item-editor { padding: 20px 16px 28px; }

  /* Dragging to reorder isn't practical on touch — hide handles (reorder on desktop) */
  .nav-drag-handle { display: none; }

  /* Grids that don't fit a phone */
  .photo-grid  { grid-template-columns: repeat(2, 1fr); }
  .rep-editor  { grid-template-columns: 1fr; }
  .specs-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  /* Multi-input editor rows stack vertically — each control full width */
  .nav-item-row,
  .contact-field-row,
  .ft-project-row,
  .social-row, .ci-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
  }
  .ci-row .ci-thumb { width: 100%; height: 120px; }
  .rep-slot-inputs { flex-direction: column; }
  .rep-slot-region { flex: 1 1 auto; }   /* don't collapse to an 80px-tall box */

  .photo-grid { grid-template-columns: 1fr; }
  .media-type-toggle { flex-wrap: wrap; gap: 12px 20px; }

  .editor-actions { flex-direction: column; gap: 16px; align-items: stretch; }
  .reorder-btns { justify-content: center; }

  .sec-title { font-size: 23px; }
  .save-bar { padding: 0 14px; gap: 12px; }
}
