/* ============================================
   Configurator Page Styles
   ============================================ */

.configurator {
    padding: calc(var(--nav-height) + 40px) 0 80px;
}

.config-header {
    text-align: center;
    margin-bottom: 48px;
}
.config-header .section-subtitle {
    margin: 0 auto;
}

/* --- Progress Bar --- */
.config-progress {
    margin-bottom: 48px;
}
.config-progress-bar {
    height: 2px;
    background: var(--color-border);
    border-radius: 1px;
    margin-bottom: 16px;
    overflow: hidden;
}
.config-progress-fill {
    height: 100%;
    background: var(--color-text);
    border-radius: 1px;
    width: 25%;
    transition: width 0.5s var(--ease-out);
}
.config-steps-nav {
    display: flex;
    justify-content: space-between;
}
.config-step-dot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    transition: color 0.3s;
    padding: 8px 0;
}
.config-step-dot span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s;
    flex-shrink: 0;
}
.config-step-dot.active {
    color: var(--color-text);
}
.config-step-dot.active span {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}
.config-step-dot.completed span {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}
.config-step-dot.completed {
    color: var(--color-accent);
}

/* --- Layout --- */
.config-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 48px;
    align-items: start;
}

/* --- Steps --- */
.config-step {
    display: none;
}
.config-step.active {
    display: block;
    animation: fadeUp 0.5s var(--ease-out);
}
.config-step-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 8px;
}
.config-step-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 32px;
}

/* --- Option Cards --- */
.config-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.config-options--finishes {
    grid-template-columns: repeat(3, 1fr);
}
/* When a step has exactly 3 cards (e.g. Step 1 Water with 4-in-1 Ambient,
   4-in-1 Chilled, 5-in-1), use a 3-column grid so the third card isn't
   orphaned in a half-empty second row.
   Gated to ≥769px because the :has() selector's specificity (~0,5,0) would
   otherwise beat the mobile @media (max-width: 768px) { .config-options
   { grid-template-columns: 1fr } } rule below (~0,1,0), and we don't want
   3 cards crammed at ~110px each on phones. The :not() guard preserves
   the explicit finishes override above. */
@media (min-width: 769px) {
    .config-options:not(.config-options--finishes):has(> :nth-child(3)):not(:has(> :nth-child(4))) {
        grid-template-columns: repeat(3, 1fr);
    }
}

.config-card {
    cursor: pointer;
    display: block;
}
.config-card input { display: none; }
/* Cards sit on the warm page background (#fafaf8). They render brighter
   (pure white #fff) so the edge is obvious — they read as selectable
   controls, not static panels. Inner uses flex column so content fills
   the grid-stretched height and short cards (e.g. "5 in 1") don't feel
   visually sparse against their taller siblings in the same row. */
.config-card-inner {
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid #d8d4cb;
    border-radius: var(--radius);
    transition: border-color 0.2s var(--ease-out),
                background 0.2s var(--ease-out),
                box-shadow 0.2s var(--ease-out),
                transform 0.2s var(--ease-out);
    height: 100%;
    min-height: 180px;
    position: relative;
    display: flex;
    flex-direction: column;
}
.config-card:hover .config-card-inner {
    border-color: var(--color-accent);
    box-shadow: 0 6px 16px rgba(29, 58, 95, 0.08);
    transform: translateY(-2px);
}
.config-card input:checked + .config-card-inner {
    border-color: var(--color-accent);
    background: rgba(29, 58, 95, 0.04);
    box-shadow: 0 0 0 1px var(--color-accent);
}
/* Unavailable cards lose hover lift / shadow (they aren't actionable). */
.config-card.config-card--unavailable:hover .config-card-inner {
    border-color: #d8d4cb;
    box-shadow: none;
    transform: none;
}

/* Selection checkmark — visible by default as an empty circle, fills with
   the navy tick on selection. Giving it a permanent presence (not just
   on :checked) reinforces that each card is a selectable control, which
   was the brief's point about not relying on border colour alone. */
.config-card-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: 1.5px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
    z-index: 2;
}
.config-card-check svg {
    width: 13px;
    height: 13px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s var(--ease-out);
}
.config-card:hover .config-card-check {
    border-color: var(--color-accent);
}
.config-card input:checked + .config-card-inner .config-card-check {
    background: var(--color-accent);
    border-color: var(--color-accent);
}
.config-card input:checked + .config-card-inner .config-card-check svg {
    opacity: 1;
}

.config-card-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
    color: var(--color-accent);
}
.config-card-icon svg { width: 100%; height: 100%; }


.config-card h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 8px;
}
.config-card p {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}
.config-card-price {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-accent);
}
/* Subtle pill shown below the price (e.g. "Pull Out Option" on water /
   collection cards). Sits inside .config-card-inner which is a flex
   column — without align-self it would stretch to full card width, so
   we anchor it to flex-start and let it fit its content. The negative
   margin-left equals the horizontal padding so the pill's TEXT aligns
   with the price text above it ("Pull" lines up with "From"); the pill's
   pale-navy background extends ~10px into the card's inner padding but
   stays well clear of the card border. */
.config-card-tag {
    align-self: flex-start;
    margin-top: 8px;
    margin-left: -10px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--color-accent);
    background: rgba(29, 58, 95, 0.08);
    border-radius: 20px;
}
/* Collapse the pill when JS hasn't populated text — used by the
   Flagship/Signature pull-out pills, which are only meaningful once
   the user has chosen a water mode in Step 1. */
.config-card-tag:empty {
    display: none;
}

/* Badge sits in the top-LEFT corner so it doesn't crowd the always-visible
   selection circle in the top-right. (Previously they shared the right
   corner with a 32px gap; clean corner-per-element reads better.) */
.config-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 3px 10px;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius);
}

/* Unavailable cards */
.config-card--unavailable {
    opacity: 0.35;
    pointer-events: none;
    position: relative;
}
.config-unavailable-label {
    display: block;
    font-size: 0.75rem;
    color: #b45309;
    font-weight: 500;
    margin-top: 8px;
    line-height: 1.4;
}
.config-unavailable-label:empty {
    display: none;
}
/* Show label even when card is faded */
.config-card--unavailable .config-unavailable-label {
    opacity: 1;
}

/* Informational note (non-blocking heads-up) — used on the Flagship card
   to flag that pull-out isn't available with Boiling & Chilled. Card stays
   selectable; this is just a forewarning so the user makes an informed
   pick before reaching Step 3. */
.config-card-note {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-style: italic;
    margin-top: 8px;
    line-height: 1.4;
}
.config-card-note:empty {
    display: none;
}

.config-card-specs {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}
.config-card-specs small {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

/* Tap Previews */
.config-card-visual {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.config-style-img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}
.config-tap-preview {
    position: relative;
    width: 60px;
    height: 90px;
}
.ctp-body {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    background: linear-gradient(90deg, #ccc, #e0e0e0, #ccc);
    border-radius: 5px 5px 0 0;
    transition: all 0.3s;
}
.ctp-spout {
    position: absolute;
    background: linear-gradient(180deg, #d8d8d8, #c0c0c0);
    transition: all 0.3s;
}
.ctp-base {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 6px;
    background: linear-gradient(90deg, #bbb, #d8d8d8, #bbb);
    border-radius: 2px;
    transition: all 0.3s;
}
.ctp-sensor {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8bb;
    transition: all 0.3s;
}

/* Arc style */
.config-tap--arc .ctp-body { height: 65px; }
.config-tap--arc .ctp-spout {
    top: 8px;
    left: calc(50% + 3px);
    width: 24px;
    height: 8px;
    border-radius: 0 4px 4px 0;
}

/* Sena style */
.config-tap--sena .ctp-body { height: 60px; width: 12px; border-radius: 6px 6px 0 0; }
.config-tap--sena .ctp-sensor { top: 30px; left: calc(50% + 8px); }

/* Zenith style */
.config-tap--zenith .ctp-body { height: 70px; width: 14px; border-radius: 3px 3px 0 0; }
.config-tap--zenith .ctp-spout {
    top: 4px;
    left: calc(50% + 4px);
    width: 18px;
    height: 10px;
    border-radius: 0 2px 2px 0;
}

/* Flux style */
.config-tap--flux .ctp-body { height: 58px; width: 8px; border-radius: 2px 2px 0 0; }
.config-tap--flux .ctp-spout {
    top: 12px;
    left: calc(50% + 2px);
    width: 20px;
    height: 6px;
    border-radius: 0 1px 1px 0;
}

/* Finish cards */
.config-card--finish .config-card-inner {
    text-align: center;
    padding: 20px 16px;
}
.config-finish-swatch {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    border: 1px solid var(--color-border);
}

/* Finish price delta */
.config-finish-delta {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
    min-height: 18px;
}
.config-finish-delta:empty {
    display: none;
}
.config-finish-delta--included {
    color: var(--color-text-muted);
}
.config-finish-delta--premium {
    color: var(--color-accent);
}

/* --- Summary Sidebar --- */
.config-summary {
    position: sticky;
    top: calc(var(--nav-height) + 24px);
}
.config-summary-inner {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px;
    background: var(--color-surface);
}
.config-summary-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 20px;
}
.config-summary-preview {
    margin-bottom: 24px;
    display: none;
}
.config-summary-preview.has-image {
    display: block;
}
.config-summary-tap {
    aspect-ratio: 4/3;
    background: linear-gradient(180deg, #f8f6f3, #f0ede8);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.summary-tap-placeholder {
    text-align: center;
    color: var(--color-text-muted);
}
.summary-tap-placeholder svg {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    opacity: 0.4;
}
.summary-tap-placeholder span {
    font-size: 0.78rem;
}
/* Real product image in summary */
.summary-tap-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    animation: fadeUp 0.4s var(--ease-out);
}

.config-summary-items {
    margin-bottom: 20px;
}
.config-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.85rem;
}
.config-summary-label {
    color: var(--color-text-secondary);
}
.config-summary-value {
    font-weight: 500;
    text-align: right;
    color: var(--color-text-muted);
}
.config-summary-value.selected {
    color: var(--color-text);
}

.config-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
}
.config-total-price {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-accent);
}

.config-summary-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.config-summary-actions .btn {
    width: 100%;
    justify-content: center;
}

.config-summary-note {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.5;
}

/* --- Completion State --- */
.config-completion {
    animation: fadeUp 0.5s var(--ease-out);
}
.config-completion-inner {
    text-align: center;
    padding: 40px 0;
}
.config-completion-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: #16a34a;
}
.config-completion-icon svg {
    width: 100%;
    height: 100%;
}
.config-completion-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 32px;
}
/* When the subtitle is shown (deep-link recipient mode), tighten the
   title's bottom margin so the title + subtitle pair doesn't double-
   space. Default funnel-complete state has the subtitle [hidden] and
   the title keeps its original 32px breathing room. */
.config-completion-title:has(+ .config-completion-subtitle:not([hidden])) {
    margin-bottom: 12px;
}
.config-completion-subtitle {
    font-size: 0.92rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0 auto 20px;
    max-width: 480px;
}
.config-completion-subtitle[hidden] {
    display: none;
}
.config-completion-product {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 480px;
    margin: 0 auto 40px;
    text-align: left;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
}
.config-completion-img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    flex-shrink: 0;
}
/* Spacing rhythm in the completion product card: 4-4-14.
   The title, finish and SKU collectively identify the tap and should
   read as one tight identification block (4px between each). The
   price is the outcome / focal point and gets a 14px breath above it
   so it visually separates from the identifier rows. */
.config-completion-details h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.config-completion-details p {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}
/* SKU sits between the finish line and the price as small uppercase
   metadata — same eyebrow voice as the field-name labels elsewhere on
   the site, but muted so the price stays the dominant element.
   Specificity needs the .config-completion-details ancestor to beat
   the parent `.config-completion-details p` rule above (which sets
   font-size and color and would otherwise win the cascade). */
.config-completion-details p.config-completion-sku {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 14px;
}
.config-completion-details p.config-completion-sku span {
    color: var(--color-text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0;
    margin-left: 4px;
}
.config-completion-price {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-accent);
}
.config-completion-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto 24px;
}
.config-completion-actions .btn {
    width: 100%;
    justify-content: center;
}
.config-edit-btn {
    background: transparent !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}
.config-edit-btn:hover {
    border-color: var(--color-text-muted) !important;
    color: var(--color-text) !important;
}

/* Share button uses base .btn--secondary so it inherits the same visual
   treatment as the Find a Retailer button below it (full dark text on
   light border). The share icon is absolute-positioned on the right so
   the "Share" word stays in the true horizontal centre of the button,
   matching how text reads in the sibling buttons that have no icon. */
.config-share-btn {
    position: relative;
}
.config-share-btn-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Nav Buttons --- */
.config-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border-light);
}
.config-prev:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .config-layout {
        grid-template-columns: 1fr;
    }
    .config-summary {
        position: static;
        order: 2; /* Below steps on tablet/mobile */
    }
    .config-steps {
        order: 1;
    }
    .config-completion {
        order: 1;
    }
    .config-options--finishes {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile stepper: show only the numbered circles, spread evenly across
       the viewport. Step labels (the text-node siblings of the .config-step-dot
       <span>) are hidden via font-size:0 on the parent while the inner
       <span> keeps its explicit size, leaving just the circle visible.
       This replaces the previous horizontal-scroll-with-cut-off pattern
       where "4 Finish" was being clipped past the viewport edge. */
    .config-steps-nav {
        gap: 8px;
        justify-content: space-around;
        padding-bottom: 4px;
    }
    .config-step-dot {
        font-size: 0;
        gap: 0;
        padding: 6px;
        flex-shrink: 0;
    }
    .config-step-dot span {
        font-size: 0.78rem;
        width: 30px;
        height: 30px;
    }
    .config-options {
        grid-template-columns: 1fr;
    }
    .config-options--finishes {
        grid-template-columns: repeat(2, 1fr);
    }
    .config-completion-product {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    .config-completion-img {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 480px) {
    .config-options--finishes {
        grid-template-columns: 1fr;
    }
}
