/* ===== VARIABLES ===== */
:root {
  --flame-red: #E63946;
  --mustard: #F4A261;
  --sun-yellow: #FFD166;
  --grass-green: #06D6A0;
  --sky-blue: #118AB2;
  --charcoal: #2B2D42;
  --cream: #FFF8E7;
  --white: #ffffff;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #e0f2fe 0%, var(--cream) 40%, #fef3c7 100%);
  color: var(--charcoal);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--charcoal);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 10000;
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 0;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 { font-family: 'Fredoka', 'Nunito', sans-serif; }

/* ===== GATE ===== */
.gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 30%, #fef3c7 80%, var(--cream) 100%);
  align-items: center;
  justify-content: center;
}
.gate.active {
  display: flex;
}
.gate-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 380px;
  width: 90%;
  animation: fadeIn 0.4s ease;
}
.gate-grill { opacity: 0.6; margin-bottom: 12px; }
.gate-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  color: var(--charcoal);
  margin-bottom: 4px;
}
.gate-subtitle {
  color: #6b7280;
  margin-bottom: 20px;
  font-size: 0.95rem;
}
#gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#gate-code {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: border-color var(--transition);
}
#gate-code:focus {
  outline: none;
  border-color: var(--mustard);
  box-shadow: 0 0 0 3px rgba(244, 162, 97, 0.15);
}
.gate-error {
  color: var(--flame-red);
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.2em;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.4s ease;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--grass-green); color: var(--white); }
.toast-error { background: var(--flame-red); color: var(--white); }

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 248, 231, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(244, 162, 97, 0.2);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--charcoal);
  text-decoration: none;
}
.logo-flame { flex-shrink: 0; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav-link {
  padding: 6px 14px;
  border-radius: 99px;
  text-decoration: none;
  color: var(--charcoal);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover { background: rgba(244, 162, 97, 0.15); }
.nav-link.active { background: var(--flame-red); color: var(--white); }
.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 2px solid var(--grass-green);
  background: transparent;
  color: var(--grass-green);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 4px;
}
.btn-share:hover {
  background: var(--grass-green);
  color: var(--white);
}
.btn-share svg { flex-shrink: 0; }

/* ===== HERO ===== */
.hero {
  position: relative;
  padding: 60px 20px 40px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 30%, #fef3c7 80%, var(--cream) 100%);
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-sun {
  position: absolute;
  top: 10px;
  right: 30px;
  animation: spin 30s linear infinite;
}
.hero-grill {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.12;
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero-title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  color: var(--charcoal);
  text-shadow: 2px 2px 0 rgba(255,209,102,0.4);
  line-height: 1.1;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--flame-red);
  font-weight: 700;
  margin-bottom: 4px;
}
.hero-drinks {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--charcoal);
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 18px;
}
.hero-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}
.hero-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.7);
  padding: 8px 16px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--charcoal);
}
.hero-detail svg { color: var(--flame-red); flex-shrink: 0; }

.hero-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.deco {
  position: absolute;
  opacity: 0.15;
}
.deco-ketchup { bottom: 20px; left: 8%; transform: rotate(-15deg); }
.deco-mustard { bottom: 30px; left: 18%; transform: rotate(10deg); }
.deco-beer { top: 40px; left: 10%; transform: rotate(-8deg); }
.deco-sausage { top: 30%; right: 8%; transform: rotate(25deg); animation: wiggle 3s ease-in-out infinite; }

/* ===== MAIN ===== */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

.section-title {
  font-size: 1.8rem;
  color: var(--charcoal);
  margin: 32px 0 20px;
  text-align: center;
}

/* ===== SUMMARY ===== */
.summary-box {
  background: var(--white);
  border: 2px solid rgba(244, 162, 97, 0.3);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}
.summary-box strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--flame-red);
}
.summary-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.summary-item {
  background: var(--cream);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--charcoal);
}
.summary-side { background: #dcfce7; color: #166534; }
.summary-sides {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  text-align: left;
}
.summary-sides strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: #166534;
}
.sides-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.side-chip {
  background: #dcfce7;
  color: #166534;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
}
.side-chip small {
  font-weight: 400;
  opacity: 0.7;
}

/* ===== GUEST GRID ===== */
.guest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.guest-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition);
}
.guest-card:hover {
  border-color: var(--mustard);
  transform: translateY(-2px);
}
.guest-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 10px;
}
.guest-foods {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.food-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #92400e;
}
.food-icon { width: 18px; height: 18px; flex-shrink: 0; }
.guest-side {
  font-size: 0.85rem;
  color: #166534;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 99px;
  display: inline-block;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}
.empty-grill { width: 100px; height: 100px; opacity: 0.3; margin-bottom: 16px; }
.empty-state p { color: #9ca3af; font-size: 1.1rem; }

.loading {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

.error {
  color: var(--flame-red);
  text-align: center;
  padding: 20px;
  grid-column: 1 / -1;
}

/* ===== FORMS ===== */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 540px;
  margin: 0 auto;
}
.form-hint {
  color: #6b7280;
  margin-bottom: 20px;
  text-align: center;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.form-group label small {
  font-weight: 400;
  color: #9ca3af;
}
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background: var(--white);
}
.form-group input:focus {
  outline: none;
  border-color: var(--mustard);
  box-shadow: 0 0 0 3px rgba(244, 162, 97, 0.15);
}
.input-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Conditional fields */
.conditional {
  max-height: 0;
  overflow: hidden;
  margin-bottom: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}
.conditional.visible {
  max-height: 120px;
  opacity: 1;
  margin-bottom: 20px;
}

/* Person stepper */
.person-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.person-count {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  color: var(--charcoal);
}
.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--flame-red);
  background: var(--white);
  color: var(--flame-red);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.stepper-btn:hover:not(:disabled) {
  background: var(--flame-red);
  color: var(--white);
}
.stepper-btn:active:not(:disabled) {
  transform: scale(0.92);
}
.stepper-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Portion progress */
.portion-progress {
  margin-bottom: 12px;
  text-align: center;
}
.portion-progress span {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--charcoal);
}
.progress-track {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--grass-green);
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}
.progress-bar.bar-full {
  background: var(--flame-red);
}

/* Food steppers */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.food-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}
.food-stepper[data-count]:not([data-count="0"]) {
  border-color: var(--flame-red);
  background: #fef2f2;
}
.food-stepper-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.food-stepper-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.food-stepper .stepper-btn {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}
.stepper-count {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  color: #9ca3af;
}
.stepper-count.has-count {
  color: var(--flame-red);
}
.person-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--mustard);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 99px;
  vertical-align: middle;
}

/* Side picker */
.side-picker {
  display: none;
  margin-bottom: 12px;
}
.side-picker.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}
.side-picker-label {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 8px;
}
.side-picker-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.side-option {
  padding: 8px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 99px;
  background: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--charcoal);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.side-option:hover {
  border-color: var(--grass-green);
}
.side-option.selected {
  border-color: var(--grass-green);
  background: #dcfce7;
  color: #166534;
}
.side-option-custom {
  border-style: dashed;
  color: #6b7280;
}
.side-option-custom.selected {
  border-color: var(--mustard);
  border-style: solid;
  background: #fef3c7;
  color: #92400e;
}
.side-custom-wrap {
  display: none;
}
.side-custom-wrap.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Toggle */
.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600 !important;
}
.toggle-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--grass-green);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: 99px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--flame-red);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}
.btn-primary:hover:not(:disabled) {
  background: #c1121f;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.4);
}
.btn-hero {
  font-size: 1.2rem;
  padding: 14px 36px;
  animation: pulse 2s ease-in-out infinite;
}
.btn-danger {
  background: var(--white);
  color: var(--danger);
  border: 2px solid var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
}
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Edit section */
.edit-section {
  display: none;
  margin-top: 20px;
}
.edit-section.visible { display: block; animation: fadeIn 0.3s ease; }
.hidden { display: none !important; }

/* ===== ADMIN PANEL ===== */
.admin-panel {
  display: none;
}
.admin-panel.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}
.admin-section {
  margin-bottom: 28px;
}
.admin-section h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--charcoal);
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(244, 162, 97, 0.2);
}
.admin-guest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.admin-guest-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.admin-guest-info strong {
  color: var(--charcoal);
}
.admin-guest-foods {
  font-size: 0.85rem;
  color: #6b7280;
}
.admin-guest-custom {
  font-size: 0.85rem;
  color: var(--mustard);
  font-style: italic;
}
.admin-guest-side {
  font-size: 0.85rem;
  color: #166534;
  font-weight: 600;
}
.btn-sm {
  padding: 4px 12px;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.export-box {
  background: var(--white);
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
  color: var(--charcoal);
}
.nav-admin {
  background: var(--charcoal);
  color: var(--white) !important;
}
.nav-admin:hover {
  background: #3d3f5c;
}
.nav-admin.active {
  background: var(--charcoal);
}
.admin-trigger {
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.3;
  padding: 8px;
  transition: opacity var(--transition);
}
.admin-trigger:hover {
  opacity: 0.8;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 0.9rem;
}
.footer-deco {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(-15px); opacity: 0.2; }
}

/* Smoke animation */
.smoke { animation: float 3s ease-in-out infinite; }
.smoke.s1 { animation-delay: 0s; }
.smoke.s2 { animation-delay: 0.8s; }
.smoke.s3 { animation-delay: 1.6s; }

/* Sun rays rotation */
.sun-rays {
  transform-origin: center;
  animation: spin 30s linear infinite;
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}
.btn:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(244, 162, 97, 0.2);
}
.nav-link:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}
.food-stepper .stepper-btn:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 8px; }
  .nav { width: 100%; justify-content: center; }
  .nav-link { font-size: 0.8rem; padding: 6px 10px; }
  .hero { padding: 40px 16px 30px; min-height: 350px; }
  .hero-sun { width: 70px; height: 70px; top: 5px; right: 10px; }
  .hero-title { font-size: 2.2rem; }
  .hero-deco { display: none; }
  .food-grid { grid-template-columns: 1fr; }
  .guest-grid { grid-template-columns: 1fr; }
  .form-card { padding: 20px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .guest-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 901px) {
  .deco { opacity: 0.2; }
}
