/**
 * WC Bundle Configurator — Frontend Styles
 * Pixel-perfect match of Pearly luxury beauty brand screenshots.
 *
 * Phase 8: Full redesign pass — colours, spacing, animations, mobile, theme-compat.
 *
 * Design spec (extracted from reference screenshots):
 *  • Primary action pink:  #c8527a  (Select button, modal title, step-name text)
 *  • Done button pink:     #e8a0b4  (lighter, softer)
 *  • Active tab fill:      #fce4ec
 *  • Step row fill:        #fae8ef
 *  • Card selected border: #e8a0b4 (2px)
 *  • No tick on selected card — border + background only
 *  • Modal radius: 20px
 *  • Card radius: 10px
 *  • Grid: 3-col, 10px gap
 *
 * Table of Contents:
 *  1.  CSS Custom Properties (Design Tokens)
 *  2.  Reset — scope inside .wcbc-panel and .wcbc-modal-overlay
 *  3.  Bundle Panel (product page)
 *  4.  Panel Step Rows
 *  5.  Panel Validation
 *  6.  Modal Overlay + Backdrop
 *  7.  Modal Container + Entrance Animation
 *  8.  Modal Header (sticky)
 *  9.  Step Tabs
 * 10.  Modal Body + Pane Transitions
 * 11.  Options Grid
 * 12.  Option Card (default / hover / selected / focus)
 * 13.  Modal Footer + Done Button
 * 14.  Custom Scrollbar
 * 15.  Phase 5 — Locked steps, multi-select counters, toast
 * 16.  Phase 6 — Validation states, ATC blocked, shake
 * 17.  Phase 7 — Cart / order meta display
 * 18.  Animations keyframes
 * 19.  Responsive — tablet (≤768px)
 * 20.  Responsive — mobile (≤520px)
 * 21.  Responsive — small mobile (≤360px)
 * 22.  prefers-reduced-motion
 */

/* ============================================================
   1. CSS Custom Properties — design tokens
   ============================================================ */

:root {
    /* ── Static design tokens (not overridden by Design Settings) ── */

    /* Neutral palette — fixed regardless of brand colour */
    --wcbc-white:          #ffffff;
    --wcbc-off-white:      #fafafa;
    --wcbc-bg-modal:       #ffffff;
    --wcbc-gray-100:       #f5f5f5;
    --wcbc-gray-200:       #ebebeb;
    --wcbc-gray-300:       #d4d4d4;
    --wcbc-gray-400:       #a3a3a3;
    --wcbc-gray-500:       #737373;
    --wcbc-gray-600:       #525252;
    --wcbc-gray-700:       #404040;
    --wcbc-gray-900:       #171717;

    /* Validation — always red regardless of brand */
    --wcbc-error:          #b91c1c;
    --wcbc-error-bg:       #fef2f2;
    --wcbc-error-border:   #fca5a5;
    --wcbc-success:        #15803d;

    /* Fixed structural sizing */
    --wcbc-modal-w:        490px;
    --wcbc-pill-r:         999px;

    /* Motion — not user-configurable */
    --wcbc-ease-spring:    cubic-bezier(0.34, 1.10, 0.64, 1);
    --wcbc-ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
    --wcbc-ease-in-out:    cubic-bezier(0.4, 0, 0.2, 1);
    --wcbc-t-fast:         150ms;
    --wcbc-t-mid:          240ms;
    --wcbc-t-enter:        360ms;

    /* Z-index — not user-configurable */
    --wcbc-z-modal:        999990;
    --wcbc-z-toast:        999999;

    /* ── Dynamic tokens — DEFAULT values only.
         These are overridden by <style id="wcbc-design-vars"> in wp_head
         which is output AFTER this stylesheet (priority 100 > wp_print_styles 8).
         If the design settings system is disabled, these fallbacks apply. ── */
    --wcbc-pink:           #c8527a;
    --wcbc-pink-dark:      #a83d62;
    --wcbc-pink-done:      #e8a0b4;
    --wcbc-pink-done-dark: #d4849a;
    --wcbc-pink-light:     #fce4ec;
    --wcbc-pink-row:       #fae8ef;
    --wcbc-pink-border:    #f0c8d8;
    --wcbc-pink-card-sel:  #e8a0b4;
    --wcbc-pink-card-bg:   #fdf0f5;
    --wcbc-text-ui:        #171717;
    --wcbc-btn-text:       #ffffff;
    --wcbc-modal-r:        20px;
    --wcbc-card-r:         10px;
    --wcbc-tab-r:          8px;
    --wcbc-panel-r:        12px;
    --wcbc-font-size:      14px;
    --wcbc-spacing-panel:  16px;
    --wcbc-spacing-modal:  22px;
    --wcbc-grid-gap:       10px;
    --wcbc-card-padding:   9px 8px 10px;
    --wcbc-shadow-card:    0 1px 3px rgba(0,0,0,.06);
    --wcbc-shadow-card-h:  0 3px 10px rgba(200,82,122,.18);
    --wcbc-shadow-panel:   0 1px 4px rgba(0,0,0,.07), 0 0 0 1px rgba(200,82,122,.10);
    --wcbc-shadow-modal:   0 20px 60px rgba(0,0,0,.16), 0 4px 20px rgba(0,0,0,.08);
    --wcbc-shadow-sel:     0 0 0 2px #e8a0b4, 0 3px 8px rgba(232,160,180,.25);
}

/* ============================================================
   2. Scoped reset — prevent theme interference
   ============================================================ */

.wcbc-panel,
.wcbc-modal-overlay,
.wcbc-modal-overlay * {
    box-sizing: border-box;
}

/* Font-size normalisation inside modal */
.wcbc-modal-overlay {
    font-size: var(--wcbc-font-size, 14px);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ============================================================
   3. Bundle Panel (product page inline block)
   ============================================================ */

.wcbc-panel {
    background: var(--wcbc-white);
    border: 1px solid var(--wcbc-pink-border);
    border-radius: var(--wcbc-panel-r);
    padding: var(--wcbc-spacing-panel, 16px 18px);
    margin: 18px 0 14px;
    font-family: inherit;
    box-shadow: var(--wcbc-shadow-panel);
    width: 100%;
}

/* Header row */
.wcbc-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.wcbc-panel__header-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
}

/* "Bundle Options" label */
.wcbc-panel__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--wcbc-gray-900);
    letter-spacing: -.01em;
}

/* "0/2 selected" counter */
.wcbc-panel__progress {
    font-size: 12px;
    color: var(--wcbc-gray-400);
    font-weight: 500;
    transition: color var(--wcbc-t-fast) ease;
}

.wcbc-panel__progress--complete {
    color: var(--wcbc-success) !important;
    font-weight: 700;
}

/* ── SELECT button ─────────────────────────────────────────── */

.wcbc-panel__select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 24px;
    background: var(--wcbc-pink) !important;
    color: var(--wcbc-btn-text, var(--wcbc-white)) !important;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: .03em;
    border: none !important;
    border-radius: var(--wcbc-pill-r) !important;
    cursor: pointer;
    transition:
        background var(--wcbc-t-fast) ease,
        transform  var(--wcbc-t-fast) ease,
        box-shadow var(--wcbc-t-fast) ease;
    box-shadow: 0 2px 10px rgba(200,82,122,.30);
    white-space: nowrap;
    flex-shrink: 0;
    /* Override WC theme button styles */
    text-transform: none !important;
    text-decoration: none !important;
}

.wcbc-panel__select-btn:hover {
    background: var(--wcbc-pink-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(200,82,122,.40);
    color: var(--wcbc-white) !important;
}

.wcbc-panel__select-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(200,82,122,.25);
}

.wcbc-panel__select-btn:focus-visible {
    outline: 2px solid var(--wcbc-pink);
    outline-offset: 3px;
}

/* ============================================================
   4. Panel Step Rows
   ============================================================ */

.wcbc-panel__steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wcbc-panel__step-row {
    background: var(--wcbc-pink-row);
    border: 1px solid var(--wcbc-pink-border);
    border-radius: 8px;
    padding: 9px 14px;
    transition:
        border-color var(--wcbc-t-fast) ease,
        background   var(--wcbc-t-fast) ease;
}

.wcbc-panel__step-row-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Step name — pink brand colour */
.wcbc-panel__step-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--wcbc-pink);
}

/* Step value — "Not selected" / actual value */
.wcbc-panel__step-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--wcbc-gray-400);
    transition: color var(--wcbc-t-fast) ease;
}

.wcbc-panel__step-row--complete .wcbc-panel__step-value {
    color: var(--wcbc-gray-700);
    font-weight: 600;
}

.wcbc-panel__step-row--complete {
    border-color: rgba(200,82,122,.2);
}

/* ============================================================
   5. Panel Validation States
   ============================================================ */

/* Per-step inline error */
.wcbc-panel__step-error {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--wcbc-error);
    margin-top: 5px;
    padding-left: 1px;
    animation: wcbc-fade-in 180ms ease;
}

.wcbc-panel__step-row--error {
    border-color: var(--wcbc-error-border) !important;
    background: var(--wcbc-error-bg) !important;
}

.wcbc-panel__step-row--error .wcbc-panel__step-name {
    color: var(--wcbc-error);
}

/* Validation summary block */
.wcbc-panel__validation-summary {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 12px;
    background: var(--wcbc-error-bg);
    border: 1px solid var(--wcbc-error-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wcbc-error);
    animation: wcbc-slide-down var(--wcbc-t-fast) ease;
}

.wcbc-panel__validation-summary--hidden {
    display: none !important;
}

/* Legacy one-liner message */
.wcbc-panel__validation {
    margin: 10px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #e07070;
    text-align: center;
}

/* ============================================================
   6. Modal Overlay + Backdrop
   ============================================================ */

.wcbc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--wcbc-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;

    /* Backdrop */
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--wcbc-t-mid) ease;
}

.wcbc-modal-overlay.wcbc-modal--open {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   7. Modal Container + Entrance Animation
   ============================================================ */

.wcbc-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--wcbc-modal-w);
    max-height: min(88vh, 660px);
    background: var(--wcbc-bg-modal);
    border-radius: var(--wcbc-modal-r);
    box-shadow: var(--wcbc-shadow-modal);
    overflow: hidden;

    /* Entrance — scale up from slightly below centre */
    transform: translateY(24px) scale(0.97);
    opacity: 0;
    transition:
        transform var(--wcbc-t-enter) var(--wcbc-ease-spring),
        opacity   var(--wcbc-t-enter) var(--wcbc-ease-out);
    will-change: transform, opacity;
}

.wcbc-modal-overlay.wcbc-modal--open .wcbc-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ============================================================
   8. Modal Header (sticky)
   ============================================================ */

.wcbc-modal__header {
    flex-shrink: 0;
    padding: 20px var(--wcbc-spacing-modal, 22px) 0;
    background: var(--wcbc-bg-modal);
    z-index: 2;
}

/* Top row: title + close */
.wcbc-modal__header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

/* Modal title: "Select Squeez Shade" */
.wcbc-modal__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--wcbc-pink) !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    letter-spacing: -.015em;
    font-family: inherit !important;
}

/* Close text button */
.wcbc-modal__close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--wcbc-gray-500);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.6;
    transition: color var(--wcbc-t-fast) ease;
    white-space: nowrap;
}

.wcbc-modal__close:hover { color: var(--wcbc-gray-900); }

.wcbc-modal__close:focus-visible {
    outline: 2px solid var(--wcbc-pink);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Meta row: "Selecting: Squeez" + "1/2" */
.wcbc-modal__header-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.wcbc-modal__selecting-label {
    font-size: 12px;
    color: var(--wcbc-gray-500);
    font-weight: 400;
}

/* Highlighted step name inline */
.wcbc-modal__selecting-step {
    color: var(--wcbc-pink);
    font-weight: 700;
}

/* N/total counter */
.wcbc-modal__step-counter {
    font-size: 12px;
    color: var(--wcbc-gray-400);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: color var(--wcbc-t-fast) ease;
}

/* ============================================================
   9. Step Tabs
   ============================================================ */

.wcbc-modal__tabs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 14px;
}

.wcbc-modal__tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 14px;
    background: var(--wcbc-off-white);
    border: 1px solid transparent;
    border-radius: var(--wcbc-tab-r);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition:
        background     var(--wcbc-t-fast) ease,
        border-color   var(--wcbc-t-fast) ease,
        box-shadow     var(--wcbc-t-fast) ease;
}

.wcbc-modal__tab:hover:not(.wcbc-modal__tab--active):not(.wcbc-modal__tab--locked) {
    background: var(--wcbc-pink-light);
    border-color: var(--wcbc-pink-border);
}

/* Active (currently selecting) */
.wcbc-modal__tab--active {
    background: var(--wcbc-pink-light);
    border-color: var(--wcbc-pink-border);
    border-width: 1.5px;
}

.wcbc-modal__tab--active .wcbc-modal__tab-name {
    color: var(--wcbc-pink);
    font-weight: 600;
}

/* Step name */
.wcbc-modal__tab-name {
    font-weight: 500;
    color: var(--wcbc-gray-700);
    font-size: 13px;
    flex: 1;
    transition: color var(--wcbc-t-fast) ease;
}

/* Step value chip — "Not selected" / "Blossom" */
.wcbc-modal__tab-value {
    font-size: 12px;
    color: var(--wcbc-gray-400);
    font-weight: 400;
    transition: color var(--wcbc-t-fast) ease, font-weight var(--wcbc-t-fast) ease;
}

.wcbc-modal__tab--complete .wcbc-modal__tab-value {
    color: var(--wcbc-gray-700);
    font-weight: 600;
}

/* Tab focus */
.wcbc-modal__tab:focus-visible {
    outline: 2px solid var(--wcbc-pink);
    outline-offset: 2px;
}

/* Multi-select count badge */
.wcbc-modal__tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    background: var(--wcbc-pink);
    color: var(--wcbc-white);
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--wcbc-pill-r);
    margin-left: 5px;
    opacity: 0;
    transform: scale(0.5);
    transition:
        opacity   var(--wcbc-t-fast) ease,
        transform var(--wcbc-t-fast) var(--wcbc-ease-spring);
}

.wcbc-modal__tab-count--visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================================
   10. Modal Body + Pane Transitions
   ============================================================ */

.wcbc-modal__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px var(--wcbc-spacing-modal, 22px) 10px;
}

/* Step panes */
.wcbc-step-pane {
    animation: wcbc-pane-forward var(--wcbc-t-mid) var(--wcbc-ease-out);
}

.wcbc-step-pane--hidden { display: none; }

/* Directional slide animations */
.wcbc-step-pane--enter-forward  { animation: wcbc-pane-forward  var(--wcbc-t-mid) var(--wcbc-ease-out) both; }
.wcbc-step-pane--enter-backward { animation: wcbc-pane-backward var(--wcbc-t-mid) var(--wcbc-ease-out) both; }
.wcbc-step-pane--enter-restore  { animation: wcbc-fade-in       var(--wcbc-t-fast) ease both; }

/* Empty pane */
.wcbc-step-pane__empty {
    text-align: center;
    color: var(--wcbc-gray-400);
    font-size: 13px;
    padding: 36px 0;
}

/* Multi-select pane counter */
.wcbc-pane-counter {
    font-size: 11px;
    font-weight: 600;
    color: var(--wcbc-gray-400);
    text-align: right;
    margin-bottom: 10px;
    transition: color var(--wcbc-t-fast) ease;
}

.wcbc-pane-counter--active   { color: var(--wcbc-pink); }
.wcbc-pane-counter--complete { color: var(--wcbc-success); }

/* Locked pane */
.wcbc-step-pane--locked {
    position: relative;
    pointer-events: none;
}

.wcbc-step-pane--locked::after {
    content: attr(data-locked-msg);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    font-size: 13px;
    font-weight: 600;
    color: var(--wcbc-gray-400);
    border-radius: 8px;
    text-align: center;
    padding: 20px;
}

/* ============================================================
   11. Options Grid
   ============================================================ */

.wcbc-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--wcbc-grid-gap, 10px);
    padding-bottom: 6px;
}

/* ============================================================
   12. Option Card
   ============================================================ */

.wcbc-option-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: var(--wcbc-card-padding, 9px 8px 10px);
    background: var(--wcbc-white);
    border: 1px solid var(--wcbc-gray-200);
    border-radius: var(--wcbc-card-r);
    cursor: pointer;
    font-family: inherit;
    box-shadow: var(--wcbc-shadow-card);
    transition:
        border-color var(--wcbc-t-fast) ease,
        background   var(--wcbc-t-fast) ease,
        box-shadow   var(--wcbc-t-fast) ease,
        transform    var(--wcbc-t-fast) ease;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    min-height: 44px; /* Touch target */
}

/* Hover */
.wcbc-option-card:hover {
    border-color: var(--wcbc-pink-border);
    background: rgba(252,228,236,.3);
    box-shadow: var(--wcbc-shadow-card-h);
    transform: translateY(-2px);
}

/* Focus */
.wcbc-option-card:focus-visible {
    outline: 2px solid var(--wcbc-pink);
    outline-offset: 2px;
    transform: translateY(-1px);
}

/* Selected — border + bg tint only (no tick per screenshot reference) */
.wcbc-option-card--selected {
    border: 2px solid var(--wcbc-pink-card-sel);
    background: var(--wcbc-pink-card-bg);
    box-shadow: var(--wcbc-shadow-sel);
    transform: translateY(-2px);
}

/* Tick element — hidden (screenshots show no tick) */
.wcbc-option-card__tick {
    display: none;
}

/* Image wrapper */
.wcbc-option-card__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 5 / 4;
    overflow: hidden;
    border-radius: 6px;
    background: var(--wcbc-gray-100);
    flex-shrink: 0;
}

.wcbc-option-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform var(--wcbc-t-fast) ease;
}

.wcbc-option-card:hover .wcbc-option-card__image {
    transform: scale(1.05);
}

/* Placeholder when no image */
.wcbc-option-card__placeholder {
    font-size: 26px;
    line-height: 1;
    opacity: .45;
}

/* Label */
.wcbc-option-card__label {
    font-size: 12px;
    font-weight: 500;
    color: var(--wcbc-gray-600);
    line-height: 1.3;
    text-align: center;
    word-break: break-word;
    width: 100%;
    transition: color var(--wcbc-t-fast) ease;
}

.wcbc-option-card--selected .wcbc-option-card__label {
    color: var(--wcbc-pink);
    font-weight: 600;
}

/* Max-reached: dim unselected cards */
.wcbc-option-card--max-reached:not(.wcbc-option-card--selected) {
    opacity: .35;
    pointer-events: none;
    transform: none;
}

/* Click pulse */
.wcbc-option-card--pulse {
    animation: wcbc-card-pulse 260ms ease;
}

/* Validating spinner overlay */
.wcbc-option-card--validating { pointer-events: none; }

.wcbc-option-card--validating::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.65);
    border-radius: inherit;
    z-index: 1;
}

.wcbc-option-card--validating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid var(--wcbc-pink-border);
    border-top-color: var(--wcbc-pink);
    border-radius: 50%;
    animation: wcbc-spin .55s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 2;
}

/* ============================================================
   13. Modal Footer + Done Button
   ============================================================ */

.wcbc-modal__footer {
    flex-shrink: 0;
    padding: 14px var(--wcbc-spacing-modal, 22px) 20px;
    background: var(--wcbc-bg-modal);
    /* Subtle shadow to lift footer above scrollable body */
    box-shadow: 0 -4px 14px rgba(0,0,0,.05);
}

/* DONE button — lighter pink than Select */
.wcbc-modal__done-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--wcbc-pink-done);
    color: var(--wcbc-btn-text, var(--wcbc-white));
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .03em;
    border: none;
    border-radius: var(--wcbc-pill-r);
    cursor: pointer;
    transition:
        background  var(--wcbc-t-fast) ease,
        box-shadow  var(--wcbc-t-fast) ease,
        transform   var(--wcbc-t-fast) ease,
        opacity     var(--wcbc-t-fast) ease;
    box-shadow: 0 3px 14px rgba(232,160,180,.35);
    text-transform: none;
    text-decoration: none;
}

/* Disabled — same colour, just reduced opacity */
.wcbc-modal__done-btn:disabled,
.wcbc-modal__done-btn[aria-disabled="true"] {
    opacity: .58;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Enabled hover */
.wcbc-modal__done-btn:not(:disabled):hover {
    background: var(--wcbc-pink-done-dark);
    box-shadow: 0 5px 18px rgba(232,160,180,.50);
    transform: translateY(-1px);
}

.wcbc-modal__done-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(232,160,180,.30);
}

.wcbc-modal__done-btn:focus-visible {
    outline: 2px solid var(--wcbc-pink-done-dark);
    outline-offset: 3px;
}

/* "All done" glow animation */
.wcbc-modal__done-btn.wcbc-done--ready {
    animation: wcbc-done-glow 550ms ease;
}

/* ============================================================
   14. Custom Scrollbar
   ============================================================ */

.wcbc-modal__body::-webkit-scrollbar       { width: 4px; }
.wcbc-modal__body::-webkit-scrollbar-track { background: transparent; }
.wcbc-modal__body::-webkit-scrollbar-thumb { background: var(--wcbc-pink-border); border-radius: 10px; }
.wcbc-modal__body::-webkit-scrollbar-thumb:hover { background: var(--wcbc-pink-done); }

/* ============================================================
   15. Phase 5 Additions — locked tabs, toast
   ============================================================ */

/* Locked tab */
.wcbc-modal__tab--locked {
    opacity: .42;
    cursor: not-allowed;
    pointer-events: none;
}

.wcbc-modal__tab--locked .wcbc-modal__tab-name::after {
    content: ' 🔒';
    font-size: 11px;
}

/* Toast */
.wcbc-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--wcbc-gray-900);
    color: var(--wcbc-white);
    font-size: 12px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: var(--wcbc-pill-r);
    white-space: nowrap;
    z-index: var(--wcbc-z-toast);
    pointer-events: none;
    opacity: 0;
    transition:
        opacity   var(--wcbc-t-fast) ease,
        transform var(--wcbc-t-fast) ease;
}

.wcbc-toast--visible   { opacity: 1; transform: translateX(-50%) translateY(0); }
.wcbc-toast--error     { background: #b91c1c; }
.wcbc-toast--info      { background: var(--wcbc-gray-700); }

/* ============================================================
   16. Phase 6 Additions — ATC blocked, shake
   ============================================================ */

/* Add to Cart blocked */
.single_add_to_cart_button[data-wcbc-blocked="true"],
.single_add_to_cart_button.wcbc-btn-blocked {
    opacity: .46 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Shake animation on blocked ATC attempt */
.wcbc-panel--shake {
    animation: wcbc-shake 420ms ease;
}

/* ============================================================
   17. Phase 7 Additions — Cart / order meta
   ============================================================ */

/* Cart table selection rows */
.cart_item dl.variation dt,
.cart_item .woocommerce-item-meta .woocommerce-item-meta-label {
    font-weight: 600;
    color: var(--wcbc-pink) !important;
}

.cart_item dl.variation dd,
.cart_item .woocommerce-item-meta .woocommerce-item-meta-value {
    color: var(--wcbc-gray-600);
}

/* Mini-cart */
.mini_cart_item .woocommerce-item-meta dt {
    font-size: 11px;
    font-weight: 600;
    color: var(--wcbc-pink) !important;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mini_cart_item .woocommerce-item-meta dd {
    font-size: 11px;
    color: var(--wcbc-gray-600);
    margin-bottom: 2px;
}

/* Order meta value in WC admin / emails */
.wcbc-order-meta-value {
    font-weight: 500;
    color: var(--wcbc-gray-700);
}

/* ============================================================
   18. Animation Keyframes
   ============================================================ */

/* Pane slide-in — forward direction */
@keyframes wcbc-pane-forward {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0);    }
}

/* Pane slide-in — backward direction */
@keyframes wcbc-pane-backward {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0);     }
}

/* Fade-in — restore from session */
@keyframes wcbc-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Card selection pulse */
@keyframes wcbc-card-pulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(0.94); }
    100% { transform: scale(1); }
}

/* Done button glow */
@keyframes wcbc-done-glow {
    0%   { box-shadow: 0 3px 14px rgba(232,160,180,.35); }
    50%  { box-shadow: 0 4px 28px rgba(232,160,180,.70); }
    100% { box-shadow: 0 3px 14px rgba(232,160,180,.35); }
}

/* Validation summary slide */
@keyframes wcbc-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ATC panel shake */
@keyframes wcbc-shake {
    0%, 100% { transform: translateX(0); }
    16%      { transform: translateX(-6px); }
    32%      { transform: translateX(6px); }
    48%      { transform: translateX(-4px); }
    64%      { transform: translateX(4px); }
    80%      { transform: translateX(-2px); }
}

/* Spinner */
@keyframes wcbc-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================
   19. Responsive — Tablet (≤768px)
   ============================================================ */

@media (max-width: 768px) {
    :root {
        --wcbc-modal-w: 460px;
    }

    .wcbc-modal__header { padding: 18px 18px 0; }
    .wcbc-modal__body   { padding: 12px 18px 8px; }
    .wcbc-modal__footer { padding: 12px 18px 18px; }
}

/* ============================================================
   20. Responsive — Mobile (≤520px)
   ============================================================ */

@media (max-width: 520px) {
    :root {
        --wcbc-modal-w:    100%;
        --wcbc-modal-r:    18px 18px 0 0; /* Bottom sheet */
    }

    /* Bottom sheet — slides up from bottom edge */
    .wcbc-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .wcbc-modal {
        border-radius: var(--wcbc-modal-r);
        max-height: 86vh;
        transform: translateY(100%);
        transition:
            transform var(--wcbc-t-enter) var(--wcbc-ease-out),
            opacity   var(--wcbc-t-enter) ease;
    }

    .wcbc-modal-overlay.wcbc-modal--open .wcbc-modal {
        transform: translateY(0);
        opacity: 1;
    }

    /* Sheet drag handle */
    .wcbc-modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--wcbc-gray-300);
        border-radius: 4px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }

    .wcbc-modal__header { padding: 8px 16px 0; }
    .wcbc-modal__body   { padding: 12px 16px 6px; }
    .wcbc-modal__footer { padding: 12px 16px 28px; } /* +safe area inset */

    /* 2-column grid on mobile */
    .wcbc-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Slightly bigger labels on mobile */
    .wcbc-option-card__label { font-size: 11px; }

    /* Ensure touch targets */
    .wcbc-option-card { min-height: 44px; }

    /* Panel: single column layout adjustments */
    .wcbc-panel__header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .wcbc-panel__select-btn {
        width: 100%;
        text-align: center;
    }

    /* Toast — above home indicator */
    .wcbc-toast { bottom: 100px; }
}

/* ============================================================
   21. Responsive — Small Mobile (≤360px)
   ============================================================ */

@media (max-width: 360px) {
    .wcbc-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .wcbc-option-card { padding: 7px 6px 8px; }

    .wcbc-modal__title { font-size: 14px !important; }
}

/* ============================================================
   22. prefers-reduced-motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    /* Kill all transitions */
    .wcbc-modal-overlay,
    .wcbc-modal,
    .wcbc-option-card,
    .wcbc-option-card__image,
    .wcbc-modal__done-btn,
    .wcbc-panel__select-btn,
    .wcbc-step-pane,
    .wcbc-modal__tab,
    .wcbc-modal__tab-count,
    .wcbc-pane-counter {
        transition: none !important;
    }

    /* Kill all animations */
    .wcbc-modal,
    .wcbc-step-pane,
    .wcbc-step-pane--enter-forward,
    .wcbc-step-pane--enter-backward,
    .wcbc-step-pane--enter-restore,
    .wcbc-option-card--pulse,
    .wcbc-modal__done-btn.wcbc-done--ready,
    .wcbc-panel--shake,
    .wcbc-panel__validation-summary,
    .wcbc-panel__step-error,
    .wcbc-option-card--validating::after {
        animation: none !important;
    }

    /* Ensure open state is immediately visible */
    .wcbc-modal-overlay.wcbc-modal--open {
        opacity: 1;
    }

    .wcbc-modal-overlay.wcbc-modal--open .wcbc-modal {
        transform: none;
        opacity: 1;
    }

    /* Mobile: no slide */
    @media (max-width: 520px) {
        .wcbc-modal-overlay.wcbc-modal--open .wcbc-modal {
            transform: none;
        }
    }
}
