@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600&family=Jost:wght@300;400;500;600&family=Josefin+Sans:wght@100;300&family=Cormorant+Garamond:ital,wght@0,300;1,300&display=swap');

:root {
  --cream: #faf5ef;
  --cream-dark: #f1e4d4;
  --card-bg: #ffffff;
  --ink: #1e1810;
  --ink-soft: #6a5a48;
  --line: rgba(30, 24, 16, 0.14);
  --accent: #c48b5a;
  --accent-dark: #a36b3e;
  --green: #4a7a5c;
  --red: #a3453f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Jost', sans-serif;
  background: var(--cream);
  color: var(--ink);
}

.wedly-logo { display: inline-flex; align-items: baseline; line-height: 1; }
.wedly-wed { font-family: 'Josefin Sans', sans-serif; font-weight: 100; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.wedly-ly { font-family: 'Cormorant Garamond', serif; font-weight: 300; font-style: italic; color: var(--accent); margin-left: 2px; }

/* ÉCRAN DE CONNEXION */
#lock-screen {
  position: fixed; inset: 0; z-index: 500;
  background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2rem; padding: 2rem;
  text-align: center;
}
#lock-screen p { color: var(--ink-soft); font-size: 0.85rem; max-width: 340px; }
#lock-screen input {
  font-family: 'Jost', sans-serif; font-size: 1rem; padding: 0.8rem 1.1rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 240px; text-align: center;
}
#lock-screen .error { color: var(--red); font-size: 0.8rem; min-height: 1.2em; }
#lock-screen button {
  background: var(--accent); color: #fff; border: none; padding: 0.8rem 2rem;
  border-radius: 30px; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
}

/* HEADER */
.pdt-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding: 1.3rem 1.8rem; background: #fff; border-bottom: 1px solid var(--line);
}
.pdt-header .titles { display: flex; align-items: center; gap: 1rem; }
.pdt-header .titles h1 { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 500; margin: 0; }
.pdt-header .back { color: var(--ink-soft); text-decoration: none; font-size: 0.8rem; }
.pdt-header .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn-sm {
  border: 1px solid var(--line); background: var(--cream); color: var(--ink);
  padding: 0.55rem 1.1rem; border-radius: 30px; font-size: 0.8rem; cursor: pointer;
  font-family: 'Jost', sans-serif;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* STATS */
.pdt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 1.5rem 1.5rem 0; }
.pdt-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.2rem;
}
.pdt-stat .num { font-family: 'Playfair Display', serif; font-size: 1.7rem; }
.pdt-stat .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.pdt-stat.placed .num { color: var(--green); }
.pdt-stat.unplaced .num { color: var(--accent-dark); }
@media (max-width: 640px) { .pdt-stats { grid-template-columns: repeat(2, 1fr); } }

/* LAYOUT */
.pdt-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; padding: 1.5rem; align-items: start; }
@media (max-width: 820px) { .pdt-layout { grid-template-columns: 1fr; } }

.pool-panel {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem;
  position: sticky; top: 1.5rem;
}
.pool-panel h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.3rem; color: var(--ink-soft); }
.pool-count { font-size: 0.78rem; color: var(--accent-dark); margin-bottom: 1rem; }
#guest-pool { display: flex; flex-direction: column; gap: 0.6rem; max-height: 70vh; overflow-y: auto; }
#guest-pool:empty::after { content: 'Tous les invités sont placés 🎉'; color: var(--ink-soft); font-size: 0.82rem; font-style: italic; }

.guest-chip {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--cream); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.55rem 0.7rem; cursor: grab; font-size: 0.82rem;
}
.guest-chip:active { cursor: grabbing; }
.guest-chip.dragging { opacity: 0.4; }
.guest-chip .tag {
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem; border-radius: 20px; color: #fff; flex-shrink: 0;
}
.tag-famille { background: #a3453f; }
.tag-amis { background: #4a7a5c; }
.tag-collegues { background: #6a5ea8; }
.tag-enfant { background: #c48b5a; }
.guest-chip .name { flex: 1; }
.guest-chip .diet-icon { font-size: 0.9rem; }

/* CANVAS */
.canvas-panel { min-height: 60vh; }
.canvas-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.8rem; }
.canvas-toolbar h2 { font-family: 'Playfair Display', serif; font-size: 1.15rem; margin: 0; }

#tables-canvas {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem;
}
.table-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.table-card.dragover { border-color: var(--green); box-shadow: 0 0 0 4px rgba(74,122,92,0.15); }
.table-card.overcapacity-flash { border-color: var(--red); box-shadow: 0 0 0 4px rgba(163,69,63,0.2); animation: flash-red 0.4s ease 2; }
@keyframes flash-red {
  0%, 100% { background: #fff; }
  50% { background: #fbe9e7; }
}
.table-card .table-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.table-card .table-head h3 { font-family: 'Playfair Display', serif; font-size: 1rem; margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.shape-icon { font-size: 0.75rem; color: var(--ink-soft); }
.table-head-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--ink-soft);
  font-size: 0.85rem; padding: 0.2rem 0.35rem; border-radius: 6px; line-height: 1;
}
.icon-btn:hover { background: var(--cream); color: var(--accent-dark); }

.table-card .count { font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 0.6rem; }
.table-card .count.full { color: var(--red); font-weight: 500; }

.occupancy { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-soft); margin-bottom: 0.3rem; }
.occupancy-track { height: 6px; background: var(--cream); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.occupancy-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width 0.2s ease; }

.table-card .seats { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 20px; }
.no-guest { font-size: 0.78rem; color: var(--ink-soft); font-style: italic; margin: 0; }
.seat-guest {
  display: flex; align-items: center; gap: 0.3rem;
  background: var(--cream-dark); border-radius: 20px; padding: 0.3rem 0.6rem;
  font-size: 0.72rem; cursor: grab;
}
.seat-guest button {
  background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 0.85rem; line-height: 1; padding: 0;
}

.add-table-card {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line); border-radius: 18px; min-height: 160px;
  color: var(--ink-soft); cursor: pointer; font-size: 0.85rem; background: transparent;
}
.add-table-card:hover { border-color: var(--accent); color: var(--accent); }

/* MODAL AJOUT TABLE */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 300;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 2rem; width: min(360px, 90vw);
}
.modal h3 { font-family: 'Playfair Display', serif; margin: 0 0 1.2rem; font-size: 1.1rem; }
.modal .field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.modal label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.modal input, .modal select {
  font-family: 'Jost', sans-serif; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px;
}
.modal .modal-actions { display: flex; gap: 0.6rem; margin-top: 1.2rem; }
.modal .modal-actions button { flex: 1; }

.pdt-footer-note {
  padding: 1.5rem; text-align: center; font-size: 0.78rem; color: var(--ink-soft);
}

@media print {
  #lock-screen, .dash-sidebar, .pdt-stats, .pool-panel, .canvas-toolbar, .add-table-card,
  .table-head-actions, .seat-guest button, .pdt-footer-note,
  .pdt-header .actions, .modal-backdrop { display: none !important; }
  .pdt-layout { grid-template-columns: 1fr; padding: 0; }
  .table-card { break-inside: avoid; border: 1px solid #999; }
  body { background: #fff; }
}
