/*
 * Scaffold Template — template.css
 * ─────────────────────────────────────────────────────────────────────────────
 * This stylesheet is intentionally bare-bones.
 * It provides structure and layout plumbing only — no decorative colours,
 * no shadows, no rounded corners, no animations beyond a transition hook.
 *
 * All CSS custom properties are set per-instance by the PHP template via an
 * inline <style> block so they can vary per shortcode.
 *
 * CUSTOM PROPERTIES (set per instance in pztp-containers-menu.php):
 *   --sc-accent        Primary highlight / selection colour
 *   --sc-bg            Builder background
 *   --sc-text          Main text colour
 *   --sc-border        Border / divider colour
 *   --sc-font          Font family stack
 *   --sc-font-size     Root font size (applied to .sc-root)
 *   --sc-card-radius   Card corner rounding
 *   --sc-thumb-size    Item thumbnail width/height
 *   --sc-grid-cols     Card grid column template
 *   --sc-anim-speed    Transition duration
 *
 * HOW TO CUSTOMISE:
 *   1. Duplicate this file, rename it, and register the new name via the
 *      'pizzatier_scaffold_partial' filter or by overriding pztp-template-css.php.
 *   2. Or enqueue a child-theme stylesheet that targets .sc-root and its children.
 *   3. Or use the "Custom CSS" field in the Scaffold template settings box.
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── Root container ─────────────────────────────────────────────────────── */
.sc-root {
  box-sizing: border-box;
  font-family: var(--sc-font, inherit);
  font-size:   var(--sc-font-size, 14px);
  color:       var(--sc-text, inherit);
  background:  var(--sc-bg, transparent);
  width: 100%;
}
.sc-root *,
.sc-root *::before,
.sc-root *::after {
  box-sizing: inherit;
}

/* ── Pizza stage ─────────────────────────────────────────────────────────── */
.sc-pizza-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  /* aspect-ratio and border-radius are applied inline per instance */
}

/* Layer images — absolutely stacked */
.sc-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.sc-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
  border-bottom: 1px solid var(--sc-border, currentColor);
}

.sc-tab-btn {
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.875em;
  color: var(--sc-text, inherit);
  transition: color var(--sc-anim-speed, 200ms), border-color var(--sc-anim-speed, 200ms);
}

/* Underline style (default) */
.sc-tab-style--underline .sc-tab-btn {
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.sc-tab-style--underline .sc-tab-btn--active,
.sc-tab-style--underline .sc-tab-btn:focus-visible {
  color: var(--sc-accent, currentColor);
  border-bottom-color: var(--sc-accent, currentColor);
  outline: none;
}

/* Pill style */
.sc-tab-style--pill .sc-tab-btn {
  border-radius: 99px;
  border: 1px solid var(--sc-border, currentColor);
}
.sc-tab-style--pill .sc-tab-btn--active {
  background: var(--sc-accent, currentColor);
  border-color: var(--sc-accent, currentColor);
  color: #fff;
}

/* Box / chip style */
.sc-tab-style--box .sc-tab-btn {
  border: 1px solid var(--sc-border, currentColor);
}
.sc-tab-style--box .sc-tab-btn--active {
  border-color: var(--sc-accent, currentColor);
  color: var(--sc-accent, currentColor);
}

/* ── Panels ──────────────────────────────────────────────────────────────── */
.sc-panel {
  padding: 8px 0;
}
.sc-panel[hidden] {
  display: none;
}

.sc-panel__grid {
  display: grid;
  grid-template-columns: var(--sc-grid-cols, repeat(3, 1fr));
  gap: 8px;
}

.sc-panel__empty {
  color: var(--sc-text, inherit);
  opacity: 0.5;
  font-style: italic;
  margin: 0;
  padding: 8px 0;
}

/* ── Item card ───────────────────────────────────────────────────────────── */
.sc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--sc-border, transparent);
  border-radius: var(--sc-card-radius, 4px);
  cursor: pointer;
  transition: border-color var(--sc-anim-speed, 200ms);
}

.sc-card--selected {
  border-color: var(--sc-accent, currentColor);
}

.sc-card__thumb {
  width:  var(--sc-thumb-size, 56px);
  height: var(--sc-thumb-size, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.sc-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sc-card__thumb--no-image {
  width: 100%;
  height: 100%;
  background: var(--sc-border, #eee);
}

.sc-card__label {
  font-size: 0.8em;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
}

.sc-card__selected-mark {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.8em;
  color: var(--sc-accent, currentColor);
  line-height: 1;
}
.sc-card--selected .sc-card__selected-mark {
  display: block;
}

.sc-card__btn {
  font: inherit;
  font-size: 0.75em;
  cursor: pointer;
  background: none;
  border: 1px solid var(--sc-border, currentColor);
  padding: 2px 8px;
  border-radius: 4px;
  transition: background var(--sc-anim-speed, 200ms), color var(--sc-anim-speed, 200ms);
}
.sc-card__btn:hover {
  background: var(--sc-accent, currentColor);
  color: #fff;
  border-color: var(--sc-accent, currentColor);
}

/* ── Coverage picker ─────────────────────────────────────────────────────── */
.sc-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}
.sc-cov-btn {
  font: inherit;
  font-size: 0.65em;
  padding: 2px 4px;
  cursor: pointer;
  background: none;
  border: 1px solid var(--sc-border, currentColor);
  border-radius: 3px;
  transition: background var(--sc-anim-speed, 200ms);
}
.sc-cov-btn--active,
.sc-cov-btn:focus-visible {
  background: var(--sc-accent, currentColor);
  color: #fff;
  border-color: var(--sc-accent, currentColor);
  outline: none;
}

/* ── Summary panel ───────────────────────────────────────────────────────── */
.sc-panel--summary {
  padding: 8px 0;
}
.sc-summary__heading {
  margin: 0 0 8px;
  font-size: 1em;
  font-weight: 600;
}
.sc-summary__list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
.sc-summary__row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid var(--sc-border, transparent);
  font-size: 0.875em;
}
.sc-summary__layer-type {
  font-weight: 600;
  text-transform: capitalize;
  min-width: 5em;
  flex-shrink: 0;
}
.sc-summary__coverage {
  opacity: 0.6;
  font-size: 0.85em;
  margin-left: auto;
}
.sc-summary__empty {
  opacity: 0.5;
  font-style: italic;
  font-size: 0.875em;
  margin: 0 0 8px;
}
.sc-summary__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sc-summary__reset-btn {
  font: inherit;
  cursor: pointer;
  background: none;
  border: 1px solid var(--sc-border, currentColor);
  padding: 4px 12px;
  font-size: 0.8em;
  border-radius: 4px;
  transition: background var(--sc-anim-speed, 200ms);
}
.sc-summary__reset-btn:hover {
  background: var(--sc-border, #eee);
}

/* ── Responsive — single-column at tablet and smaller (≤ 768px) ─────── */
@media (max-width: 768px) {
  /* Card grid: single column on tablet/mobile */
  .sc-panel__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive — phone (≤ 600px) ───────────────────────────────────── */
@media (max-width: 600px) {
  .sc-root { font-size: 14px; }

  /* Tab bar scrolls horizontally */
  .sc-tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sc-tab-bar::-webkit-scrollbar { display: none; }
  .sc-tab-btn { flex-shrink: 0; white-space: nowrap; }

  /* Summary panel full-width */
  .sc-panel--summary { padding: 12px; }
  .sc-summary__actions { flex-direction: column; }
  .sc-summary__reset-btn { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   SCAFFOLD — TABLET RESPONSIVE (601px – 900px)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 601px) and (max-width: 900px) {
    /* Tab bar stays scrollable but give more padding */
    .sc-tab-bar { padding: 4px 2px; gap: 4px; }
    .sc-tab-btn  { padding: 6px 14px; }

    /* Summary actions horizontal on tablet */
    .sc-summary__actions { flex-direction: row; }
    .sc-summary__reset-btn { width: auto; }
}

/* ══════════════════════════════════════════════════════════════
   SCAFFOLD — CHECKOUT BAR RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 540px) {
    .pztc-checkout-bar--scaffold .pztc-bar-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    .pztc-checkout-bar--scaffold .pztc-bar-row__summary {
        width: 100%;
        flex: none;
    }
    .pztc-checkout-bar--scaffold .pztc-bar-row__btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}


/* ══════════════════════════════════════════════════════════════
   SCAFFOLD — ISSUE FIXES & ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */

/* 1. Show first section at load — ensure sc-panel--active is visible
      even before JS fires, and force first non-size panel visible too */
.sc-panel.sc-panel--active,
.sc-panel--first-visible {
    display: block !important;
}
.sc-panel[hidden]:not(.sc-panel--first-visible) {
    display: none !important;
}

/* 2. Minimal checkout bar — matches Scaffold's token-driven skeleton.
      All colours/geometry inherit the builder instance's --sc-* tokens. */
.pztc-checkout-bar--scaffold {
    background: var(--sc-bg, transparent);
    border: 1px solid var(--sc-border, #cccccc);
    border-radius: var(--sc-card-radius, 6px);
    padding: 12px 14px;
    margin-top: 10px;
    font-family: var(--sc-font, inherit);
    font-size: var(--sc-font-size, 14px);
    color: var(--sc-text, inherit);
}
.pztc-checkout-bar--scaffold .pztc-bar-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__size-label {
    font-size: 0.875em;
    opacity: 0.7;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__price {
    font-size: 18px;
    font-weight: 700;
    color: var(--sc-accent, #333);
}

/* Quantity stepper — token-driven, no decorative flourish */
.pztc-checkout-bar--scaffold .pztc-bar-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--sc-border, #cccccc);
    border-radius: var(--sc-card-radius, 4px);
    overflow: hidden;
}
.pztc-checkout-bar--scaffold .pztc-qty-btn {
    font: inherit;
    line-height: 1;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--sc-text, inherit);
    width: 30px;
    height: 32px;
    transition: background var(--sc-anim-speed, 200ms);
}
.pztc-checkout-bar--scaffold .pztc-qty-btn:hover:not(:disabled) {
    background: var(--sc-border, #eee);
}
.pztc-checkout-bar--scaffold .pztc-qty-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.pztc-checkout-bar--scaffold .pztc-qty-value {
    min-width: 28px;
    text-align: center;
    font-size: 0.875em;
}

/* ── Add to Cart CTA ──────────────────────────────────────────────────────
   Button styling is kept entirely here in template.css (no inline styles).
   Customise the look here, or the label/icon from the Scaffold settings page. */
.pztc-checkout-bar--scaffold .pztc-bar-row__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-size: 0.95em;
    font-weight: 600;
    line-height: 1;
    padding: 0 18px;
    height: 38px;
    cursor: pointer;
    border: 1px solid var(--sc-accent, #333);
    border-radius: var(--sc-card-radius, 4px);
    background: var(--sc-accent, #333);
    color: #fff;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: opacity var(--sc-anim-speed, 200ms),
                background var(--sc-anim-speed, 200ms),
                transform var(--sc-anim-speed, 200ms);
}
.pztc-checkout-bar--scaffold .pztc-bar-row__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__btn:hover {
    opacity: 0.9;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__btn:active {
    transform: scale(0.98);
}
.pztc-checkout-bar--scaffold .pztc-bar-row__btn:focus-visible {
    outline: 2px solid var(--sc-accent, #333);
    outline-offset: 2px;
}
.pztc-checkout-bar--scaffold .pztc-bar-row__btn:disabled,
.pztc-checkout-bar--scaffold .pztc-bar-row__btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

/* Order notes textarea */
.pztc-checkout-bar--scaffold .pztc-bar-notes {
    margin-top: 10px;
}
.pztc-checkout-bar--scaffold .pztc-bar-notes__input {
    width: 100%;
    font: inherit;
    font-size: 0.875em;
    color: var(--sc-text, inherit);
    background: var(--sc-bg, transparent);
    border: 1px solid var(--sc-border, #cccccc);
    border-radius: var(--sc-card-radius, 4px);
    padding: 6px 8px;
    resize: vertical;
}
.pztc-checkout-bar--scaffold .pztc-bar-notes__input:focus-visible {
    outline: none;
    border-color: var(--sc-accent, #333);
}
