/* ================================================================
   WC Product Add-ons Pro – Frontend Product Page Styles
   ================================================================ */

/* ── Wrapper ──────────────────────────────────────────────────── */

.wcpa-addons-wrapper {
    margin: 0 0 22px;
    font-family: inherit;
}

/* ── Section Heading ─────────────────────────────────────────── */

.wcpa-addons-heading {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    margin-bottom: 12px;
}
.wcpa-addons-heading-icon {
    color: #6366f1;
    font-size: 10px;
}

/* ── Add-on Box ───────────────────────────────────────────────── */

.wcpa-addons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcpa-addon-box {
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .18s ease, background .2s ease;
    position: relative;
}

.wcpa-addon-box:hover {
    border-color: #a5b4fc;
    box-shadow: 0 2px 14px rgba(99, 102, 241, .1);
    transform: translateY(-1px);
}

/* Selected state */
.wcpa-addon-box.wcpa-selected {
    border-color: #6366f1;
    background: linear-gradient(135deg, #f8f7ff 0%, #f0effe 100%);
    box-shadow: 0 4px 18px rgba(99, 102, 241, .16);
    transform: translateY(-1px);
}

.wcpa-addon-box.wcpa-selected .wcpa-addon-icon {
    box-shadow: 0 4px 12px rgba(99, 102, 241, .35);
}

/* ── Label (flex container) ───────────────────────────────────── */

.wcpa-addon-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* ── Icon ─────────────────────────────────────────────────────── */

.wcpa-addon-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 18px;
    transition: box-shadow .2s;
}

.wcpa-addon-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 5px;
}

/* ── Content ──────────────────────────────────────────────────── */

.wcpa-addon-content {
    flex: 1;
    min-width: 0;
}

.wcpa-addon-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    margin-bottom: 3px;
}

.wcpa-addon-desc {
    display: block;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.45;
}

/* ── Right side (price + checkbox) ───────────────────────────── */

.wcpa-addon-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.wcpa-addon-price {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    line-height: 1;
}

.wcpa-price-fixed  { color: #4f46e5; }
.wcpa-price-pct    { color: #d97706; }
.wcpa-price-free   { color: #059669; font-weight: 700; }

/* ── Custom Checkbox ──────────────────────────────────────────── */

.wcpa-checkbox-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcpa-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.wcpa-checkbox-custom {
    width: 23px;
    height: 23px;
    border: 2px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

/* Hover state for checkbox */
.wcpa-addon-box:hover .wcpa-checkbox-custom {
    border-color: #a5b4fc;
}

/* Checked state */
.wcpa-checkbox:checked + .wcpa-checkbox-custom {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99,102,241,.4);
    transform: scale(1.05);
}

/* Checkmark */
.wcpa-checkbox:checked + .wcpa-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2.5px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
    display: block;
}

/* ── Extras Summary Bar ───────────────────────────────────────── */

.wcpa-extras-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0effe 0%, #ede9fe 100%);
    border: 1.5px solid #c4b5fd;
    border-radius: 10px;
    animation: wcpa-slide-in .2s ease;
}

@keyframes wcpa-slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wcpa-extras-label {
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.wcpa-extras-total {
    font-size: 16px;
    font-weight: 800;
    color: #4f46e5;
}

/* ── Reward / Building Blocks Section ────────────────────────── */

.wcpa-reward-section {
    margin-top: 10px;
    padding: 14px 16px;
    background: #fdfcff;
    border: 1.5px solid #ddd6fe;
    border-radius: 12px;
    animation: wcpa-slide-in .22s ease;
}

/* ── Blocks Row ───────────────────────────────────────────────── */

.wcpa-reward-blocks {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.wcpa-block {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    transition: all .28s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    flex-shrink: 0;
}

/* Filled block */
.wcpa-block.wcpa-block-filled {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .35);
    transform: scale(1.08);
}

/* Milestone block (last block of a tier) – slightly larger */
.wcpa-block.wcpa-block-milestone {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

/* Milestone filled */
.wcpa-block.wcpa-block-milestone.wcpa-block-filled::after {
    content: '★';
    position: absolute;
    top: -8px;
    right: -6px;
    font-size: 12px;
    color: #f59e0b;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
    animation: wcpa-star-pop .35s ease;
}

@keyframes wcpa-star-pop {
    from { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.4); }
    to   { transform: scale(1); opacity: 1; }
}

/* Block count label */
.wcpa-block-count {
    font-size: 12px;
    font-weight: 700;
    color: #7c3aed;
    margin-left: 6px;
    white-space: nowrap;
}

/* ── Reward Text ──────────────────────────────────────────────── */

.wcpa-reward-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wcpa-reward-msg {
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    line-height: 1.5;
}

.wcpa-reward-msg strong {
    color: #4f46e5;
}

.wcpa-reward-earned {
    color: #059669;
}
.wcpa-reward-earned strong {
    color: #047857;
}

.wcpa-reward-next {
    color: #7c3aed;
    font-size: 11px;
    font-weight: 500;
}

.wcpa-reward-all-done {
    color: #d97706;
    font-size: 13px;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 480px) {
    .wcpa-addon-label    { gap: 10px; padding: 12px 13px; }
    .wcpa-addon-icon     { width: 38px; height: 38px; font-size: 15px; border-radius: 9px; }
    .wcpa-addon-name     { font-size: 13px; }
    .wcpa-addon-desc     { font-size: 11px; }
    .wcpa-addon-price    { font-size: 12px; }
    .wcpa-checkbox-custom{ width: 21px; height: 21px; }
}

/* ── Sticky bar safety net ────────────────────────────────────
   JS marks cloned wrappers with .wcpa-in-sticky.
   As a belt-and-suspenders fallback, also target the most common
   sticky/fixed container selectors used by WooCommerce themes.
   ─────────────────────────────────────────────────────────── */

/* JS-applied class */
.wcpa-addons-wrapper.wcpa-in-sticky,
.wcpa-in-sticky .wcpa-addons-list,
.wcpa-in-sticky .wcpa-addons-heading,
.wcpa-in-sticky .wcpa-extras-summary {
    display: none !important;
}

/* Broad fallback — catches Elessi, Flatsome, Divi, Porto, etc. */
[class*="sticky-add-to-cart"]   .wcpa-addons-wrapper,
[class*="sticky_add_to_cart"]   .wcpa-addons-wrapper,
[id*="sticky-add-to-cart"]      .wcpa-addons-wrapper,
[id*="sticky_add_to_cart"]      .wcpa-addons-wrapper,
[class*="sticky-atc"]           .wcpa-addons-wrapper,
[class*="sticky_atc"]           .wcpa-addons-wrapper,
.sticky-product-info            .wcpa-addons-wrapper,
.product-sticky-summary         .wcpa-addons-wrapper,
.es-sticky-add-to-cart          .wcpa-addons-wrapper,
.single-sticky-atc              .wcpa-addons-wrapper,
.woocommerce-sticky-add-to-cart .wcpa-addons-wrapper {
    display: none !important;
}
