/* Les Garde-Temps — Back Office Styles */
:root {
  --ink: #1a1410;
  --parchment: #f5f0e8;
  --cream: #faf7f0;
  --gold: #b8963e;
  --gold-light: #d4af6a;
  --gold-pale: #f0e4c0;
  --bordeaux: #6b1e2a;
  --bordeaux-light: #8b2e3a;
  --sienna: #8b5e3c;
  --slate: #4a5568;
  --mist: #e8e2d8;
  --shadow: rgba(26,20,16,0.12);
  --sidebar-w: 260px;
}

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

body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  border-right: 2px solid var(--gold);
}

.sidebar-brand {
  padding: 28px 20px 20px;
  border-bottom: 1px solid rgba(184,150,62,0.3);
  text-align: center;
}
.sidebar-brand .ornament { color: var(--gold); font-size: 22px; letter-spacing: 6px; display:block; margin-bottom:8px; }
.sidebar-brand h1 {
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 18px;
  color: var(--parchment);
  letter-spacing: 1px;
  line-height: 1.3;
}
.sidebar-brand small {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  display: block;
  margin-top: 6px;
}

.nav-section { padding: 12px 0 4px; }
.nav-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 4px 20px 8px;
  display: block;
  opacity: 0.7;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  color: rgba(245,240,232,0.75);
  font-size: 15px;
  border-left: 3px solid transparent;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
}
.nav-item:hover {
  color: var(--parchment);
  background: rgba(184,150,62,0.1);
  border-left-color: var(--gold);
}
.nav-item.active {
  color: var(--gold-light);
  background: rgba(184,150,62,0.15);
  border-left-color: var(--gold);
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; opacity: 0.8; }
.nav-divider { height: 1px; background: rgba(184,150,62,0.2); margin: 8px 20px; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(184,150,62,0.2);
}
.sidebar-footer p {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(184,150,62,0.5);
  text-align: center;
}

/* ── MAIN ────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────── */
#topbar {
  background: var(--cream);
  border-bottom: 1px solid var(--mist);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px var(--shadow);
}
.topbar-title {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  color: var(--ink);
  font-style: italic;
}
.topbar-title span { color: var(--gold); font-style: normal; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── CONTENT ─────────────────────────────────────────── */
#content { padding: 32px; flex: 1; }

/* ── PANELS ──────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ── DASHBOARD ───────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-top: 3px solid var(--gold);
  padding: 20px 24px;
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--shadow);
}
.stat-card .num {
  font-family: 'IM Fell English', serif;
  font-size: 42px;
  color: var(--gold);
  line-height: 1;
}
.stat-card .lbl {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--slate);
  margin-top: 6px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--mist);
  padding-bottom: 12px;
}
.section-title {
  font-family: 'IM Fell English', serif;
  font-size: 24px;
  font-style: italic;
  color: var(--ink);
}
.section-subtitle {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 9px 20px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 1px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
}
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); }
.btn-outline {
  background: transparent;
  border-color: var(--mist);
  color: var(--slate);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-bordeaux {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: white;
}
.btn-bordeaux:hover { background: var(--bordeaux-light); }
.btn-sm { font-size: 10px; padding: 6px 13px; }

/* ── TABLE ───────────────────────────────────────────── */
.table-card {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--mist);
  background: var(--parchment);
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--mist);
  border-radius: 1px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--gold); }
.search-box::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.4;
}
.export-group { display: flex; gap: 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead tr {
  background: var(--ink);
}
thead th {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-light);
  padding: 12px 16px;
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--mist);
  transition: background 0.15s;
}
tbody tr:hover { background: var(--gold-pale); }
tbody td {
  padding: 10px 16px;
  color: var(--ink);
  vertical-align: middle;
}
.td-img { width: 48px; height: 48px; object-fit: cover; border: 1px solid var(--mist); }
.td-img-placeholder {
  width: 48px; height: 48px;
  background: var(--mist);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--slate);
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.badge-style { background: var(--gold-pale); color: var(--sienna); }
.badge-forme { background: #e8f0e8; color: #3a6b3a; }
.actions-cell { display: flex; gap: 6px; align-items: center; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--mist);
  background: var(--parchment);
}
.page-info {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--slate);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--mist);
  cursor: pointer;
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  background: var(--cream);
  color: var(--ink);
  border-radius: 1px;
  transition: all 0.2s;
}
.page-btn:hover:not(.disabled), .page-btn.active { background: var(--gold); border-color: var(--gold); color: white; }
.page-btn.disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.page-btn.active   { font-weight: 700; }
.page-btn[disabled]{ opacity: 0.35; cursor: default; pointer-events: none; }
/* Boutons Préc./Suiv. — plus larges */
.page-btn:first-child, .page-btn:last-child { width: auto; padding: 0 10px; }
.page-ellipsis { display:flex; align-items:center; padding:0 4px; font-size:14px; color:var(--slate); }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,20,16,0.6);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-top: 3px solid var(--gold);
  width: 760px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border-radius: 2px;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--mist);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--parchment);
}
.modal-title {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  font-style: italic;
  color: var(--ink);
}
.modal-close {
  font-size: 22px;
  cursor: pointer;
  color: var(--slate);
  background: none;
  border: none;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.modal-close:hover { opacity: 1; }
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--mist);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--parchment);
}

/* ── FORM ────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--slate);
}
.form-control {
  padding: 9px 12px;
  border: 1px solid var(--mist);
  border-radius: 1px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus { border-color: var(--gold); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.image-upload-area {
  border: 2px dashed var(--mist);
  border-radius: 2px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--parchment);
}
.image-upload-area:hover { border-color: var(--gold); }
.image-upload-area .icon { font-size: 32px; margin-bottom: 8px; }
.image-upload-area p {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--slate);
}

/* ── PDF MASK EDITOR ─────────────────────────────────── */
.mask-editor {
  display: flex;
  gap: 20px;
  height: calc(100vh - 180px);
}
.mask-fields-panel {
  width: 240px;
  flex-shrink: 0;
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  overflow-y: auto;
  box-shadow: 0 2px 8px var(--shadow);
}
.mask-fields-panel h3 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--mist);
  background: var(--parchment);
}
.field-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 6px 10px;
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 20px;
  cursor: grab;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink);
  transition: all 0.2s;
  user-select: none;
}
.field-badge:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-pale); }
.field-badge:active { cursor: grabbing; }
.field-badge .drag-handle { opacity: 0.4; font-size: 12px; }
.field-badge.special { border-color: var(--bordeaux); color: var(--bordeaux); background: #f8f0f1; }

.mask-page-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.mask-page-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.mask-page-toolbar select { width: 200px; }
.a4-page {
  flex: 1;
  background: white;
  border: 1px solid #ccc;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  aspect-ratio: 210 / 297;
  max-height: 100%;
  width: auto;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  border-radius: 1px;
}
.a4-page .page-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40px;
  background: var(--ink);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
}
.a4-page .page-header span {
  font-family: 'IM Fell English', serif;
  font-size: 14px;
  color: var(--gold);
  font-style: italic;
}

/* ── GRILLE 12×30 ────────────────────────────────────────── */
.a4-grid {
  position: absolute;
  /* Démarre après le header (40px) */
  top: 40px; left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-template-rows: repeat(60, 1fr);
  pointer-events: none;
  z-index: 1;
}
.a4-grid-cell {
  border-right: 1px dashed rgba(184,150,62,.18);
  border-bottom: 1px dashed rgba(184,150,62,.18);
  box-sizing: border-box;
}
.a4-grid-cell:nth-child(-n+24) { border-top: 1px dashed rgba(184,150,62,.18); }
.a4-grid-cell:nth-child(24n+1) { border-left: 1px dashed rgba(184,150,62,.18); }
/* Surlignage de la cellule cible au survol */
.a4-grid-cell.grid-highlight {
  background: rgba(184,150,62,.12);
  pointer-events: none;
}

/* ── BLOCS PLACÉS SUR LA GRILLE ─────────────────────────── */
.placed-field {
  position: absolute;
  background: rgba(245,240,232,.92);
  border: 1.5px solid var(--gold);
  border-radius: 2px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: move;
  user-select: none;
  z-index: 5;
  transition: box-shadow .1s;
}
.placed-field:hover, .placed-field.selected {
  box-shadow: 0 0 0 2px var(--gold);
  z-index: 6;
}
.placed-field .pf-header {
  background: var(--gold);
  color: white;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-shrink: 0;
}
.placed-field .pf-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placed-field .pf-coords {
  opacity: .7; font-size: 7px; white-space: nowrap; flex-shrink: 0;
}
.placed-field .pf-remove {
  cursor: pointer; opacity: .8; line-height: 1;
  background: none; border: none; color: white; padding: 0 2px;
  font-size: 10px; flex-shrink: 0;
}
.placed-field .pf-remove:hover { opacity: 1; }
.placed-field .pf-body {
  flex: 1;
  font-family: 'Cormorant Garamond', serif;
  font-size: 9px;
  color: var(--slate);
  font-style: italic;
  padding: 3px 6px;
  overflow: hidden;
}
/* Poignée de redimensionnement (coin bas-droit) */
.placed-field .pf-resize {
  position: absolute;
  bottom: 0; right: 0;
  width: 14px; height: 14px;
  cursor: se-resize;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 2px;
  color: var(--gold);
  font-size: 9px;
  z-index: 7;
}

.drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.drop-hint p {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #ccc;
}
.drop-zone-overlay {
  position: absolute;
  inset: 40px 0 0;
  border: 2px dashed transparent;
  transition: border-color 0.2s;
}
.drop-zone-overlay.drag-over { border-color: var(--gold); background: rgba(184,150,62,0.04); }

/* ── CATALOGUE SECTION ───────────────────────────────── */
.catalogue-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.cat-panel {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  padding: 20px;
  box-shadow: 0 2px 8px var(--shadow);
}
.cat-panel h3 {
  font-family: 'IM Fell English', serif;
  font-size: 18px;
  font-style: italic;
  margin-bottom: 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--mist);
  padding-bottom: 10px;
}

/* ── TABS ────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--mist); margin-bottom: 20px; }
.tab {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 10px 20px;
  cursor: pointer;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab:hover { color: var(--gold); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── TOAST ───────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-msg {
  background: var(--ink);
  color: var(--parchment);
  padding: 12px 20px;
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: toastIn 0.3s ease;
  min-width: 220px;
}
.toast-msg.success { border-left-color: #4caf50; }
.toast-msg.error { border-left-color: var(--bordeaux); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── CONFIRM DIALOG ──────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(26,20,16,0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-top: 3px solid var(--bordeaux);
  padding: 28px 32px;
  width: 400px;
  border-radius: 2px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  text-align: center;
}
.confirm-box h3 {
  font-family: 'IM Fell English', serif;
  font-size: 20px;
  font-style: italic;
  margin-bottom: 10px;
}
.confirm-box p {
  font-size: 15px;
  color: var(--slate);
  margin-bottom: 20px;
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ── GALLERY ─────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.gallery-item {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.2s;
}
.gallery-item:hover { box-shadow: 0 6px 20px rgba(184,150,62,0.2); transform: translateY(-2px); }
.gallery-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--mist); }
.gallery-img-placeholder { width: 100%; aspect-ratio: 1; background: var(--mist); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.gallery-info { padding: 10px 12px; }
.gallery-info p {
  font-size: 12px;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-actions { display: flex; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--mist); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--parchment); }
::-webkit-scrollbar-thumb { background: var(--mist); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-light); }

/* empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--slate);
}
.empty-state .icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-family: 'Josefin Sans', sans-serif; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }

/* ── THEMES PANEL ────────────────────────────────────────── */
.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.theme-card {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.25s;
  position: relative;
}
.theme-card:hover { box-shadow: 0 8px 28px rgba(184,150,62,0.22); transform: translateY(-3px); }
.theme-card-header {
  background: var(--ink);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.theme-card-title {
  font-family: 'IM Fell English', serif;
  font-size: 15px;
  font-style: italic;
  color: var(--gold-light);
  flex: 1;
  line-height: 1.3;
}
.theme-card-count {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(184,150,62,0.6);
  white-space: nowrap;
}
.theme-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--mist);
  min-height: 96px;
}
.theme-preview-img {
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--parchment);
  display: block;
  width: 100%;
}
.theme-preview-ph {
  aspect-ratio: 1;
  background: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  opacity: 0.3;
}
.theme-card-footer {
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border-top: 1px solid var(--mist);
  background: var(--parchment);
}
/* Boutons "Voir les pendules" et "Galerie" : 1 colonne chacun */
.theme-card-footer .btn:nth-child(1),
.theme-card-footer .btn:nth-child(2) {
  width: 100%;
  justify-content: center;
}
/* Boutons admin modifier / supprimer : côte à côte sur la 2e ligne */
.theme-card-footer .btn:nth-child(3),
.theme-card-footer .btn:nth-child(4) {
  width: 100%;
  justify-content: center;
}

/* ── PENDULES VIEW TOGGLE ────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--parchment);
  border: 1px solid var(--mist);
  border-radius: 2px;
  padding: 3px;
}
.view-btn {
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 1px;
  font-size: 14px;
  transition: all 0.15s;
  border: none;
  background: transparent;
  color: var(--slate);
}
.view-btn.active { background: var(--gold); color: white; }
.view-btn:hover:not(.active) { background: var(--mist); }

/* Pendules grid view */
.pendules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}
.pendule-card {
  background: var(--cream);
  border: 1px solid var(--mist);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all 0.2s;
  cursor: pointer;
}
.pendule-card:hover { box-shadow: 0 6px 20px rgba(184,150,62,0.22); transform: translateY(-2px); }
.pendule-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--parchment);
  display: block;
}
.pendule-card-ph {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(160deg, var(--parchment), var(--mist));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.4;
}
.pendule-card-body {
  padding: 10px 12px 8px;
  border-top: 1px solid var(--mist);
}
.pendule-card-titre {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pendule-card-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pendule-card-actions {
  display: flex;
  gap: 4px;
}
.pendule-card-actions button { flex: 1; }

/* Gallery with theme filter */
.gallery-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--mist);
  background: var(--parchment);
  align-items: center;
}
.gallery-filter-bar .form-label {
  white-space: nowrap;
  margin-right: 4px;
}
.theme-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--mist);
  border-radius: 20px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
  background: var(--cream);
  color: var(--slate);
  white-space: nowrap;
}
.theme-filter-chip:hover { border-color: var(--gold); color: var(--gold); }
.theme-filter-chip.active { background: var(--gold); border-color: var(--gold); color: white; }

/* Lightbox */
.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(10,8,6,0.92);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.lightbox-overlay.open { display: flex; }
.lightbox-img {
  max-width: 80vw;
  max-height: 75vh;
  object-fit: contain;
  border: 2px solid var(--gold);
  box-shadow: 0 20px 80px rgba(0,0,0,0.8);
}
.lightbox-caption {
  margin-top: 16px;
  text-align: center;
  color: var(--parchment);
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-style: italic;
  max-width: 600px;
}
.lightbox-sub {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 6px;
}
.lightbox-close {
  position: absolute;
  top: 20px; right: 28px;
  font-size: 32px;
  color: var(--gold-light);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  transition: color 0.2s;
}
.lightbox-close:hover { color: white; }


/* ── DROP ZONE IMAGE ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gold);
  border-radius: 2px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--parchment);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--gold-light);
  background: var(--gold-pale);
}
.drop-zone-icon { font-size: 28px; opacity: 0.5; margin-bottom: 8px; }
.drop-zone-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--slate);
}
.drop-zone-sub { font-size: 11px; color: var(--slate); opacity: 0.7; margin-top: 4px; }
.drop-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-zone-preview {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream);
  border: 1px solid var(--mist);
  padding: 8px 10px;
  border-radius: 2px;
}
.drop-zone-preview img {
  width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--mist);
}
.drop-zone-preview-info { font-size: 12px; flex: 1; text-align: left; }
.drop-zone-preview-name { font-weight: 600; word-break: break-all; }
.drop-zone-preview-size { color: var(--slate); font-size: 11px; }
.drop-zone-preview-clear {
  background: none; border: none; cursor: pointer; font-size: 18px; color: var(--bordeaux); padding: 0 4px;
}

/* ── DONNÉES PRIMAIRES STRUCTURÉES ──────────────────────────── */
.dp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dp-row input {
  flex: 1;
}
.dp-row-remove {
  background: none;
  border: 1px solid var(--mist);
  border-radius: 2px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 16px;
  color: var(--bordeaux);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.dp-row-remove:hover { background: var(--bordeaux); color: white; }

/* ── AUTOCOMPLÉTION DATALIST ─────────────────────────────── */
.dp-row input[list] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b8963e' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 28px;
}
