:root {
  /* Palet geïnspireerd op retro Italiaanse trattoria-stijl */
  --cream: #f4e7d4;
  --cream-deep: #ead6bb;
  --paper: #fbf4ea;
  --tomato: #d4471c;
  --tomato-hover: #e0582c;
  --wine: #5b1a10;
  --wine-soft: #7a2a1c;
  --basil: #2f8a5b;
  --mustard: #e2a326;
  --ink: #3a160d;

  --bg: var(--cream);
  --bg-card: rgba(251, 244, 234, 0.92);
  --bg-card-hover: #fffaf2;
  --text-main: var(--ink);
  --text-muted: #8a6552;
  --accent: var(--tomato);
  --accent-hover: var(--tomato-hover);
  --accent-gold: var(--mustard);
  --accent-green: var(--basil);
  --border: rgba(91, 26, 16, 0.14);
  --border-focus: rgba(212, 71, 28, 0.55);
  --shadow: 0 10px 28px rgba(91, 26, 16, 0.14);
  --shadow-pop: 4px 4px 0 var(--wine);
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* UI Overlay */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem;
}

.interactive {
  pointer-events: auto;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.brand {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  padding: 1.1rem 1.5rem 1.2rem;
  border-radius: 1.5rem;
  border: 2px solid var(--wine);
  box-shadow: var(--shadow-pop);
  max-width: 500px;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 900;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  color: var(--tomato);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--wine-soft);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  gap: 0.6rem;
}

.btn-icon {
  background: var(--paper);
  border: 2px solid var(--wine);
  color: var(--ink);
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 1.1rem;
  box-shadow: 3px 3px 0 var(--wine);
}

.btn-icon:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--wine);
}

/* Event Status Badge */
.event-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--basil);
  color: var(--paper);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--paper);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Bottom Hint & Controls */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.hint-pill {
  background: var(--wine);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}

.hint-pill strong {
  color: var(--mustard);
}

.controls-group {
  display: flex;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--tomato);
  color: var(--paper);
  border: 2px solid var(--wine);
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  box-shadow: 3px 3px 0 var(--wine);
}

.btn-primary:hover {
  background: var(--tomato-hover);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--wine);
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--wine);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--wine);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 3px 3px 0 var(--wine);
}

.btn-secondary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--wine);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(91, 26, 16, 0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--paper);
  border: 2px solid var(--wine);
  border-radius: 1.75rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 8px 8px 0 var(--wine);
  padding: 2rem;
  position: relative;
  transform: scale(0.95) translateY(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--cream);
  border: 2px solid var(--wine);
  color: var(--wine);
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--tomato);
  color: var(--paper);
}

.modal-header .event-badge {
  background: var(--mustard);
  color: var(--wine);
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-variation-settings: "SOFT" 100;
  font-size: 2rem;
  line-height: 1.05;
  color: var(--tomato);
  margin-bottom: 0.4rem;
}

.modal-header p {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--wine-soft);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 1.5rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wine);
  margin-bottom: 0.5rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #fff;
  border: 2px solid var(--cream-deep);
  border-radius: 0.9rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--tomato);
  box-shadow: 0 0 0 3px rgba(212, 71, 28, 0.18);
}

/* Dish Selection Cards */
.dish-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dish-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: #fff;
  border: 2px solid var(--cream-deep);
  border-radius: 1.1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dish-card:hover {
  border-color: var(--mustard);
}

.dish-card.selected {
  background: #fff3e6;
  border-color: var(--tomato);
  box-shadow: 3px 3px 0 var(--tomato);
}

.dish-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.dish-info h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.dish-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Date Checkboxes */
.date-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.date-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 2px solid var(--cream-deep);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  transition: all 0.2s;
}

.date-pill input {
  accent-color: var(--basil);
  cursor: pointer;
}

.date-pill.checked {
  background: var(--basil);
  border-color: var(--basil);
  color: var(--paper);
}

/* List / Grid View Overlay */
.list-view-container {
  position: absolute;
  inset: 0;
  background: var(--cream);
  z-index: 5; /* onder de header, zodat de wisselknop bereikbaar blijft */
  overflow-y: auto;
  padding: 15rem 1.5rem 6rem 1.5rem;
  display: none;
}

.list-view-container.active {
  display: block;
}

.list-view-container h2 {
  color: var(--tomato) !important;
  font-weight: 900;
  font-size: 2.4rem !important;
}

.seats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: 900px;
  margin: 1.5rem auto 0 auto;
}

.seat-card {
  background: var(--paper);
  border: 2px solid var(--wine);
  border-radius: 1.4rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-pop);
  transition: transform 0.2s;
}

.seat-card strong {
  font-family: var(--font-serif);
}

/* Kleurband bovenaan elke kaart, zoals de gerechtkaarten in de referentie */
.seat-card.free:nth-child(3n+1) { border-top: 14px solid var(--basil); }
.seat-card.free:nth-child(3n+2) { border-top: 14px solid var(--tomato); }
.seat-card.free:nth-child(3n+3) { border-top: 14px solid var(--mustard); }
.seat-card.booked { border-top: 14px solid var(--wine); background: #f7ebdc; }

.seat-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-free {
  background: var(--basil);
  color: var(--paper);
}

.badge-booked {
  background: var(--wine);
  color: var(--cream);
}

/* Admin Dashboard Specific */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 2px solid var(--cream-deep);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--tomato);
  border-color: var(--wine);
  color: var(--paper);
}

.stats-card {
  background: #fff;
  border: 2px solid var(--cream-deep);
  border-radius: 1.1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.stats-card h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wine);
  margin-bottom: 0.75rem;
}

.tally-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--cream-deep);
  font-size: 0.9rem;
}

.tally-badge {
  background: var(--tomato);
  color: var(--paper);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--wine);
  color: var(--cream);
  border: 2px solid var(--wine);
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--tomato);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
  .ui-layer {
    padding: 1rem;
  }
  header {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .header-actions {
    justify-content: flex-end;
  }
  .brand {
    padding: 0.85rem 1.1rem;
  }
  .brand-title {
    font-size: 1.9rem;
  }
  .brand-subtitle {
    display: none;
  }
  .hint-pill {
    font-size: 0.78rem;
    padding: 0.55rem 0.9rem;
  }
  .modal-card {
    padding: 1.5rem;
    border-radius: 1.4rem;
  }
  .list-view-container {
    padding-top: 13rem;
  }
}

/* Smalle, warme scrollbalk in vensters en lijst */
.modal-card, .list-view-container {
  scrollbar-width: thin;
  scrollbar-color: var(--cream-deep) transparent;
}

/* Profielbadge (eigen inschrijving op dit toestel) */
.profile-badge {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--wine);
  border-radius: 999px;
  padding: 0.25rem 1rem 0.25rem 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  box-shadow: 3px 3px 0 var(--wine);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-badge[hidden] {
  display: none;
}

.profile-badge:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--wine);
}

.profile-avatar {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  border: 2px solid var(--wine);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-link-danger {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: none;
  border: none;
  color: var(--tomato);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.btn-link-danger[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .profile-name {
    display: none;
  }
  .profile-badge {
    padding: 0.25rem;
  }
}

/* Personage-editor & portretten */
.profile-avatar {
  overflow: hidden;
}

.profile-avatar img {
  width: 135%;
  height: 135%;
  object-fit: cover;
}

.list-avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 2px solid var(--wine);
  background: var(--cream-deep);
  object-fit: cover;
}

.avatar-editor {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.avatar-preview {
  flex: 0 0 150px;
  height: 210px;
  border-radius: 1rem;
  border: 2px solid var(--border);
  background: radial-gradient(circle at 50% 35%, #fffaf2, var(--cream-deep));
  overflow: hidden;
}

.avatar-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.avatar-row-label {
  flex: 0 0 3.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.avatar-row-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.avatar-swatch {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}

.avatar-swatch.selected {
  border-color: var(--wine);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--tomato);
}

.avatar-chip {
  border: 2px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.avatar-chip.selected {
  border-color: var(--tomato);
  background: var(--tomato);
  color: #fff;
}

.avatar-shuffle {
  align-self: flex-start;
  margin-top: 0.2rem;
}

@media (max-width: 640px) {
  .avatar-editor {
    flex-direction: column;
  }
  .avatar-preview {
    flex-basis: auto;
    height: 190px;
  }
}
