/* ==========================================================================
   WHIMSICAL WEDDING BAR MENU TEMPLATE — EDITOR & PREVIEW
   ========================================================================== */

:root {
  --editor-width: 360px;
  --bg-app: #F5F3EE;
  --bg-editor: #FFFFFF;
  --text-editor: #2D2926;
  --border-editor: #E5E0DA;
  --accent-editor: #C47A5A;

  /* Menu card defaults */
  --menu-bg: #FFF8F0;
  --menu-text: #2D2926;
  --menu-accent: #C47A5A;
  --menu-illus: #C47A5A;
}

/* Size dimensions in px at 96 DPI (for screen preview) */
/* Actual export uses higher DPI */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg-app);
  color: var(--text-editor);
  display: flex;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ==========================================================================
   EDITOR PANEL
   ========================================================================== */

.editor-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--editor-width);
  height: 100dvh;
  background: var(--bg-editor);
  border-right: 1px solid var(--border-editor);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.editor-panel.collapsed {
  transform: translateX(calc(-1 * var(--editor-width)));
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-editor);
}

.editor-header h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.editor-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-editor);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-editor);
  transition: all 0.2s;
}
.editor-toggle:hover { background: #F5F3EE; }
.editor-panel.collapsed .editor-toggle svg { transform: rotate(180deg); }

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.editor-section {
  margin-bottom: 24px;
}

.editor-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8A8580;
  margin-bottom: 8px;
}

.editor-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-editor);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #FAFAF8;
  transition: border-color 0.2s;
}
.editor-input:focus {
  outline: none;
  border-color: var(--accent-editor);
}

/* Color inputs */
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-row input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border-editor);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}
.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-row input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: none; }

.color-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-editor);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'DM Sans', monospace;
  background: #FAFAF8;
}
.color-input:focus { outline: none; border-color: var(--accent-editor); }

/* Size buttons */
.size-buttons {
  display: flex;
  gap: 8px;
}
.size-btn {
  flex: 1;
  padding: 8px 0;
  border: 1px solid var(--border-editor);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  color: var(--text-editor);
  transition: all 0.2s;
}
.size-btn:hover { background: #F5F3EE; }
.size-btn.active {
  background: var(--accent-editor);
  color: white;
  border-color: var(--accent-editor);
}

/* Color presets */
.preset-row {
  display: flex;
  gap: 8px;
}
.preset-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-editor);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.preset-btn:hover { transform: scale(1.1); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.preset-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

/* Drink editor */
.drink-item {
  margin-bottom: 14px;
  padding: 12px;
  background: #FAFAF8;
  border: 1px solid var(--border-editor);
  border-radius: 10px;
  position: relative;
}

.drink-item .drink-name {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 0 0 6px 0;
  border-bottom: 1px solid #EDE9E3;
}
.drink-item .drink-name:focus { outline: none; }

.drink-item .drink-desc {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 0 0 0;
  resize: none;
  min-height: 44px;
  line-height: 1.4;
  color: #6B6560;
}
.drink-item .drink-desc:focus { outline: none; }

.add-drink-btn, .add-item-btn {
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--accent-editor);
  cursor: pointer;
  padding: 6px 12px;
  border: 1px dashed var(--accent-editor);
  border-radius: 6px;
  background: transparent;
  transition: all 0.2s;
}
.add-drink-btn:hover, .add-item-btn:hover {
  background: rgba(196,122,90,0.06);
}

/* Simple list inputs */
.simple-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.list-item-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-editor);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #FAFAF8;
}
.list-item-input:focus { outline: none; border-color: var(--accent-editor); }

/* Action buttons */
.actions { margin-top: 10px; }

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-editor);
  color: white;
  border: none;
  margin-bottom: 10px;
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  background: transparent;
  color: var(--text-editor);
  border: 1px solid var(--border-editor);
}
.btn-secondary:hover { background: #F5F3EE; }

/* Mobile toggle */
.mobile-editor-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 12px 24px;
  background: var(--accent-editor);
  color: white;
  border: none;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(196,122,90,0.3);
}

/* ==========================================================================
   PREVIEW AREA
   ========================================================================== */

.preview-area {
  flex: 1;
  margin-left: var(--editor-width);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 100dvh;
  transition: margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.editor-panel.collapsed ~ .preview-area {
  margin-left: 0;
}

.preview-wrapper {
  position: relative;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.08));
}

/* ==========================================================================
   MENU CARD — THE ACTUAL TEMPLATE
   ========================================================================== */

.menu-card {
  position: relative;
  background: var(--menu-bg);
  color: var(--menu-text);
  overflow: hidden;
  /* Default 5x7 */
  width: 350px;
  height: 490px;
}

/* Sizes at screen preview scale */
.menu-card[data-size="5x7"]  { width: 350px; height: 490px; }
.menu-card[data-size="8x10"] { width: 480px; height: 600px; }
.menu-card[data-size="a4"]   { width: 496px; height: 702px; }
.menu-card[data-size="18x24"]{ width: 450px; height: 600px; }

/* Corner decorations */
.corner-deco {
  position: absolute;
  width: 60px;
  height: 60px;
  color: var(--menu-illus);
  pointer-events: none;
}
.top-left     { top: 8px; left: 8px; }
.top-right    { top: 8px; right: 8px; }
.bottom-left  { bottom: 8px; left: 8px; }
.bottom-right { bottom: 8px; right: 8px; }

/* Cocktail illustrations */
.illustration {
  position: absolute;
  color: var(--menu-illus);
  opacity: 0.2;
  pointer-events: none;
}

.illus-martini { width: 40px; top: 12%; right: 10%; }
.illus-wine    { width: 32px; bottom: 20%; left: 6%; }
.illus-cocktail{ width: 38px; top: 40%; left: 4%; }
.illus-beer    { width: 34px; bottom: 15%; right: 7%; }

/* Scattered decorations */
.scatter-deco {
  position: absolute;
  pointer-events: none;
  color: var(--menu-illus);
}
.scatter-1 { width: 12px; top: 20%; left: 18%; }
.scatter-2 { width: 16px; top: 55%; right: 12%; }
.scatter-3 { width: 14px; bottom: 35%; left: 14%; }
.scatter-4 { width: 14px; top: 30%; right: 18%; }

/* Content layout */
.menu-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10% 12% 6%;
  text-align: center;
}

/* Header */
.menu-header {
  margin-bottom: auto;
}

.menu-title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2.2em;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--menu-accent);
}

.menu-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65em;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 0.4em;
  opacity: 0.7;
}

.title-rule {
  margin-top: 0.6em;
  display: flex;
  justify-content: center;
}

.wavy-rule {
  width: 100px;
  height: auto;
  color: var(--menu-accent);
  opacity: 0.5;
}

/* Body */
.menu-body {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6em;
}

.section-title {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.15em;
  color: var(--menu-accent);
  margin-bottom: 0.35em;
  letter-spacing: 0.02em;
}

.drinks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.drink-entry {
  margin-bottom: 0.15em;
}

.drink-name-display {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 0.78em;
  letter-spacing: 0.01em;
}

.drink-desc-display {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.55em;
  font-weight: 300;
  opacity: 0.7;
  line-height: 1.4;
  max-width: 90%;
  margin: 0.15em auto 0;
}

.section-divider {
  display: flex;
  justify-content: center;
  padding: 0.15em 0;
  color: var(--menu-accent);
  opacity: 0.35;
}

.section-divider svg {
  width: 60px;
}

/* Two column */
.two-col-section {
  display: flex;
  gap: 2em;
  justify-content: center;
}

.col {
  flex: 1;
  max-width: 45%;
}

.simple-drink-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.simple-drink-list li {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6em;
  font-weight: 400;
  padding: 0.15em 0;
  max-width: none;
}

/* Footer */
.menu-footer {
  margin-top: auto;
  padding-top: 0.5em;
}

.footer-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.5em;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.45;
  max-width: none;
}

.couple-text {
  font-family: 'Caveat', cursive;
  font-size: 0.72em;
  font-weight: 500;
  color: var(--menu-accent);
  margin-top: 0.25em;
  max-width: none;
}

/* ==========================================================================
   SIZE-SPECIFIC SCALING
   ========================================================================== */

.menu-card[data-size="8x10"] .menu-title    { font-size: 2.6em; }
.menu-card[data-size="8x10"] .menu-subtitle { font-size: 0.72em; }
.menu-card[data-size="8x10"] .section-title { font-size: 1.3em; }
.menu-card[data-size="8x10"] .drink-name-display { font-size: 0.88em; }
.menu-card[data-size="8x10"] .drink-desc-display { font-size: 0.62em; }
.menu-card[data-size="8x10"] .simple-drink-list li { font-size: 0.68em; }
.menu-card[data-size="8x10"] .couple-text { font-size: 0.82em; }
.menu-card[data-size="8x10"] .footer-text { font-size: 0.56em; }
.menu-card[data-size="8x10"] .corner-deco { width: 70px; height: 70px; }
.menu-card[data-size="8x10"] .wavy-rule { width: 130px; }
.menu-card[data-size="8x10"] .section-divider svg { width: 80px; }
.menu-card[data-size="8x10"] .illustration { opacity: 0.18; }
.menu-card[data-size="8x10"] .illus-martini { width: 50px; }
.menu-card[data-size="8x10"] .illus-wine    { width: 40px; }
.menu-card[data-size="8x10"] .illus-cocktail{ width: 46px; }
.menu-card[data-size="8x10"] .illus-beer    { width: 42px; }

.menu-card[data-size="a4"] .menu-title    { font-size: 2.8em; }
.menu-card[data-size="a4"] .menu-subtitle { font-size: 0.78em; }
.menu-card[data-size="a4"] .section-title { font-size: 1.4em; }
.menu-card[data-size="a4"] .drink-name-display { font-size: 0.95em; }
.menu-card[data-size="a4"] .drink-desc-display { font-size: 0.68em; }
.menu-card[data-size="a4"] .simple-drink-list li { font-size: 0.72em; }
.menu-card[data-size="a4"] .couple-text { font-size: 0.88em; }
.menu-card[data-size="a4"] .footer-text { font-size: 0.6em; }
.menu-card[data-size="a4"] .corner-deco { width: 80px; height: 80px; }
.menu-card[data-size="a4"] .wavy-rule { width: 140px; }
.menu-card[data-size="a4"] .section-divider svg { width: 90px; }
.menu-card[data-size="a4"] .menu-content { padding: 8% 10% 5%; }
.menu-card[data-size="a4"] .menu-body { gap: 0.8em; }

.menu-card[data-size="18x24"] .menu-title    { font-size: 2.5em; }
.menu-card[data-size="18x24"] .menu-subtitle { font-size: 0.74em; }
.menu-card[data-size="18x24"] .section-title { font-size: 1.35em; }
.menu-card[data-size="18x24"] .drink-name-display { font-size: 0.9em; }
.menu-card[data-size="18x24"] .drink-desc-display { font-size: 0.65em; }
.menu-card[data-size="18x24"] .simple-drink-list li { font-size: 0.7em; }
.menu-card[data-size="18x24"] .couple-text { font-size: 0.85em; }
.menu-card[data-size="18x24"] .footer-text { font-size: 0.58em; }
.menu-card[data-size="18x24"] .corner-deco { width: 75px; height: 75px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
  .editor-panel {
    width: 100%;
    height: 60dvh;
    top: auto;
    bottom: 0;
    border-right: none;
    border-top: 1px solid var(--border-editor);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .editor-panel.open { transform: translateY(0); }
  .editor-panel.collapsed { transform: translateY(100%); }

  .preview-area {
    margin-left: 0;
    padding: 20px;
    padding-bottom: 80px;
  }

  .mobile-editor-btn { display: flex; }

  .menu-card[data-size="8x10"],
  .menu-card[data-size="a4"],
  .menu-card[data-size="18x24"] {
    width: 340px;
    height: auto;
    aspect-ratio: auto;
  }
}

/* ==========================================================================
   EXPORT-ONLY STYLING — hidden on screen, applied during capture
   ========================================================================== */
.menu-card.exporting {
  /* Override screen preview size with print-resolution size */
}

/* ==========================================================================
   ACCESS CODE GATE
   ========================================================================== */

.gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247, 244, 239, 0.97);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gate-overlay.hidden {
  display: none;
}

.gate-card {
  background: #FFFFFF;
  border: 1px solid #E8E3DC;
  border-radius: 20px;
  padding: 48px 44px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.07);
}

.gate-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.gate-title {
  font-family: 'Caveat', cursive;
  font-size: 28px;
  font-weight: 700;
  color: #2D2926;
  margin-bottom: 10px;
}

.gate-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #8A8580;
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: none;
}

.gate-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.gate-code-input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid #E0DAD3;
  border-radius: 10px;
  font-size: 18px;
  font-family: 'DM Sans', monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  background: #FAFAF8;
  transition: border-color 0.2s;
}
.gate-code-input:focus {
  outline: none;
  border-color: #C47A5A;
}
.gate-code-input.error {
  border-color: #D4848C;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.gate-submit-btn {
  padding: 12px 20px;
  background: #C47A5A;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.2s;
  white-space: nowrap;
}
.gate-submit-btn:hover { filter: brightness(1.08); }
.gate-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.gate-error {
  font-size: 13px;
  color: #D4848C;
  min-height: 20px;
  margin-bottom: 6px;
}

.gate-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: #C5BEB6;
  font-size: 13px;
}
.gate-divider::before,
.gate-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E8E3DC;
}

.gate-request {
  text-align: center;
}

.gate-request-label {
  font-size: 13px;
  color: #8A8580;
  line-height: 1.5;
  margin-bottom: 14px;
  max-width: none;
}

.gate-request-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1.5px solid #E0DAD3;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  color: #2D2926;
  transition: all 0.2s;
}
.gate-request-btn:hover { background: #F5F1EC; border-color: #C47A5A; }
.gate-request-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.gate-request-note {
  font-size: 13px;
  color: #6C9A8B;
  margin-top: 12px;
  min-height: 20px;
  max-width: none;
}

.gate-powered {
  font-size: 11px;
  color: #C5BEB6;
  margin-top: 28px;
  letter-spacing: 0.05em;
  max-width: none;
}

.download-used-note {
  font-size: 12px;
  color: #6C9A8B;
  text-align: center;
  margin-top: 8px;
}

/* ==========================================================================
   PRINT STYLESHEET — this is what becomes the PDF
   ========================================================================== */

@media print {
  /* Hide everything except the menu card */
  body > *:not(.print-target-wrapper) {
    display: none !important;
  }

  .editor-panel,
  .mobile-editor-btn,
  .gate-overlay,
  .preview-area {
    display: none !important;
  }

  .print-target-wrapper {
    display: block !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: white;
  }

  /* The print clone fills the page exactly */
  #printClone {
    position: fixed;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    overflow: visible;
  }
}

/* The print wrapper — hidden on screen */
.print-target-wrapper {
  display: none;
}
