/* ═══════════════════════════════════════════════════════════════════════════
   PCLP Fashion Bundle — Frontend Styles  (Accordion UI)
   All rules scoped to body.pclp-landing-active to prevent bleeding.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
body.pclp-landing-active .pclp-fashion-bundle {
    margin: 0 0 20px;
    direction: rtl;
    font-family: inherit;
}

body.pclp-landing-active .pfb-main-heading {
    font-size: clamp(17px, 3.5vw, 22px);
    font-weight: 800;
    color: #1f2a44;
    margin: 0 0 14px;
    text-align: center;
}

/* ── Accordion Container ─────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

/* ── Accordion Item ──────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-accordion-item {
    border: 2px solid #dbe5f1;
    border-radius: 14px;
    background: #f8fafc;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open {
    border-color: var(--pclp-form-accent, #1f7a3a);
    background: #fff;
    box-shadow: 0 4px 20px rgba(31, 122, 58, .13);
}

/* ── Accordion Header ────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}

body.pclp-landing-active .pfb-accordion-header:hover {
    background: rgba(31, 122, 58, .04);
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open .pfb-accordion-header {
    border-bottom: 1px solid #e9f0f8;
    padding-bottom: 13px;
}

/* Left side: title + badge */
body.pclp-landing-active .pfb-acc-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

body.pclp-landing-active .pfb-acc-title {
    font-size: 15px;
    font-weight: 800;
    color: #1f2a44;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .2s;
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open .pfb-acc-title {
    color: var(--pclp-form-accent, #1f7a3a);
}

body.pclp-landing-active .pfb-acc-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

/* Right side: prices + arrow */
body.pclp-landing-active .pfb-acc-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

body.pclp-landing-active .pfb-acc-regular {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: line-through;
}

body.pclp-landing-active .pfb-acc-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--pclp-form-accent, #1f7a3a);
    white-space: nowrap;
}

/* Arrow — rotates when open */
body.pclp-landing-active .pfb-acc-arrow {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .25s;
}

body.pclp-landing-active .pfb-acc-arrow::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg) translate(-1px, -2px);
    transition: border-color .2s, transform .25s;
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open .pfb-acc-arrow {
    background: var(--pclp-form-accent, #1f7a3a);
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open .pfb-acc-arrow::after {
    border-color: #fff;
    transform: rotate(-135deg) translate(-1px, -2px);
}

/* ── Accordion Body ──────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-accordion-body {
    display: none;
    padding: 16px;
}

body.pclp-landing-active .pfb-accordion-item.pfb-acc--open .pfb-accordion-body {
    display: block;
}

/* ── Pieces Grid ─────────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-pieces {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

/* ── Single Piece Card ───────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-piece-card {
    background: #fff;
    border: 1.5px solid #dbe5f1;
    border-radius: 12px;
    padding: 14px 16px;
    transition: border-color .18s;
}

body.pclp-landing-active .pfb-piece-card:focus-within {
    border-color: var(--pclp-form-accent, #1f7a3a);
}

body.pclp-landing-active .pfb-piece-heading {
    font-size: 13px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Attribute Block ─────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-attr-block {
    margin-bottom: 12px;
}

body.pclp-landing-active .pfb-attr-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

body.pclp-landing-active .pfb-attr-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start; /* image swatches are taller than text buttons */
}

/* ── Image Swatches (.pfb-opt--img) ──────────────────────────────────────── */
/*
  Renders a variation image inside a rounded square swatch.
  The colour name appears below the image as a small label.
  Clicking the swatch selects the colour — variation_id is resolved
  after the size attribute is also chosen.
*/

body.pclp-landing-active .pfb-opt--img {
    /* Reset button defaults */
    appearance: none;
    -webkit-appearance: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;

    /* Layout: image on top, label below */
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;

    /* Width is set by JS inline style (btnPx) to guarantee size regardless of theme CSS.
       We keep min/max as guard rails only. */
    min-width: 0;
    cursor: pointer;
    border: 2.5px solid transparent;
    border-radius: 10px;
    transition: border-color .18s, box-shadow .18s, opacity .18s, transform .1s;
    outline: none;
    position: relative;
    flex-shrink: 0;
}

body.pclp-landing-active .pfb-opt--img:hover:not(:disabled) {
    transform: scale(1.07);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
}

body.pclp-landing-active .pfb-opt--img img {
    display: block;
    /* width & height set by JS inline style (swatchPx) — overrides any theme img rules */
    object-fit: cover;
    border-radius: 8px;
    pointer-events: none;
    background: #f1f5f9; /* placeholder while loading */
    flex-shrink: 0;
}

/* Label below image — element only rendered when show_color_label='yes' (JS-controlled) */
body.pclp-landing-active .pfb-opt-img-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* max-width set by JS inline style (btnPx) to match button width */
    line-height: 1.2;
    pointer-events: none;
}

/* Selected state */
body.pclp-landing-active .pfb-opt--img.pfb-opt--selected {
    border-color: var(--pclp-form-accent, #1f7a3a);
    box-shadow: 0 0 0 3px rgba(31, 122, 58, .22);
}

body.pclp-landing-active .pfb-opt--img.pfb-opt--selected .pfb-opt-img-label {
    color: var(--pclp-form-accent, #1f7a3a);
    font-weight: 700;
}

/* Unavailable state */
body.pclp-landing-active .pfb-opt--img.pfb-opt--unavail {
    opacity: .35;
    cursor: not-allowed;
    transform: none;
}

body.pclp-landing-active .pfb-opt--img.pfb-opt--unavail img {
    filter: grayscale(60%);
}

/* ── Text Buttons (.pfb-opt--text  +  size/other attrs .pfb-opt in pfb-type-button) ── */
/*
  Used for:
  - size / non-colour attributes (container class pfb-type-button)
  - colour attrs without an image (fallback in auto mode)
*/

body.pclp-landing-active .pfb-opt--text,
body.pclp-landing-active .pfb-type-button .pfb-opt {
    min-width: 42px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1.5px solid #dbe5f1;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
    line-height: 1;
}

body.pclp-landing-active .pfb-opt--text:hover:not(:disabled),
body.pclp-landing-active .pfb-type-button .pfb-opt:hover:not(:disabled) {
    border-color: var(--pclp-form-accent, #1f7a3a);
    background: #f0fdf4;
    color: var(--pclp-form-accent, #1f7a3a);
}

body.pclp-landing-active .pfb-opt--text.pfb-opt--selected,
body.pclp-landing-active .pfb-type-button .pfb-opt.pfb-opt--selected {
    border-color: var(--pclp-form-accent, #1f7a3a);
    background: var(--pclp-form-accent, #1f7a3a);
    color: #fff;
}

body.pclp-landing-active .pfb-opt--text.pfb-opt--unavail,
body.pclp-landing-active .pfb-type-button .pfb-opt.pfb-opt--unavail {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #c0ccd9;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ── Stock Indicator ─────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-piece-stock {
    font-size: 12px;
    font-weight: 700;
    min-height: 18px;
    margin-top: 6px;
    transition: color .2s;
}

body.pclp-landing-active .pfb-stock--ok  { color: #16a34a; }
body.pclp-landing-active .pfb-stock--err { color: #dc2626; }

/* ── Message ─────────────────────────────────────────────────────────────── */
body.pclp-landing-active .pfb-msg {
    min-height: 22px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    padding: 0 4px;
    transition: color .2s;
}

body.pclp-landing-active .pfb-msg--error   { color: #dc2626; }
body.pclp-landing-active .pfb-msg--success { color: #16a34a; }

/* ── Add-to-Cart Button ──────────────────────────────────────────────────── */

/* Pulse glow animation — plays when button is ready to draw attention */
@keyframes pfb-btn-pulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(31, 122, 58, .30),
                    0 0 0 0   rgba(31, 122, 58, .40);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 26px rgba(31, 122, 58, .45),
                    0 0 0 8px rgba(31, 122, 58, 0);
        transform: scale(1.018);
    }
}

/* Shimmer sweep across the button */
@keyframes pfb-btn-shine {
    0%        { left: -80%; }
    40%, 100% { left: 120%; }
}

body.pclp-landing-active .pfb-add-btn {
    display: block;
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    background: #cbd5e1;
    color: #64748b;
    font-size: clamp(15px, 3.5vw, 18px);
    font-weight: 800;
    cursor: not-allowed;
    transition: background .25s, color .25s, box-shadow .25s, transform .1s;
    text-align: center;
    letter-spacing: .02em;
    position: relative;
    overflow: hidden;
}

body.pclp-landing-active .pfb-add-btn.pfb-add-btn--ready {
    background: var(--pclp-form-btn-bg, linear-gradient(135deg, #1f7a3a, #2f9b4d));
    color: #fff;
    cursor: pointer;
    /* Pulse + glow loop to invite the click */
    animation: pfb-btn-pulse 2.2s ease-in-out infinite;
}

/* Shimmer sweep pseudo-element */
body.pclp-landing-active .pfb-add-btn.pfb-add-btn--ready::after {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 20%,
        rgba(255, 255, 255, .28) 50%,
        transparent 80%
    );
    animation: pfb-btn-shine 2.8s ease-in-out infinite;
    pointer-events: none;
}

/* Stop pulse on hover — show a clear pressed feel instead */
body.pclp-landing-active .pfb-add-btn.pfb-add-btn--ready:hover {
    animation: none;
    opacity: .93;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(31, 122, 58, .40);
}

body.pclp-landing-active .pfb-add-btn.pfb-add-btn--ready:active {
    animation: none;
    transform: translateY(0) scale(.98);
    box-shadow: 0 4px 14px rgba(31, 122, 58, .30);
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    body.pclp-landing-active .pfb-pieces {
        grid-template-columns: 1fr;
    }

    body.pclp-landing-active .pfb-accordion-header {
        padding: 12px 14px;
    }

    body.pclp-landing-active .pfb-acc-title {
        font-size: 13px;
    }

    body.pclp-landing-active .pfb-acc-price {
        font-size: 14px;
    }

    body.pclp-landing-active .pfb-acc-regular {
        display: none; /* simplify on very small screens */
    }

    /* Swatch sizes on mobile are controlled by JS (inline style).
       Only tweak the label font size here. */
    body.pclp-landing-active .pfb-opt-img-label {
        font-size: 9px;
    }
}
