/* ─── PUXLIN EDITOR STYLES — mobile-first ───────────────────────────── */

/* ─── PAGE LAYOUT ───────────────────────────────────────────────────── */
html, body { height: 100%; }

.editor-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-section);
}

/* ─── TEMPLATE CANVAS ───────────────────────────────────────────────── */
.canvas-wrap {
  padding: 1rem;
  display: flex;
  justify-content: center;
  background: var(--bg-dark);
}

.template-canvas {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  background: #1a1a2e;
  touch-action: manipulation;
}

/* ─── TEMPLATE LAYERS ───────────────────────────────────────────────── */
.tpl-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.tpl-overlay {
  position: absolute;
  inset: 0;
}

.tpl-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

/* ─── BRAND NAME IN TEMPLATE ────────────────────────────────────────── */
.tpl-brand {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(14px, 4.5vw, 22px);
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  margin-bottom: auto;
}

.tpl-brand.pos-bottom {
  margin-bottom: 0;
  margin-top: auto;
}

/* ─── EDITABLE TEXT FIELDS IN TEMPLATE ──────────────────────────────── */
.tpl-field {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  cursor: pointer;
  border-radius: 6px;
  transition: outline .15s;
  outline: 2px solid transparent;
  outline-offset: 3px;
  -webkit-tap-highlight-color: transparent;
}
.tpl-field:focus,
.tpl-field.active { outline-color: rgba(255,255,255,.7); }

.tpl-field--title {
  font-size: clamp(22px, 8vw, 42px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: .35rem;
}
.tpl-field--price {
  font-size: clamp(18px, 6vw, 32px);
  font-weight: 800;
  color: #ffe066;
}
.tpl-field--desc {
  font-size: clamp(11px, 3vw, 15px);
  font-weight: 500;
  opacity: .9;
  line-height: 1.4;
}
.tpl-field--subtitle {
  font-size: clamp(14px, 4vw, 20px);
  font-weight: 700;
}
.tpl-field--body {
  font-size: clamp(11px, 3vw, 15px);
  font-weight: 400;
  line-height: 1.5;
  opacity: .9;
}

/* ─── IMAGE UPLOAD ZONE ─────────────────────────────────────────────── */
.tpl-image-zone {
  position: absolute;
  inset: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tpl-image-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tpl-image-zone .img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: rgba(255,255,255,.08);
  border: 2px dashed rgba(255,255,255,.3);
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  font-size: .82rem;
  transition: background .2s;
}
.tpl-image-zone:active .img-placeholder,
.tpl-image-zone:hover .img-placeholder {
  background: rgba(255,255,255,.14);
}
.tpl-image-zone .img-placeholder .img-icon { font-size: 1.8rem; }
.tpl-image-zone .img-placeholder span { font-weight: 600; }

/* ─── CONTROLS PANEL ────────────────────────────────────────────────── */
.controls-panel {
  background: #fff;
  border-top: 1px solid var(--border);
  flex: 1;
}

.controls-scroll {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ─── FIELD CONTROLS ────────────────────────────────────────────────── */
.field-control {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.field-control label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.field-control input,
.field-control textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .95rem;
  color: var(--text-dark);
  background: var(--bg-section);
  transition: border-color .2s;
  -webkit-appearance: none;
}
.field-control input:focus,
.field-control textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.field-control textarea {
  resize: none;
  rows: 3;
  line-height: 1.5;
}

/* ─── IMAGE UPLOAD CONTROL ──────────────────────────────────────────── */
.image-control {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.image-control label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.image-upload-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--bg-section);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.image-upload-btn:active,
.image-upload-btn:hover {
  border-color: var(--primary);
  background: rgba(182,0,255,.04);
}
.image-upload-btn .upload-icon { font-size: 1.25rem; }
.image-upload-btn .upload-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--primary);
}
.image-upload-btn.has-image .upload-text { color: var(--text-dark); }
.image-preview-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── DIVIDER ───────────────────────────────────────────────────────── */
.controls-divider {
  height: 1px;
  background: var(--border);
  margin: .25rem 0;
}

/* ─── EXPORT SECTION ────────────────────────────────────────────────── */
.export-section {
  padding: 1rem;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.btn-export {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 1rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(182,0,255,.35);
  -webkit-tap-highlight-color: transparent;
}
.btn-export:active {
  background: var(--primary-dark);
  transform: scale(.98);
}
.btn-export:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.btn-export .export-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── IOS SAVE HINT ─────────────────────────────────────────────────── */
.ios-hint {
  display: none;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .82rem;
  color: var(--text-gray);
  text-align: center;
  line-height: 1.5;
}
.ios-hint.visible { display: block; }

/* ─── APP CTA IN EXPORT SECTION ─────────────────────────────────────── */
.app-nudge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-gray);
  text-align: center;
}
.app-nudge a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

/* ─── INLINE EDITOR OVERLAY ─────────────────────────────────────────── */
.edit-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,0,20,.85);
  z-index: 200;
  align-items: flex-end;
  padding: 0;
}
.edit-overlay.open { display: flex; }

.edit-sheet {
  width: 100%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 1.25rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.edit-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto .5rem;
}
.edit-sheet-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.edit-sheet-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-dark);
  background: #fff;
  -webkit-appearance: none;
}
.edit-sheet-input:focus { outline: none; }
.edit-sheet-done {
  width: 100%;
  padding: .875rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── SECTOR OVERVIEW PAGE ──────────────────────────────────────────── */
.sector-header {
  background: var(--bg-dark);
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
}
.sector-header .sector-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.sector-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .3rem;
}
.sector-header p {
  font-size: .88rem;
  color: rgba(255,255,255,.65);
  max-width: 320px;
  margin: 0 auto;
}

.templates-list {
  flex: 1;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  align-content: start;
}

/* ─── ENTRY PAGE ────────────────────────────────────────────────────── */
.entry-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-dark);
}
.entry-hero {
  padding: 2rem 1.25rem 1.5rem;
  text-align: center;
}
.entry-hero .logo-wrap img { height: 36px; width: auto; margin-bottom: 1.25rem; }
.entry-hero h1 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: .5rem;
  line-height: 1.2;
}
.entry-hero p {
  font-size: .92rem;
  color: rgba(255,255,255,.65);
  max-width: 300px;
  margin: 0 auto;
}
.entry-partner-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.1);
  border-radius: 20px;
  padding: .3rem .75rem;
  margin-bottom: 1rem;
}
.entry-partner-badge img { height: 18px; width: auto; }
.entry-partner-badge span {
  font-size: .78rem;
  color: rgba(255,255,255,.7);
  font-weight: 600;
}

.entry-form {
  background: #fff;
  border-radius: 20px 20px 0 0;
  flex: 1;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.entry-form-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
  display: block;
}
.entry-name-input {
  width: 100%;
  padding: .875rem 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--bg-section);
  -webkit-appearance: none;
  transition: border-color .2s;
}
.entry-name-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}
.entry-name-input::placeholder { font-weight: 400; color: #b0b0c0; }

.sector-label { font-size: .78rem; font-weight: 700; color: var(--text-gray); text-transform: uppercase; letter-spacing: .06em; }

.entry-sector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
.entry-sector-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--bg-section);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .5rem;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.entry-sector-card:hover,
.entry-sector-card:active {
  border-color: var(--primary);
  background: rgba(182,0,255,.05);
  transform: scale(.97);
}
.entry-sector-card.selected {
  border-color: var(--primary);
  background: rgba(182,0,255,.08);
}
.entry-sector-card .es-icon { font-size: 1.75rem; }
.entry-sector-card .es-name {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  line-height: 1.2;
}

.entry-submit {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(182,0,255,.35);
  transition: background .2s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.entry-submit:active { background: var(--primary-dark); transform: scale(.98); }
.entry-submit:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ─── TEMPLATE THEMES ───────────────────────────────────────────────── */
/* Dark purple (default / restaurant) */
.theme-purple .tpl-overlay {
  background: linear-gradient(160deg, rgba(146,0,204,.85) 0%, rgba(13,0,20,.92) 100%);
}
/* Warm orange (frituur) */
.theme-orange .tpl-overlay {
  background: linear-gradient(160deg, rgba(217,119,6,.88) 0%, rgba(20,10,0,.92) 100%);
}
/* Red (pizzeria) */
.theme-red .tpl-overlay {
  background: linear-gradient(160deg, rgba(220,38,38,.88) 0%, rgba(20,0,0,.92) 100%);
}
/* Green (kebab) */
.theme-green .tpl-overlay {
  background: linear-gradient(160deg, rgba(5,150,105,.88) 0%, rgba(0,15,8,.92) 100%);
}
/* Amber (hamburger) */
.theme-amber .tpl-overlay {
  background: linear-gradient(160deg, rgba(180,83,9,.88) 0%, rgba(15,8,0,.92) 100%);
}
/* Navy blue (brasserie) */
.theme-navy .tpl-overlay {
  background: linear-gradient(160deg, rgba(29,78,216,.88) 0%, rgba(0,5,20,.92) 100%);
}
/* Pink (fastfood) */
.theme-pink .tpl-overlay {
  background: linear-gradient(160deg, rgba(190,24,93,.88) 0%, rgba(15,0,10,.92) 100%);
}
/* Teal (wereldkeuken) */
.theme-teal .tpl-overlay {
  background: linear-gradient(160deg, rgba(15,118,110,.88) 0%, rgba(0,12,10,.92) 100%);
}

/* ─── RESPONSIVE — LARGE SCREENS ────────────────────────────────────── */
@media (min-width: 600px) {
  .template-canvas { max-width: 460px; }
  .export-section, .controls-scroll { max-width: 540px; }
  .templates-list { max-width: 540px; grid-template-columns: repeat(3, 1fr); }
  .entry-sector-grid { grid-template-columns: repeat(4, 1fr); }
}
