/* ============================================================
   PDP.CSS — Product Detail Page Styles (Consolidated)
   Single source of truth for all PDP layout, components, and
   responsive overrides. Extracted from style.css, ui-components.css
   and detail.php inline styles.

   JIIN 2.0 Design Token Integration:
   - All colors use CSS variables from design-tokens.css
   - Breakpoints standardized: 480 / 768 / 1024
   - !important usage minimized
   - WCAG 2.1 focus-visible compliance
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   1. MASTER GRID ARCHITECTURE (JIIN 2.0)
   3-Column Layout: Media | Content | Sidebar
   ──────────────────────────────────────────────────────────── */
.pdp-master-grid {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr) minmax(0, 280px);
    grid-template-areas:
        "product_media product_content variant_options"
        "product_media ticker_info variant_options"
        "product_media new_variant_options variant_options"
        "product_media product_detail variant_options"
        "product_media shop_credibility variant_options"
        "product_media shipment_v4 variant_options"
        "product_media shipping variant_options"
        "product_media offerings variant_options"
        "product_media QRCode variant_options"
        "product_media report variant_options"
        "product_detail_media product_detail_media variant_options"
        "review review variant_options"
        "tdn_topads tdn_topads variant_options"
        "pdp_1 pdp_1 pdp_1"
        "pdp_2 pdp_2 pdp_2"
        "pdp_3 pdp_3 pdp_3"
        "pdp_4 pdp_4 pdp_4";
    column-gap: 40px;
    row-gap: 0;
}

.pdp-area-media {
    grid-area: product_media;
}

.pdp-area-content {
    grid-area: product_content;
}

.pdp-area-sidebar {
    grid-area: variant_options;
}

.pdp-area-detail {
    grid-area: product_detail;
}

.pdp-area-review {
    grid-area: review;
}

/* Responsive: Stack vertically on tablet/mobile */
@media (max-width: 1024px) {
    .pdp-master-grid {
        display: flex;
        flex-direction: column;
        grid-template-areas: none;
        gap: 24px;
    }
}


/* ────────────────────────────────────────────────────────────
   2. STICKY SIDEBAR (Buy Box)
   ──────────────────────────────────────────────────────────── */
.pdp-sticky-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    z-index: 10;
    border-color: var(--slate-200);
    background: var(--white);
}

@media (max-width: 1024px) {
    .pdp-sticky-sidebar {
        position: static;
    }
}


/* ────────────────────────────────────────────────────────────
   3. TITLE, PRICE & META
   ──────────────────────────────────────────────────────────── */
.pdp-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 12px;
}

.pdp-title-row h1 {
    font-size: 16px;
    font-weight: 500;
    color: var(--slate-700);
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

.pdp-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.pdp-main-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--slate-800);
}

.pdp-strike-price {
    font-size: 14px;
    color: var(--slate-400);
    text-decoration: line-through;
    margin-top: 8px;
}

.pdp-discount-tag {
    font-size: 12px;
    font-weight: 800;
    color: var(--red-500, #ef4444);
    margin-top: 8px;
}

/* Discount Circle Badge (on main image) — CSS-008 FIX: parent must have position:relative */
.pdp-main-badge-circle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    width: 32px;
    height: 32px;
    background: var(--red-500, #ef4444);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    border: 2px solid var(--white);
}

/* Ensure badge parent has positioning context — CSS-008 FIX */
.main-image {
    position: relative;
}

/* Kill legacy redundant badges */
.product-price .discount-badge,
.product-price .promo-badge,
.product-price .badge-promo {
    display: none !important;
}

/* Price accent color */
.product-price .price {
    color: var(--primary);
}


/* ────────────────────────────────────────────────────────────
   4. BADGES & SOCIAL PROOF
   ──────────────────────────────────────────────────────────── */
.pdp-meta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pdp-badge {
    background: var(--slate-100, #f1f5f9);
    color: var(--slate-500, #64748b);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.pdp-social-proof {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--slate-500, #64748b);
    margin-bottom: 20px;
}

.pdp-social-proof i {
    color: var(--amber-500, #f59e0b);
}

.pdp-social-proof .separator {
    color: var(--slate-200, #e2e8f0);
}


/* ────────────────────────────────────────────────────────────
   5. WISHLIST BUTTON
   ──────────────────────────────────────────────────────────── */
.pdp-wishlist-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--slate-400, #94a3b8);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.pdp-wishlist-btn.active {
    color: var(--red-500, #ef4444);
}


/* ────────────────────────────────────────────────────────────
   6. VARIANT CHIPS (Nexus V2 Luxe)
   Single source of truth for variant selector buttons.
   CSS-001 FIX: border-radius set to final value (no override).
   CSS-002 FIX: box-shadow allowed on .active state.
   ──────────────────────────────────────────────────────────── */
.btn-variant-nexus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 8px 20px;
    border: 1px solid var(--slate-200, #e2e8f0);
    background: var(--white);
    border-radius: 0;
    /* CSS-001 FIX: Sharp aesthetic — set once, no override */
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--slate-600, #475569);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-variant-nexus:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--slate-50, #f8fafc);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-variant-nexus.active {
    border-color: var(--primary);
    background: #f5f3ff;
    color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 12px rgba(99, 102, 241, 0.15);
    /* CSS-002 FIX: No longer killed */
}

.btn-variant-nexus:disabled,
.btn-variant-nexus.variant-disabled {
    cursor: not-allowed;
    background: var(--slate-100, #f1f5f9);
    color: var(--slate-400, #94a3b8);
    /* 4.08:1 on slate-100 ✅ */
    border-color: var(--slate-100, #f1f5f9);
    pointer-events: none;
    /* Prevent click entirely */
}

/* CSS-003 FIX: WCAG 2.1 §2.4.7 — visible focus indicator */
.btn-variant-nexus:focus-visible {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary);
}

/* Variant mini-icons & swatches */
.variant-icon-mini {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 8px;
    object-fit: cover;
    background: var(--slate-100, #f1f5f9);
}

.variant-swatch-mini {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Promo badge on variant chip */
.promo-badge-chip {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--red-500, #ef4444);
    color: var(--white);
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    z-index: 2;
}


/* ────────────────────────────────────────────────────────────
   7. VARIANT SECTION HEADER
   CSS-006 FIX: Removed dead .btn-variant-modern and
   .pdp-main-grid legacy code. Only kept active components.
   ──────────────────────────────────────────────────────────── */
.variant-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--slate-100, #f1f5f9);
}

.variant-section-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--slate-800, #1e293b);
    margin: 0;
}

.variant-section-header .variant-count {
    color: var(--slate-500, #64748b);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Horizontal variant card scroll */
.variant-card-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 15px;
    scrollbar-width: none;
}

.variant-card-container::-webkit-scrollbar {
    display: none;
}

.variant-card-modern {
    flex: 0 0 auto;
    width: 130px;
    border: 1px solid var(--slate-200, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
}

.variant-card-modern:hover {
    border-color: var(--primary);
}

.variant-card-modern.active {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 1px var(--primary);
}

.variant-card-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: var(--slate-50, #f8fafc);
    border-bottom: 1px solid var(--slate-100, #f1f5f9);
}

.variant-card-label {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700, #334155);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ────────────────────────────────────────────────────────────
   8. TABS (Description, Specs, Reviews)
   ──────────────────────────────────────────────────────────── */
.pdp-tabs {
    display: flex;
    border-bottom: 1px solid var(--slate-200, #e2e8f0);
    margin-bottom: 20px;
    overflow-x: auto;
}

.pdp-tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 600;
    color: var(--slate-500, #64748b);
    cursor: pointer;
    white-space: nowrap;
}

.pdp-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}


/* ────────────────────────────────────────────────────────────
   9. QUANTITY ROW
   ──────────────────────────────────────────────────────────── */
.qty-stock-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.subtotal-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--slate-500);
}


/* ────────────────────────────────────────────────────────────
   10. ACTION BUTTONS (Cart + Buy Now)
   CSS-001 FIX: border-radius set to 0 directly, no conflict.
   CSS-003 FIX: focus-visible restored for accessibility.
   CSS-007 FIX: !important reduced — only kept where necessary.
   ──────────────────────────────────────────────────────────── */
.btn-add-to-cart-luxe,
.btn-buy-now-luxe {
    padding: 12px 24px;
    border-radius: 0;
    /* Sharp aesthetic — set once */
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* CSS-003 FIX: WCAG focus indicator for action buttons */
.btn-add-to-cart-luxe:focus-visible,
.btn-buy-now-luxe:focus-visible {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary);
}

.btn-outline-primary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--primary);
    transition: all 0.2s;
}

.btn-outline-primary:hover {
    background: #eff6ff;
}

#btnActionMain,
#btnActionSecondary {
    border-radius: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#btnActionMain:focus-visible,
#btnActionSecondary:focus-visible {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary);
}

@media (min-width: 1024px) {

    .btn-add-to-cart-luxe,
    .btn-buy-now-luxe {
        height: 50px;
        font-size: 15px;
    }
}


/* ────────────────────────────────────────────────────────────
   11. MOBILE STICKY ACTION BAR
   CSS-005 FIX: Breakpoint aligned to 1024px (matches grid)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .detail-sticky {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--white);
        z-index: 1000;
        border-top: 1px solid var(--slate-200, #e2e8f0);
        padding: 10px 15px;
        gap: 10px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    }

    .detail-sticky .pdp-wishlist-btn {
        flex: 0 0 44px;
        height: 44px;
        border: 1px solid var(--slate-200, #e2e8f0);
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }

    .detail-sticky button {
        flex: 1;
        height: 44px;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 700;
        border: none;
        cursor: pointer;
    }
}


/* ────────────────────────────────────────────────────────────
   12. MOBILE RESPONSIVE OVERRIDES
   CSS-005 FIX: Breakpoints standardized to 768 / 1024
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pdp-back-btn {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 999;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--slate-800, #1e293b);
        font-size: 18px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .pdp-back-btn:active {
        transform: scale(0.9);
        background: rgba(255, 255, 255, 0.95);
    }
}

@media (min-width: 769px) {
    .pdp-back-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 18px;
        background: var(--white);
        border: 1px solid var(--slate-200, #e2e8f0);
        border-radius: 8px;
        color: var(--slate-500, #64748b);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        margin-bottom: 12px;
        transition: all 0.2s;
    }
}

@media (max-width: 768px) {
    .pdp-breadcrumb {
        display: none;
    }

    .pdp-category-label {
        display: none;
    }

    .pdp-title-row {
        margin-bottom: 8px;
    }

    .pdp-price-row {
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px 0;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--slate-100, #f1f5f9);
    }

    .pdp-tabs {
        position: sticky;
        top: 56px;
        background: var(--white);
        z-index: 60;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
    }

    .pdp-page #kontak .brand-block,
    .pdp-page #kontak .links-block,
    .pdp-page #kontak .legal-block,
    .pdp-page #kontak .payment-block,
    .pdp-page #kontak .footer-divider:not(:last-of-type) {
        display: none;
    }

    .pdp-page #kontak {
        padding: 15px;
    }
}


/* ────────────────────────────────────────────────────────────
   13. GLOBAL ACCENT OVERRIDES (PDP Context)
   CSS-004 & CSS-007 FIX: Using var() and reduced !important
   ──────────────────────────────────────────────────────────── */
.stock-info span {
    color: var(--primary);
}

/* Star Rating */
.fa-star.filled {
    color: var(--amber-500, #f59e0b);
}

/* Buying Context */
.buying-box .btn-buy:hover {
    filter: brightness(1.1);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}


/* ────────────────────────────────────────────────────────────
   14. ANIMATION
   ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}