/* ==========================================================================
   PRODUCT DETAILS PAGE — Dedicated Module
   Kapsam: pages/details.html
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PRODUCT GALLERY LAYOUT
   -------------------------------------------------------------------------- */
.product-flex {
    display: flex;
    gap: 100px;
    align-items: flex-start;
}

.main-image {
    flex-grow: 1;
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 640 / 600;
    max-width: 640px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.product-gallery {
    flex: 1.5;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.product-info {
    flex: 1;
    text-align: left;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: none;
}

.product-info::-webkit-scrollbar {
    display: none;
}

.product-info h1 {
    text-transform: capitalize;
    letter-spacing: 0.1cap;
}

/* --------------------------------------------------------------------------
   2. THUMBNAIL COLUMN
   -------------------------------------------------------------------------- */
.thumbnail-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 80px;
    flex-shrink: 0;
}

.thumbnail-column img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail-column img:hover,
.thumbnail-column img.active {
    opacity: 1;
    border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   3. PRODUCT INFO DETAILS
   -------------------------------------------------------------------------- */
.product-description-short {
    color: var(--text-gray);
    margin-bottom: 20px;
    line-height: 1.6;
}

.product-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 20px;
}

.product-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.product-attributes p {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.82rem;
}

.product-attributes p span:first-child {
    color: var(--text-gray);
    font-weight: 500;
    font-size: 0.82rem;
}

.product-attributes p span:last-child {
    color: var(--text-white);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   ACCORDION (div/button — CSS Grid smooth height)
   -------------------------------------------------------------------------- */
.accordion-item {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-white);
    text-align: left;
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
}

.accordion-icon {
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--accent);
    line-height: 1;
    flex-shrink: 0;
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.is-open .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding-bottom     0.35s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.accordion-item.is-open .accordion-content {
    grid-template-rows: 1fr;
    padding-bottom: 30px;
}

.accordion-inner {
    overflow: hidden;
    min-height: 0;
    max-width: 860px;
    margin: 0 auto;
}

.accordion-content h2,
.accordion-content h3 {
    font-size: 1rem;
    font-weight: 600;
    padding-top: 0;
    margin-bottom: 14px;
    color: var(--text-white);
}

.accordion-content p {
    color: var(--text-gray);
    line-height: 1.7;
    margin-bottom: 14px;
}

.accordion-content p:last-child {
    margin-bottom: 4;
}

/* Gallery pagination dots (desktop hidden) */
.gallery-pagination {
    display: none;
}

/* --------------------------------------------------------------------------
   4. PURCHASE GROUP (Quantity Selector + Add to Cart)
   -------------------------------------------------------------------------- */
.purchase-group {
    display: flex;
    gap: 20px;
    margin-top: 40px;
    height: 54px;
    align-items: stretch;
}

.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: transparent;
    width: 130px;
    overflow: hidden;
}

.quantity-selector .qty-btn {
    width: 40px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-selector .qty-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.quantity-selector input {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-white);
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    outline: none;
    padding: 0;
}

.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.purchase-group .btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    background: var(--accent);
    color: #2c1a0e;
    font-weight: 700;
    border-color: var(--accent);
    box-shadow: 0 6px 24px rgba(212, 163, 115, 0.28);
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.purchase-group .btn-primary:hover {
    background: #e8bc7a;
    color: #2c1a0e;
    border-color: #e8bc7a;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(212, 163, 115, 0.38);
}

/* --------------------------------------------------------------------------
   5. CANDLE CARE SECTION
   -------------------------------------------------------------------------- */
.mum-bakimi-wrapper {
    margin-top: 10px;
}

.mum-bakimi-text {
    text-align: left;
    max-width: 860px;
    margin: 0 auto 40px;
    color: var(--text-white);
    line-height: 1.8;
    font-size: 1.05rem;
}

.mum-bakimi-text p {
    margin-bottom: 15px;
}

.mum-bakimi-images {
    display: flex;
    justify-content: flex-start;
    gap: 30px;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.bakim-item {
    flex: 1;
}

.bakim-item img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

/* --------------------------------------------------------------------------
   6. SKELETON LOADER
   -------------------------------------------------------------------------- */
@keyframes skeleton-pulse {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.main-image.is-loading {
    background: linear-gradient(
        90deg,
        var(--bg-elevated, #1a1a1a) 25%,
        rgba(255, 255, 255, 0.06) 50%,
        var(--bg-elevated, #1a1a1a) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.main-image.is-loading img {
    opacity: 0;
}

/* --------------------------------------------------------------------------
   7. PRODUCT UNAVAILABLE STATE
   -------------------------------------------------------------------------- */
.product-unavailable-msg {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
}

.product-unavailable-inner {
    text-align: center;
    max-width: 480px;
}

.product-unavailable-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.product-unavailable-inner h2 {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.product-unavailable-inner p {
    margin-bottom: 28px;
}

.product-unavailable-inner .btn-primary {
    display: inline-block;
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   8. DETAIL PAGE STRUCTURE
   -------------------------------------------------------------------------- */
.detail-breadcrumb-nav {
    padding-top: 40px;
}

.detail-hero-section {
    background-color: var(--bg-title);
    width: 100%;
    padding: 60px 0;
    margin-top: 20px;
}

.detail-section {
    padding: 60px 0;
}

.detail-section-hdr {
    margin-bottom: 30px;
}

.detail-h2 {
    font-size: 2rem;
}

.accent-line {
    width: 50px;
    height: 2px;
    background: var(--accent);
    margin-top: 10px;
}

.detail-cta-row {
    margin-top: 40px;
    text-align: center;
}

#productBadge {
    display: none;
}

.soya-benefit-item {
    margin-bottom: 48px;
}

.soya-benefit-item h2 {
    margin-bottom: 4px;
}

/* --------------------------------------------------------------------------
   9. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .product-flex    { flex-direction: column; gap: 40px; }
    .product-gallery { flex-direction: column-reverse; }

    .thumbnail-column {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
    }

    .thumbnail-column img {
        width: 80px;
    }

    .product-info .btn-primary {
        width: 100%;
    }
}

@media (max-width: 768px) {
    /* --- Candle Care --- */
    .mum-bakimi-images { flex-direction: column; }
    .mum-bakimi-text   { font-size: 0.95rem; }
    .bakim-item        { padding: 0 20px; box-sizing: border-box; }

    /* --- 1. Gallery: Native Swipe (scroll-snap) --- */
    /* Static main image hidden; thumbnail column becomes the swipeable gallery */
    /* column-reverse (992px) shows main-image on top; on mobile it's hidden so
       override to column so thumbnail → counter → (hidden) main-image flows top-down */
    .product-gallery {
        flex-direction: column;
        gap: 0;
    }

    .main-image {
        display: none !important;
    }

    .thumbnail-column {
        display: flex !important;
        flex-direction: row;
        width: 100vw;
        max-width: 100vw;
        margin-left: calc(-50vw + 50%);
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 20px;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-left: 30px;
        padding-right: 30px;
        box-sizing: border-box;
        border-radius: 0;
    }

    .thumbnail-column img {
        flex: 0 0 calc(100vw - 60px);
        width: calc(100vw - 60px);
        height: calc(100vw - 60px);
        object-fit: cover;
        scroll-snap-align: center;
        border-radius: 16px !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        opacity: 1 !important;
        cursor: default;
    }


    .thumbnail-column::-webkit-scrollbar {
        display: none;
    }

    /* --- 2. Sticky Bottom Bar --- */
    .purchase-group {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 62px;
        gap: 14px;
        background: rgba(18, 10, 14, 0.82);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 12px 16px;
        padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
        margin: 0;
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .quantity-selector {
        width: 120px;
        border-radius: 10px;
    }

    .quantity-selector .qty-btn {
        font-size: 1.35rem;
    }

    .quantity-selector input {
        font-size: 1.15rem;
    }

    .purchase-group .btn-primary {
        font-size: 1rem;
        border-radius: 10px;
        letter-spacing: 0.03em;
    }

    /* Gallery pagination — minimalist "1 / 3" counter */
    .gallery-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 12px 0 4px;
        width: 100%;
    }

    .gallery-counter {
        font-size: 0.72rem;
        letter-spacing: 2.5px;
        color: rgba(255, 255, 255, 0.45);
        font-weight: 500;
    }

    .gallery-counter .current {
        color: var(--accent);
        font-weight: 700;
    }

    /* Product info — release sticky on mobile */
    .product-info {
        position: static;
        max-height: none;
        overflow-y: visible;
        padding: 0 20px;
        box-sizing: border-box;
    }

    /* Attribute pills full-width on mobile */
    .product-attributes {
        gap: 8px;
    }

    /* Prevent sticky bar from overlapping last section content */
    .detail-section:last-child {
        padding-bottom: 120px;
    }

    /* --- 3. Compact Typography & Spacing --- */
    #detailName {
        font-size: 1.35rem;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    #detailShortDesc {
        line-height: 1.6;
        padding: 0;
        margin-bottom: 16px;
    }

    #detailPrice {
        font-size: 1.3rem;
    }

    .detail-hero-section {
        padding: 30px 0;
    }

    .detail-section {
        padding: 30px 0;
    }

    .product-attributes {
        margin: 15px 0;
        padding-top: 15px;
    }

    .product-attributes p {
        margin-bottom: 8px;
    }

    /* --- Accordion mobile padding --- */
    .accordion-header {
        padding: 22px 20px;
        box-sizing: border-box;
        font-size: 1.05rem;
    }

    .accordion-content {
        padding-left: 20px;
        padding-right: 20px;
        box-sizing: border-box;
    }

    .accordion-inner {
        max-width: 100%;
        margin: 0;
    }

    .mum-bakimi-text {
        text-align: left;
        line-height: 1.6;
        max-width: 100%;
        margin: 0 0 30px;
    }

    .mum-bakimi-images {
        max-width: 100%;
        margin: 0;
    }

    .soya-benefit-item {
        text-align: left;
    }

    #relatedProductsGrid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-bottom: 12px;
        scrollbar-width: none;
    }

    #relatedProductsGrid::-webkit-scrollbar {
        display: none;
    }

    #relatedProductsGrid .card {
        flex: 0 0 45%;
        min-width: 0;
        scroll-snap-align: start;
    }
}
