/* =============================================================================
 *  Wulks Product Card  —  card.css  v1.0.0
 *
 *  .wpc-card      — desktop card (always inline in Elementor column)
 *  .wpc-bar       — mobile sticky bar (position:fixed bottom, hidden on desktop)
 *  .wpc-drawer    — mobile slide-up drawer
 * ============================================================================= */

:root {
    --wpc-orange:      #e8730a;
    --wpc-orange-dark: #c9620a;
    --wpc-orange-bg:   #fdf5ef;
    --wpc-text:        #111827;
    --wpc-muted:       #6b7280;
    --wpc-light:       #9ca3af;
    --wpc-border:      #e5e7eb;
    --wpc-bg:          #ffffff;
    --wpc-surface:     #f9fafb;
    --wpc-radius:      12px;
    --wpc-radius-sm:   7px;
    --wpc-shadow:      0 12px 32px rgba(0,0,0,0.10);
    --wpc-t:           0.22s ease;
}

/* ── Editor placeholder ──────────────────────────────────────────────────────*/
.wpc-editor-placeholder {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 200px; gap: 12px;
    background: #f3f4f6; border: 2px dashed #d1d5db;
    border-radius: 12px; color: #9ca3af;
    font-size: 14px; text-align: center; padding: 24px;
}
.wpc-editor-placeholder .eicon-cart { font-size: 40px; color: #d1d5db; }

/* ══════════════════════════════════════════════════════════════════════════════
   DESKTOP CARD
   Sits inline in an Elementor column. Elementor handles position/width.
   The orange border matches the Wulks product card hover state (style.css).
   ══════════════════════════════════════════════════════════════════════════════ */
.wpc-card {
    background: var(--wpc-bg);
    border: 1px solid var(--wpc-orange);
    border-radius: var(--wpc-radius);
    box-shadow: var(--wpc-shadow);
    padding: 20px 20px 18px;
    box-sizing: border-box;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────────────*/
.wpc-header {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.wpc-name {
    font-size: 14px; font-weight: 700; color: var(--wpc-text);
    line-height: 1.35; margin: 0; flex: 1;
}
.wpc-brand {
    flex-shrink: 0; font-size: 10px; font-weight: 700;
    color: var(--wpc-orange); background: var(--wpc-orange-bg);
    padding: 2px 8px; border-radius: 20px;
    letter-spacing: 0.04em; text-transform: uppercase; margin-top: 1px;
}

/* ── Price ───────────────────────────────────────────────────────────────────*/
.wpc-price-row {
    display: flex; align-items: baseline; gap: 8px;
    margin: 10px 0 14px; flex-wrap: wrap;
}
.wpc-price {
    font-size: 22px; font-weight: 700; color: var(--wpc-orange); line-height: 1;
}
.wpc-price-was {
    font-size: 13px; color: var(--wpc-light); text-decoration: line-through;
}
.wpc-price-save {
    font-size: 11px; font-weight: 700; color: #16a34a;
    background: #dcfce7; padding: 2px 7px; border-radius: 20px; margin-left: auto;
}

/* ── Divider ─────────────────────────────────────────────────────────────────*/
.wpc-divider { border: none; border-top: 1px solid var(--wpc-border); margin: 14px 0; }

/* ── Labels ──────────────────────────────────────────────────────────────────*/
.wpc-label {
    font-size: 10px; font-weight: 700; color: var(--wpc-muted);
    text-transform: uppercase; letter-spacing: 0.07em;
    margin: 4px 0 8px; display: block; line-height: 1;
}

/* ── Colour swatches ─────────────────────────────────────────────────────────*/
.wpc-swatches {
    display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap;
}
.wpc-swatch {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid transparent; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    transition: transform var(--wpc-t), box-shadow var(--wpc-t);
    flex-shrink: 0; outline: none;
}
.wpc-swatch.is-selected {
    border-color: var(--wpc-orange);
    box-shadow: 0 0 0 2px var(--wpc-bg), 0 0 0 4px var(--wpc-orange);
}
.wpc-swatch:hover:not(.is-selected) { transform: scale(1.15); }
.wpc-swatch:focus-visible { outline: 2px solid var(--wpc-orange); outline-offset: 3px; }

/* ── Size buttons ────────────────────────────────────────────────────────────*/
.wpc-sizes {
    display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap;
}
.wpc-size-btn {
    flex: 1; min-width: 48px; padding: 8px 6px;
    font-size: 12px; font-weight: 600; color: var(--wpc-muted);
    background: var(--wpc-surface); border: 1px solid var(--wpc-border);
    border-radius: var(--wpc-radius-sm); cursor: pointer; text-align: center;
    line-height: 1; transition: background var(--wpc-t), border-color var(--wpc-t), color var(--wpc-t);
    font-family: inherit; outline: none;
}
.wpc-size-btn.is-selected { background: var(--wpc-text); border-color: var(--wpc-text); color: #fff; }
.wpc-size-btn:hover:not(.is-selected) {
    border-color: var(--wpc-orange); color: var(--wpc-orange); background: var(--wpc-orange-bg);
}
.wpc-size-btn:focus-visible { outline: 2px solid var(--wpc-orange); outline-offset: 2px; }

/* ── Quantity stepper ────────────────────────────────────────────────────────*/
.wpc-qty {
    display: flex; align-items: center; margin-bottom: 14px;
    border: 1px solid var(--wpc-border); border-radius: var(--wpc-radius-sm);
    overflow: hidden; width: fit-content;
}
.wpc-qty-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: var(--wpc-surface); border: none; cursor: pointer;
    font-size: 18px; color: var(--wpc-muted); font-family: inherit;
    transition: background var(--wpc-t), color var(--wpc-t);
    user-select: none; outline: none;
}
.wpc-qty-btn:hover { background: var(--wpc-orange-bg); color: var(--wpc-orange); }
.wpc-qty-btn:focus-visible { outline: 2px solid var(--wpc-orange); outline-offset: -2px; }
.wpc-qty-input {
    width: 44px; height: 36px; border: none;
    border-left: 1px solid var(--wpc-border); border-right: 1px solid var(--wpc-border);
    text-align: center; font-size: 14px; font-weight: 700;
    color: var(--wpc-text); background: var(--wpc-bg); outline: none;
    -moz-appearance: textfield; font-family: inherit;
}
.wpc-qty-input::-webkit-inner-spin-button,
.wpc-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── CTAs ────────────────────────────────────────────────────────────────────*/
.wpc-btn-cart {
    display: block; width: 100%; padding: 11px;
    background: var(--wpc-orange); color: #fff; border: none;
    border-radius: var(--wpc-radius-sm); font-size: 14px; font-weight: 700;
    text-align: center; cursor: pointer; margin-bottom: 8px;
    transition: background var(--wpc-t), transform 0.12s;
    font-family: inherit; line-height: 1.4; outline: none;
}
.wpc-btn-cart:hover:not(:disabled) { background: var(--wpc-orange-dark); }
.wpc-btn-cart:active:not(:disabled) { transform: scale(0.985); }
.wpc-btn-cart:disabled { opacity: 0.55; cursor: not-allowed; }
.wpc-btn-cart:focus-visible { outline: 2px solid var(--wpc-orange); outline-offset: 3px; }

.wpc-btn-buy {
    display: block; width: 100%; padding: 10px;
    background: transparent; color: var(--wpc-text);
    border: 1px solid var(--wpc-border); border-radius: var(--wpc-radius-sm);
    font-size: 13px; font-weight: 600; text-align: center;
    cursor: pointer; text-decoration: none;
    transition: background var(--wpc-t), border-color var(--wpc-t);
    font-family: inherit; line-height: 1.4; outline: none;
}
.wpc-btn-buy:hover { background: var(--wpc-surface); border-color: var(--wpc-muted); }
.wpc-btn-buy:focus-visible { outline: 2px solid var(--wpc-orange); outline-offset: 2px; }

/* ── Stock status ────────────────────────────────────────────────────────────*/
.wpc-stock {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #16a34a; margin-top: 12px;
}
.wpc-stock::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: #16a34a; flex-shrink: 0;
}
.wpc-stock--low             { color: #d97706; }
.wpc-stock--low::before     { background: #d97706; }
.wpc-stock--out             { color: #dc2626; }
.wpc-stock--out::before     { background: #dc2626; }

/* ── Trust signals ───────────────────────────────────────────────────────────*/
.wpc-trust { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.wpc-trust-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--wpc-muted);
}
.wpc-trust-item svg { flex-shrink: 0; color: var(--wpc-orange); }

/* ── Add to cart loading/success states ──────────────────────────────────────*/
.wpc-btn-cart.is-loading {
    pointer-events: none; opacity: 0.8; color: transparent; position: relative;
}
.wpc-btn-cart.is-loading::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
    border-radius: 50%; animation: wpc-spin 0.7s linear infinite;
}
@keyframes wpc-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.wpc-btn-cart.is-success { background: #16a34a; pointer-events: none; }

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE STICKY BAR  (hidden on desktop)
   ══════════════════════════════════════════════════════════════════════════════ */
.wpc-bar    { display: none; }
.wpc-drawer { display: none; }
.wpc-drawer-backdrop { display: none; }

@media (max-width: 768px) {

    /* Hide desktop card on mobile */
    .wpc-card { display: none !important; }

    /* ── Sticky bar ────────────────────────────────────────────────────────── */
    .wpc-bar {
        display: block;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--wpc-bg);
        border-top: 2px solid var(--wpc-orange);
        box-shadow: 0 -6px 24px rgba(0,0,0,0.10);
        padding: 12px 16px 20px;
        z-index: 900;
        box-sizing: border-box;
    }
    .wpc-bar-top {
        display: flex; align-items: baseline;
        justify-content: space-between; gap: 8px; margin-bottom: 10px;
    }
    .wpc-bar-name {
        font-size: 13px; font-weight: 700; color: var(--wpc-text);
        flex: 1; min-width: 0; overflow: hidden;
        white-space: nowrap; text-overflow: ellipsis;
    }
    .wpc-bar-price {
        font-size: 16px; font-weight: 700; color: var(--wpc-orange);
        white-space: nowrap; flex-shrink: 0;
    }
    .wpc-bar-row { display: flex; gap: 8px; align-items: stretch; }

    .wpc-bar-summary {
        flex: 1; display: flex; align-items: center; justify-content: space-between;
        gap: 6px; padding: 9px 12px;
        background: var(--wpc-surface); border: 1px solid var(--wpc-border);
        border-radius: var(--wpc-radius-sm); font-size: 13px; color: var(--wpc-muted);
        cursor: pointer; min-width: 0; overflow: hidden;
        transition: border-color var(--wpc-t), background var(--wpc-t);
        font-family: inherit; outline: none;
    }
    .wpc-bar-summary:hover { border-color: var(--wpc-orange); background: var(--wpc-orange-bg); }
    .wpc-bar-summary-text {
        overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    }
    .wpc-bar-btn {
        flex-shrink: 0; padding: 10px 18px;
        background: var(--wpc-orange); color: #fff;
        border: none; border-radius: var(--wpc-radius-sm);
        font-size: 13px; font-weight: 700; cursor: pointer;
        transition: background var(--wpc-t);
        font-family: inherit; outline: none;
    }
    .wpc-bar-btn:hover:not(:disabled) { background: var(--wpc-orange-dark); }
    .wpc-bar-btn:disabled { opacity: 0.55; cursor: not-allowed; }

    /* ── Drawer ────────────────────────────────────────────────────────────── */
    .wpc-drawer-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(0,0,0,0.4); z-index: 898;
        opacity: 0; pointer-events: none;
        transition: opacity 0.28s ease;
    }
    .wpc-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

    .wpc-drawer {
        display: block;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--wpc-bg);
        border-top: 1px solid var(--wpc-orange);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px rgba(0,0,0,0.14);
        padding: 0 20px 120px;
        max-height: 80vh; overflow-y: auto;
        z-index: 899;
        transform: translateY(100%);
        transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
        box-sizing: border-box;
    }
    .wpc-drawer.is-open { transform: translateY(0); }

    .wpc-drawer-handle {
        width: 36px; height: 4px; background: var(--wpc-border);
        border-radius: 999px; margin: 14px auto 20px;
    }
    .wpc-drawer-name {
        font-size: 15px; font-weight: 700; color: var(--wpc-text); margin: 0 0 6px;
    }
    .wpc-drawer-price {
        font-size: 18px; font-weight: 700; color: var(--wpc-orange); margin-bottom: 20px;
    }
    .wpc-drawer .wpc-qty { width: 100%; }
    .wpc-drawer .wpc-qty-input { flex: 1; }
    .wpc-drawer .wpc-btn-cart { font-size: 15px; padding: 13px; margin-top: 8px; }
    .wpc-drawer .wpc-btn-buy  { font-size: 14px; padding: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .wpc-card, .wpc-swatch, .wpc-size-btn, .wpc-btn-cart, .wpc-btn-buy,
    .wpc-bar-summary, .wpc-drawer, .wpc-drawer-backdrop { transition: none !important; }
}
