/* =====================================================================
   Photo Contest — Interface Catalogue (éditeur)
   Table lumineuse éditoriale : fond noir, typographie de publication,
   fiches dépliables, drag-and-drop de planches
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500&family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg:         #0e0f10;
  --pan:        #161718;
  --card:       #1c1d1f;
  --card-h:     #222325;
  --bdr:        #2a2b2e;
  --bdr-l:      #3a3b3e;

  --txt:        #e8e6e1;
  --txt-s:      #b0ada8;
  --txt-m:      #888480;

  --mono:  'DM Mono', monospace;
  --ui:    'DM Sans', sans-serif;
  --serif: 'Instrument Serif', serif;

  --gold:       #c49a3c;
  --gold-d:     #7a5e22;
  --gold-bg:    #2a1f08;
  --green:      #4da876;
  --green-bg:   #0a2518;
  --red:        #b05050;
  --red-bg:     #250e0e;
  --purple:     #9a6ec4;
  --purple-bg:  #1e1030;

  --r:      8px;
  --topbar: 48px;
  --panel:  340px;
}

/* ── Reset ──────────────────────────────────────────────────────────── */
.pc-cat-wrap *, .pc-cat-wrap *::before, .pc-cat-wrap *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ── Wrapper ────────────────────────────────────────────────────────── */
.pc-cat-wrap {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.pcc-topbar {
  height: var(--topbar);
  background: var(--pan);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.pcc-logo {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
}

.pcc-badge {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-bg);
  padding: 3px 8px;
  border-radius: 3px;
}

.pcc-sep { width: 1px; height: 18px; background: var(--bdr-l); }

.pcc-edition {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--txt-s);
  letter-spacing: .03em;
}

/* Stats topbar */
.pcc-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}

.pcc-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.pcc-stat__n {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}

.pcc-stat__l {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--txt-m);
}

/* Boutons export topbar */
.pcc-export-btns {
  display: flex;
  gap: 8px;
  margin-left: 8px;
}

.pcc-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.pcc-btn--pdf {
  background: var(--gold);
  color: #0e0f10;
}
.pcc-btn--pdf:hover { background: #d4aa4c; }

.pcc-btn--csv {
  background: transparent;
  border: 1px solid var(--bdr-l);
  color: var(--txt-s);
}
.pcc-btn--csv:hover { border-color: var(--txt-m); color: var(--txt); }

.pcc-btn--json {
  background: transparent;
  border: 1px solid var(--bdr-l);
  color: var(--txt-s);
}
.pcc-btn--json:hover { border-color: var(--txt-m); color: var(--txt); }

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

/* ── Corps ──────────────────────────────────────────────────────────── */
.pcc-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Grille planches (gauche) ───────────────────────────────────────── */
.pcc-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: 40px;
}

/* En-tête section */
.pcc-section-hdr {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bdr);
}

.pcc-section-hdr h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 400;
  color: var(--txt-s);
}

.pcc-section-hdr .nb {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--txt-m);
  letter-spacing: .05em;
}

/* Grille planches */
.pcc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px;
  margin-bottom: 32px;
}

/* ── Planche (carte photo catalogue) ────────────────────────────────── */
.pcc-planche {
  position: relative;
  background: var(--card);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, outline-color .15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.pcc-planche:hover { transform: scale(1.015); z-index: 2; }
.pcc-planche.active { outline-color: var(--gold); z-index: 3; }
.pcc-planche.exclu  { opacity: .4; }

.pcc-planche[data-ratio="2_3"] { aspect-ratio: 2/3; }
.pcc-planche[data-ratio="3_2"] { aspect-ratio: 3/2; }

/* Image */
.pcc-planche__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .25s;
}
.pcc-planche__img--load { opacity: 0; }

/* Overlay hover */
.pcc-planche__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 55%);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.pcc-planche:hover .pcc-planche__overlay { opacity: 1; }

/* Numéro de planche (haut gauche) */
.pcc-planche__num {
  position: absolute;
  top: 7px;
  left: 7px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: rgba(255,255,255,.8);
  background: rgba(0,0,0,.55);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
  line-height: 1.4;
}

/* Badge statut paiement (haut droit) */
.pcc-planche__pmt {
  position: absolute;
  top: 7px;
  right: 7px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
}
.pcc-pmt--paye    { background: var(--green-bg); color: var(--green); }
.pcc-pmt--attente { background: var(--purple-bg); color: var(--purple); }

/* Titre court (bas) */
.pcc-planche__titre {
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255,255,255,.7);
  opacity: 0;
  transition: opacity .2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.pcc-planche:hover .pcc-planche__titre { opacity: 1; }

/* Indicateur inclusion */
.pcc-planche__inclu {
  position: absolute;
  bottom: 7px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(0,0,0,.6);
}

/* Drag */
.pcc-planche.dragging { opacity: .35; transform: scale(.96); }
.pcc-planche.drag-over { outline-color: var(--gold-d); }

/* ── Panneau fiche (droit) ──────────────────────────────────────────── */
.pcc-panel {
  width: var(--panel);
  background: var(--pan);
  border-left: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform .25s ease;
}

.pcc-panel--vide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--txt-m);
  text-align: center;
  padding: 40px 24px;
  flex: 1;
}

.pcc-panel--vide__icon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 40px;
  opacity: .3;
}

.pcc-panel--vide__txt {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.8;
  letter-spacing: .02em;
}

/* En-tête panneau */
.pcc-panel__hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pcc-panel__hdr-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--txt-s);
  min-width: 36px;
}

.pcc-panel__hdr-info {
  flex: 1;
  min-width: 0;
}

.pcc-panel__hdr-ref {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--txt-m);
}

.pcc-panel__hdr-dim {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--txt-s);
  margin-top: 2px;
}

/* Toggle inclusion */
.pcc-toggle-inclu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--bdr);
  cursor: pointer;
  transition: background .15s;
}
.pcc-toggle-inclu:hover { background: var(--card-h); }

.pcc-toggle-inclu__switch {
  width: 36px;
  height: 20px;
  background: var(--bdr-l);
  border-radius: 10px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.pcc-toggle-inclu__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.pcc-toggle-inclu.on .pcc-toggle-inclu__switch { background: var(--gold); }
.pcc-toggle-inclu.on .pcc-toggle-inclu__switch::after { transform: translateX(16px); }

.pcc-toggle-inclu__lbl {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--txt-s);
}

/* Champs de la fiche */
.pcc-field {
  padding: 12px 18px;
  border-bottom: 1px solid var(--bdr);
}

.pcc-field__lbl {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--txt-m);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pcc-field__lbl span {
  font-size: 8px;
  color: var(--txt-m);
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: none;
}

.pcc-input,
.pcc-textarea,
.pcc-select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--bdr-l);
  border-radius: 5px;
  color: var(--txt);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  line-height: 1.5;
  transition: border-color .15s;
}

.pcc-input:focus,
.pcc-textarea:focus,
.pcc-select:focus {
  outline: none;
  border-color: var(--gold);
}

.pcc-input::placeholder,
.pcc-textarea::placeholder { color: var(--txt-m); }

.pcc-textarea {
  min-height: 90px;
  resize: vertical;
  max-height: 200px;
}

/* Bouton sauvegarder */
.pcc-btn-save {
  width: 100%;
  height: 38px;
  background: var(--gold);
  color: #0e0f10;
  border: none;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
  margin-top: 2px;
}
.pcc-btn-save:hover { background: #d4aa4c; }
.pcc-btn-save:disabled { opacity: .35; cursor: not-allowed; }

/* Indicateur "enregistré" */
.pcc-saved {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  background: var(--green-bg);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  margin-top: 8px;
}
.pcc-saved.visible { display: flex; }
.pcc-saved__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* Miniature planche dans panneau */
.pcc-panel__thumb {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--bdr);
}
.pcc-panel__thumb[data-ratio="2_3"] { aspect-ratio: 2/3; }

/* ── Section photos non incluses ────────────────────────────────────── */
.pcc-exclu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 3px;
}

/* ── Progress export ────────────────────────────────────────────────── */
.pcc-export-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14,15,16,.88);
  z-index: 600;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.pcc-export-overlay.visible { display: flex; }

.pcc-export-overlay__titre {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--txt-s);
}

.pcc-export-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--bdr-l);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: pcc-spin .7s linear infinite;
}

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

.pcc-export-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--txt-m);
  letter-spacing: .04em;
}

/* ── Toasts ─────────────────────────────────────────────────────────── */
.pcc-toasts {
  position: fixed;
  bottom: 24px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 400;
  pointer-events: none;
}

.pcc-toast {
  background: var(--pan);
  border: 1px solid var(--bdr-l);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--txt);
  max-width: 300px;
  animation: pcc-tin .2s ease;
}
.pcc-toast--ok   { border-left: 3px solid var(--green); }
.pcc-toast--err  { border-left: 3px solid var(--red); }
.pcc-toast--info { border-left: 3px solid var(--gold); }
.pcc-toast--out  { animation: pcc-tout .18s ease forwards; }

@keyframes pcc-tin  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes pcc-tout { to { opacity:0; transform:translateY(8px); } }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pcc-panel { display: none; }
  .pcc-grid  { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ── Category badge ─────────────────────────────────────────────────── */
.pc-cat-badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(196, 154, 60, 0.15);
  color: #c49a3c;
  border-radius: 3px;
  margin-left: 6px;
}
