/* styles.css (compact, uses preview-scoped CSS vars so themes only affect preview pages) */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Montserrat:wght@400;700&family=Poppins:wght@300;400;600;700&family=Playfair+Display:wght@400;700&family=Roboto+Mono:wght@400;700&family=Josefin+Sans:wght@300;400;600&family=Abril+Fatface&family=Pacifico&display=swap');

:root{
  --page-width:760px;
  --page-height:1076px;

  /* preview defaults (overridden by JS) */
  --preview-page-bg: linear-gradient(180deg,#ffffff,#f6f8fb);
  --preview-bg-gradient: linear-gradient(135deg,#a1c4fd 0%, #c2e9fb 100%);
  --preview-decor-gradient: radial-gradient(circle at 10% 15%, rgba(255,255,255,0.06), transparent 25%);
  --preview-page-border-color: rgba(0,0,0,0.06);
  --preview-title-font: 'Montserrat', sans-serif;
  --preview-body-font: 'Poppins', sans-serif;
  --preview-title-color: #092036;
  --preview-body-color: #0f1724;
  --preview-muted-color: #6b7280;
  --preview-section-color: #123042;
  --preview-price-color: #0b4663;
}

/* base */
html,body{height:100%; margin:0;}
body{ font-family:var(--preview-body-font, 'Inter'); background:#f6f7fb; -webkit-font-smoothing:antialiased; color:#0f1724; }

/* layout */
.app{ display:grid; grid-template-columns: 380px 1fr; gap:20px; padding:18px; max-width:1200px; margin:0 auto; align-items:start; }

/* controls */
.controls{ background:#fff; padding:14px; border-radius:12px; box-shadow:0 12px 30px rgba(16,24,40,0.06); border:1px solid rgba(15,23,42,0.03); min-width:0; }
.row.top-controls{ display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.row.top-controls label{ min-width:140px; display:flex; flex-direction:column; }
label.grow{ flex:1; min-width:140px; }
input,select,textarea{ padding:10px; border-radius:10px; border:1px solid rgba(15,23,42,0.06); font-size:14px; background:#fff; min-width:0; }

/* builder */
.builder h2{ margin:8px 0 10px 0; font-size:16px; }
.add-section{ display:flex; gap:8px; margin-bottom:10px; }
.add-section input{ flex:1; }
.sections-list{ display:flex; flex-direction:column; gap:10px; max-height:360px; overflow:auto; padding-right:6px; }
.section-card{ background:linear-gradient(180deg, rgba(255,255,255,0.96), rgba(250,250,250,0.98)); border-radius:10px; padding:10px; border:1px solid rgba(15,23,42,0.03); }
.section-card .section-header{ display:flex; gap:8px; align-items:center; justify-content:space-between; }
.section-card .items{ margin-top:8px; display:flex; flex-direction:column; gap:8px; }
.item-row{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.item-row input[type="text"], .item-row input[type="file"]{ padding:8px; border-radius:8px; border:1px solid rgba(0,0,0,0.06); background:#fff; }
.item-row .item-name{ flex:1 1 160px; min-width:0; }
.item-row .item-price{ width:100px; flex:0 0 auto; }
.item-row .item-desc{ flex:1 1 160px; min-width:0; max-width:200px; }
.item-row .item-img{ flex:1 1 140px; min-width:0; }

/* actions */
.actions{ margin-top:12px; display:flex; gap:8px; flex-wrap:wrap; }
button{ padding:10px 12px; border-radius:10px; border:0; cursor:pointer; font-weight:700; background:linear-gradient(180deg,#eef2f7,#e6eefb); }
button.primary{ background:#2d9cdb; color:#fff; }
button.danger{ background:#ff6b6b; color:#fff; }
.notes{ margin-top:8px; color:#6b7280; font-size:12px; }

/* preview */
.preview{ display:flex; flex-direction:column; gap:8px; }
.preview-top{ display:flex; justify-content:space-between; align-items:center; }
.preview h2{ margin:0; font-size:18px; }
.preview-controls .muted{ color:#6b7280; font-size:13px; }

/* preview area */
.menu-preview{ width:100%; min-width:0; height: calc(100vh - 140px); overflow:auto; display:flex; flex-direction:column; gap:18px; align-items:center; padding:10px 8px; border-radius:10px; }

/* page */
.menu-page{
  width:var(--page-width);
  height:var(--page-height);
  background: var(--preview-page-bg, linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.96)));
  border-radius:10px;
  padding:26px;
  box-shadow:0 10px 30px rgba(16,24,40,0.08);
  border:1px solid rgba(15,23,42,0.04);
  box-sizing:border-box;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  color: var(--preview-body-color, #0f1724);
  font-family: var(--preview-body-font, 'Poppins');
}
.menu-page.page-border{ border:2px solid var(--preview-page-border-color, rgba(0,0,0,0.06)); box-shadow:0 18px 40px rgba(12,18,35,0.10); }

/* header centered */
.page-header{ padding:12px; border-radius:8px; margin-bottom:8px; background: var(--preview-bg-gradient, linear-gradient(135deg,#a1c4fd 0%, #c2e9fb 100%)); position:relative; overflow:hidden; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.page-header::before{ content:''; position:absolute; inset:0; background: var(--preview-decor-gradient, transparent); mix-blend-mode: overlay; opacity:0.95; pointer-events:none; }
.page-title{ font-family: var(--preview-title-font, 'Montserrat'); font-size:26px; font-weight:800; margin:4px 0; color: var(--preview-title-color, #092036); }
.page-sub{ color: var(--preview-muted-color, #6b7280); font-size:12px; }

/* body */
.page-body{ flex:1 1 auto; overflow:hidden; }
.page-section{ margin-top:12px; }
.page-section h3{ margin:0 0 8px 0; font-size:15px; color:var(--preview-section-color, #123042); }
.page-item{ display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:8px 0; border-bottom:1px dashed rgba(0,0,0,0.04); min-width:0; }
.page-item .name{ font-weight:700; color: inherit; }
.page-item .desc{ font-size:13px; color: var(--preview-muted-color, #6b7280); margin-top:6px; }
.page-price{ font-weight:800; white-space:nowrap; color:var(--preview-price-color, #0b4663); min-width:72px; text-align:right; }
.page-item img{ width:64px; height:64px; object-fit:cover; border-radius:8px; margin-right:12px; border:2px solid rgba(0,0,0,0.04); }

/* responsive */
@media (max-width:980px){
  .app{ grid-template-columns:1fr; padding:10px; gap:12px; }
  .menu-preview{ height:calc(100vh - 220px); }
  .sections-list{ max-height:260px; }
}
