/* ============================================================
   NFC Customizer — Configurator
   ============================================================ */

:root {
    --bg:           #f7f6f3;
    --panel:        #ffffff;
    --ink:          #0b1220;
    --ink-soft:     #4b5563;
    --line:         #e8e6e0;
    --accent:       #0f766e;            /* teal-700 — refined Netram NFC accent */
    --accent-dk:    #115e59;            /* teal-800, hover / on-light text */
    --accent-soft:  rgba(15,118,110,.10);
    --stage:        #0b1220;
    --stage-glow:   #1a2336;
    --danger:       #dc2626;
    --warn:         #d97706;
    --radius:       10px;
}

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

html, body { height: 100%; }
body {
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---- Header --------------------------------------------------- */
.cfg-header {
    height: 72px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 28px;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.cfg-header .brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: opacity .15s;
}
.cfg-header .brand:hover { opacity: .82; text-decoration: none; }
.cfg-header .brand img {
    height: 38px;
    width: auto;
    display: block;
}
.cfg-header .brand .brand-tag {
    color: var(--ink-soft);
    border-left: 1px solid var(--line);
    padding-left: 14px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .01em;
}
.cfg-header .header-meta {
    font-size: 12px;
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cfg-header .header-meta .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.cfg-header .header-meta strong { color: var(--ink); }

/* ---- Main layout --------------------------------------------- */
.cfg-main {
    display: grid;
    grid-template-columns: 1fr 440px;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ---- Stage (canvas area) ------------------------------------- */
.cfg-stage {
    background: radial-gradient(ellipse at center, var(--stage-glow) 0%, var(--stage) 70%);
    display: flex;
    flex-direction: column;
    padding: 22px 36px 18px;
    position: relative;
    overflow: hidden;
}
.cfg-stage::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        radial-gradient(rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
}
.stage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255,255,255,.7);
    font-size: 12px;
    margin-bottom: 8px;
    z-index: 1;
}
.stage-meta {
    font-variant-numeric: tabular-nums;
    letter-spacing: .03em;
    text-transform: uppercase;
    font-size: 11px;
    color: rgba(255,255,255,.55);
}
.side-tabs { display: inline-flex; gap: 2px; background: rgba(255,255,255,.06); padding: 3px; border-radius: 8px; }
.side-tab {
    background: none; border: none; color: rgba(255,255,255,.55);
    padding: 6px 14px; border-radius: 6px;
    font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.side-tab.active { background: rgba(255,255,255,.16); color: #fff; }
.side-tab:disabled { opacity: .35; cursor: not-allowed; }

.stage-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    position: relative;          /* anchors .stage-placeholder */
}

/* Build-up overlay shown over the empty Fabric canvas while no product is
   selected. Centred inside the canvas wrap; hidden once a product picks. */
.stage-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255,255,255,.65);
    text-align: center;
    padding: 20px;
    pointer-events: none;        /* let the cursor through if it ever matters */
}
.stage-placeholder .sp-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1px dashed rgba(255,255,255,.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    color: rgba(255,255,255,.55);
}
.stage-placeholder .sp-title {
    font-size: 14px; font-weight: 700; letter-spacing: .04em;
    color: rgba(255,255,255,.85);
}
.stage-placeholder .sp-sub {
    font-size: 12px; max-width: 320px; line-height: 1.5;
    color: rgba(255,255,255,.55);
}
#cardCanvas { display: block; }

.stage-legend {
    display: flex;
    gap: 22px;
    justify-content: center;
    color: rgba(255,255,255,.55);
    font-size: 11px;
    letter-spacing: .02em;
    margin-top: 10px;
    z-index: 1;
}
.stage-legend .lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.stage-legend .lg-dot.bleed { background: #ef4444; }
.stage-legend .lg-dot.safe  { background: #94a3b8; }
.stage-legend .lg-dot.chip  { background: #fbbf24; }

.stage-hint {
    text-align: center;
    color: rgba(255,255,255,.4);
    font-size: 11px;
    margin-top: 6px;
    z-index: 1;
}

/* Contextual notice shown above the canvas (e.g. PVC 2-colour limit) */
.stage-notice {
    background: rgba(217,119,6,0.14);
    border: 1px solid rgba(252,211,77,0.45);
    color: #fde68a;
    font-size: 12px;
    line-height: 1.4;
    padding: 8px 14px;
    border-radius: 8px;
    margin: 6px auto 0;
    max-width: 560px;
    text-align: center;
    z-index: 2;
    position: relative;
}
.stage-notice strong { color: #fef3c7; }

/* ---- Right panel --------------------------------------------- */
.cfg-panel {
    background: var(--panel);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-scroll { overflow-y: auto; flex: 1; padding: 4px 0; }
.panel-scroll::-webkit-scrollbar { width: 8px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #d6d3cc; border-radius: 4px; }

.cfg-section { padding: 22px 28px; border-bottom: 1px solid var(--line); }
.cfg-section:last-child { border-bottom: none; }
.cfg-section h2 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 14px;
}
.cfg-section.cfg-section-stub { background: #fbfaf6; }
.cfg-section.cfg-section-stub p { color: var(--ink-soft); font-size: 13px; }
.badge.soon {
    display: inline-block;
    margin-left: 8px;
    background: var(--accent-soft);
    color: var(--accent-dk);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-weight: 700;
}

/* Inline section notes (e.g. "metal only NTAG216", "no MOQ for metal") */
.cfg-locked {
    background: var(--accent-soft);
    color: var(--accent-dk);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Locked-section placeholder — used when a downstream step is shown but its
   prerequisites aren't met yet (e.g. "Material & Colour" before a product
   has been picked). Keeps the section visible so the customer sees what's
   coming, without offering options it can't fulfil. */
.cfg-section-locked { opacity: .55; }
.cfg-section-locked h2 { color: var(--ink-soft); }
.cfg-locked-hint {
    font-size: 12px;
    color: var(--ink-soft);
    font-style: italic;
}

/* ---- Product tiles ------------------------------------------- */
.p-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.p-tile {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    transition: border-color .15s, transform .1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.p-tile .p-tile-name { font-weight: 600; font-size: 13px; }
.p-tile .p-tile-price {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-dk);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}
.p-tile .p-icon {
    width: 64px; height: 40px;
    background: linear-gradient(135deg, #e8e6e0, #f4f2ec);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(11,18,32,.25);
    font-size: 24px;
}
.p-tile img { width: 72px; height: 48px; object-fit: contain; }
.p-tile:hover { border-color: var(--accent); }
.p-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Pills (material, sides, finish) ------------------------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills.two .pill { flex: 1 1 0; }
.pill {
    background: var(--panel);
    border: 1.5px solid var(--line);
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: border-color .15s, background .15s;
}
.pill .up {
    color: var(--ink-soft);
    font-weight: 500;
    font-size: 11px;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}
.pill:hover { border-color: var(--accent); }
.pill.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-dk);
}
.pill.active .up { color: var(--accent-dk); }

/* ---- Colour swatches ---------------------------------------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.swatch-btn {
    background: none; border: none; padding: 0;
    display: flex; align-items: center; gap: 8px;
    text-align: left;
}
.swatch-btn .sw {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--line);
    background-clip: padding-box;
    transition: border-color .15s, box-shadow .15s;
    flex-shrink: 0;
    background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%),
                      linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
}
.swatch-btn .sw-name { font-size: 12px; line-height: 1.3; color: var(--ink-soft); }
.swatch-btn .sw-name .up { display: block; color: var(--ink-soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.swatch-btn:hover .sw { border-color: var(--accent); }
.swatch-btn.active .sw {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.swatch-btn.active .sw-name { color: var(--ink); font-weight: 600; }

/* ---- Option rows (chip type) ------------------------------- */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt-row {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 12px;
}
.opt-row:hover { border-color: var(--accent); }
.opt-row.active { border-color: var(--accent); background: var(--accent-soft); }
.opt-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-main strong { font-size: 14px; font-weight: 700; }
.opt-main .opt-sub { font-size: 11px; color: var(--ink-soft); letter-spacing: .02em; }
.opt-row.active .opt-sub { color: var(--accent-dk); }
.opt-side {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 12px;
    color: var(--ink-soft);
}
.opt-row.active .opt-side { color: var(--accent-dk); }

/* ---- Quantity ----------------------------------------------- */
.qty-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qty-preset {
    background: var(--panel);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 10px 6px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    color: var(--ink);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: border-color .15s, background .15s;
}
.qty-preset .qsave {
    font-size: 10px;
    color: var(--accent-dk);
    font-weight: 700;
    letter-spacing: .03em;
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 20px;
}
.qty-preset:hover { border-color: var(--accent); }
.qty-preset.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dk); }
.qty-input {
    margin-top: 12px;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.qty-input:focus-within { border-color: var(--accent); }
.qty-input input {
    border: 0; background: none;
    padding: 10px 14px;
    flex: 1;
    font: inherit; font-weight: 700;
    font-variant-numeric: tabular-nums;
    outline: none;
}
.qty-suffix {
    padding-right: 14px;
    color: var(--ink-soft);
    font-size: 12px;
}

/* ---- Price bar (sticky bottom) ------------------------------ */
.cfg-pricebar {
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, #fdfcf9, #f4f2ec);
    padding: 18px 28px 20px;
    backdrop-filter: blur(6px);
}
.pb-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.pb-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--ink-soft);
    font-weight: 700;
}
.pb-vat {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--ink-soft);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
.pb-amount {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.pb-meta .pb-running {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent-dk);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-right: 4px;
    vertical-align: 1px;
}
.pb-meta {
    color: var(--ink-soft);
    font-size: 12px;
    margin-top: 10px;
    min-height: 18px;
}
.pb-meta .save { color: var(--accent-dk); font-weight: 700; }
.pb-meta .err { color: var(--danger); font-weight: 600; }
.pb-meta .warn { display: block; margin-top: 4px; color: var(--warn); font-weight: 600; }
.pb-cta {
    margin-top: 14px;
    width: 100%;
    background: var(--ink);
    color: #fff;
    border: 0;
    padding: 13px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .02em;
    transition: background .15s, transform .1s;
}
.pb-cta:hover:not(:disabled) { background: var(--accent-dk); }
.pb-cta:active:not(:disabled) { transform: translateY(1px); }
.pb-cta:disabled { background: #cfcdc6; cursor: not-allowed; }

/* ---- Artwork section ---------------------------------------- */
.art-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 28px 16px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: #fbfaf6;
}
.art-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.art-drop-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dk);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
    margin-bottom: 6px;
}
.art-drop-main { font-weight: 700; font-size: 14px; }
.art-drop-sub  { font-size: 11px; color: var(--ink-soft); }

.art-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fbfaf6;
}
.art-thumb {
    width: 46px; height: 46px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-dk);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 11px;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.art-thumb-pdf { background: #fee2e2; color: #b91c1c; }
.art-thumb-svg { background: #dbeafe; color: #1d4ed8; }
.art-thumb-png, .art-thumb-jpg, .art-thumb-jpeg { background: #fef3c7; color: #92400e; }

.art-meta { flex: 1; min-width: 0; }
.art-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.art-sub { font-size: 11px; color: var(--ink-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }

.art-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.art-controls-row2 { margin-top: 6px; }
.pill.sm {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 7px;
}
.pill.sm.danger {
    border-color: #fecdc9;
    color: #b42318;
}
.pill.sm.danger:hover {
    border-color: var(--danger);
    background: #fef3f2;
    color: var(--danger);
}
.pill.sm label, label.pill.sm { display: inline-block; cursor: pointer; }

.art-status {
    margin-top: 10px;
    font-size: 12px;
    min-height: 16px;
    color: var(--ink-soft);
}
.art-status-err { color: var(--danger); font-weight: 600; }

.art-warn {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 12px;
    line-height: 1.4;
}
.art-hint {
    margin-top: 10px;
    font-size: 11px;
    color: var(--ink-soft);
    font-style: italic;
}

/* Hide the old Phase 4 stub styling overrides — artwork section now functional */
.cfg-section-stub { background: var(--panel); }

/* ---- Checkout step (Phase 6) -------------------------------- */
.ck-back {
    background: none;
    border: none;
    color: var(--ink-soft);
    font-size: 12px;
    padding: 0;
    margin-bottom: 12px;
    cursor: pointer;
}
.ck-back:hover { color: var(--accent-dk); }
.ck-intro { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }
.ck-row { margin-bottom: 12px; }
.ck-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ck-row label {
    display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft);
    margin-bottom: 4px;
}
.ck-row input,
.ck-row textarea {
    display: block;
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: var(--panel);
    color: var(--ink);
}
.ck-row input:focus,
.ck-row textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.ck-row .req { color: var(--danger); margin-left: 2px; }
.ck-toggle {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    font-weight: 600;
}
.ck-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.ck-ship { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ck-ship .ck-row { margin-bottom: 10px; }

/* ---- Bulk-order lead-time banner (qty > 200) ---------------- */
.qty-bulk-leadtime {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(217,119,6,0.10);
    border: 1px solid rgba(252,211,77,0.55);
    color: #92400e;
    font-size: 12px;
    line-height: 1.4;
    padding: 10px 12px;
    border-radius: 8px;
}
.qty-bulk-leadtime .qbl-icon {
    font-size: 18px;
    color: #b45309;
    flex-shrink: 0;
}

/* ---- Floating WhatsApp FAB ---------------------------------- */
.wa-fab {
    position: fixed;
    bottom: 22px;
    left: 22px;                  /* bottom-left so it doesn't overlap the panel */
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #25D366;
    color: #fff;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(37, 211, 102, 0.35),
                0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform .15s, box-shadow .15s, background .15s;
}
.wa-fab:hover {
    background: #1ebe57;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.4),
                0 3px 8px rgba(0, 0, 0, 0.18);
}

/* ---- Mobile -------------------------------------------------- */
@media (max-width: 900px) {
    .cfg-main {
        grid-template-columns: 1fr;
        grid-template-rows: 44vh 1fr;
        height: auto;
        min-height: calc(100vh - 56px);
    }
    .cfg-stage {
        position: sticky;
        top: 56px;
        z-index: 20;
        padding: 14px 18px 12px;
    }
    .cfg-panel { border-left: 0; border-top: 1px solid var(--line); }
    .cfg-section { padding: 18px 20px; }
    .cfg-pricebar { padding: 16px 20px 18px; }
    .pb-amount { font-size: 30px; }
    .qty-presets { grid-template-columns: repeat(3, 1fr); }
}
/* On mobile the FAB sits low-left and shrinks so it doesn't crowd the
   sticky stage or cover the Continue-to-quote CTA. */
@media (max-width: 900px) {
    .wa-fab { bottom: 96px; left: 14px; width: 44px; height: 44px; }
    .wa-fab svg { width: 22px; height: 22px; }
}

@media (max-width: 480px) {
    .p-tiles { grid-template-columns: repeat(2, 1fr); }
}
