/* =========================================================
   product-detail.css
   Dipakai untuk halaman: product-detail.html
   ========================================================= */

/* =========================================================
   0) ROOT VARIABLES
   ========================================================= */
:root {
    --arrowSize: 42px;
    --arrowGap: 14px;
}

/* =========================================================
   1) TOP SECTION WRAPPER
   ========================================================= */
.pd-top {
    padding: 0;
    /* spacing pakai global class */
}

/* =========================================================
   2) TOP GRID 
   ========================================================= */
.pd-grid {
    display: grid;
    grid-template-columns: 74px 1fr 1fr;
    gap: 34px;
    align-items: start;
}

/* =========================================================
   3) THUMB STRIP
   ========================================================= */
.pd-thumbs {
    border: 2px solid rgba(139, 30, 30, 0.35);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    height: 595px;
}

/* ===== Button Function: Thumb Arrow (Up/Down) ===== */
.thumb-nav {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.thumb-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 10px 10px;
}

/* ===== Button Function: Thumbnail ===== */
.thumb {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 2px solid transparent;
    background: #fff;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color 0.18s ease,
        transform 0.18s ease;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* ===== State Function: Active / Hover ===== */
.thumb.active {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.thumb:hover {
    border-color: rgba(139, 30, 30, 0.45);
}

/* =========================================================
   4) BIG IMAGE BOX
   ========================================================= */
.pd-imagebox {
    border: none;
    border-radius: 10px;
    width: 100%;
    height: 100% !important;
    max-height:700px;
    display: block;
    aspect-ratio: 2 / 3 !important;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.pd-carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.pd-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.pd-main-img {
    width: 100%;
    height: 100%;
    object-fit:contain;
    object-position: center;
    display: block;
    padding: 0;
    transition: transform 0.2s ease;
    transform-origin: center center;
    -webkit-user-drag: none;
    pointer-events: none; /* Memastikan event touch dideteksi langsung oleh container .pd-imagebox */
}

.pd-carousel-slide:hover .pd-main-img {
    transform: scale(2.5);
}

.pd-carousel-slide .pd-main-img.is-zoomed {
    transform: scale(2.5);
}

/* Carousel controls */
.pd-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(139, 30, 30, 0.2);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pd-carousel-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pd-carousel-btn.prev {
    left: 15px;
}

.pd-carousel-btn.next {
    right: 15px;
}

.pd-carousel-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.pd-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(139, 30, 30, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pd-carousel-dot.active {
    background: var(--primary);
    transform: scale(1.25);
}

/* =========================================================
   5) INFO (TITLE + DESC)
   ========================================================= */
.pd-title {
    font-family: "Calistoga", serif;
    color: var(--primary);
    font-size: 2rem;
    margin: 0 0 0.9rem;
}

.pd-desc {
    color: #222;
    font-weight: 600;
    line-height: 1.55;
    font-size: 0.92rem;
    max-width: 520px;
    margin: 0 0 1.3rem;
    text-align: justify;
}

/* =========================================================
   6) SPEC ROWS
   ========================================================= */
.pd-spec {
    display: grid;
    gap: 20px;
    margin-bottom: 1.2rem;
}

.pd-row {
    display: grid;
    grid-template-columns: 110px 18px 1fr;
    align-items: center;
    column-gap: 10px;
}

.pd-label {
    color: var(--primary);
    font-weight: 900;
    letter-spacing: 0.6px;
}

.pd-sep {
    font-weight: 900;
    color: #222;
}

.pd-val {
    font-weight: 900;
    color: #222;
}

/* =========================================================
   7) SIZE PILLS
   ========================================================= */
/* ===== Button Function: Size Pill ===== */
.size-pill {
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    font-size: 0.72rem;
    border-radius: 6px;
    padding: 0.32rem 0.55rem;
    margin-right: 8px;
}

/* ===== State Function: Active ===== */
.size-pill.active {
    box-shadow: 0 10px 18px rgba(139, 30, 30, 0.18);
}

/* =========================================================
   8) ACTIONS ROW (QTY + BUTTONS)
   ========================================================= */
.pd-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 20px;

    padding-top: 20px;
    flex-wrap: wrap;
}

/* ===== Qty Control ===== */
.qty {
    display: inline-flex;
    align-items: center;
    background: var(--primary);
    border-radius: 8px;
    overflow: hidden;
    height: 34px;
}

/* ===== Button Function: Minus / Plus ===== */
.qty-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Value Display ===== */
.qty-num {
    width: 50px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--primary);
    font-weight: 900;
}

/* ===== Button Function: CTA (Add Cart / Buy Now) ===== */
.pd-btn {
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    font-size: 0.72rem;
    min-width: 118px;
    text-align: center;
}

/* =========================================================
   9) PRODUCT DETAIL (DESCRIPTION CARD)
   ========================================================= */
.pd-detail {
    margin: 0;
}

/* ===== Card Wrapper ===== */
.product-detail-page .pd-detail {
    padding-left: 0;
    margin-top: 30px;
}

.product-detail-page .pd-detail-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.product-detail-page .pd-detail-head {
    padding: 15px;
    background: rgba(139, 30, 30, 0.04);
    border-bottom: 1px solid rgba(139, 30, 30, 0.1);
}

.product-detail-page .pd-detail-body {
    padding: 15px;
    color: #222;
    font-weight: 600;
    line-height: 1.55;
    font-size: 0.92rem;
    text-align: justify;
}

/* =========================================================
   10) PD INFO -> CARD (RIGHT PANEL)
   ========================================================= */
.product-detail-page .pd-info {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.06);
    padding: 18px 18px 16px;
}

.product-detail-page .pd-title {
    margin: 0 0 10px;
    line-height: 1.08;
}

.product-detail-page .pd-desc {
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(139, 30, 30, 0.1);
}

.product-detail-page .pd-spec {
    gap: 12px;
    margin-bottom: 14px;
}

.product-detail-page .pd-row {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(139, 30, 30, 0.04);
    border: 1px solid rgba(139, 30, 30, 0.1);
}

/* Size */
.product-detail-page .pd-row.is-size .pd-val {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.product-detail-page .size-pill {
    border-radius: 10px;
    padding: 0.42rem 0.72rem;
    margin-right: 0;
}

.product-detail-page .pd-actions {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(139, 30, 30, 0.1);
    gap: 12px;
    flex-wrap: wrap;
}

.product-detail-page .qty {
    height: 40px;
    border-radius: 12px;
}

.product-detail-page .qty-btn {
    width: 40px;
    height: 40px;
}

.product-detail-page .qty-num {
    width: 64px;
    height: 40px;
}

.product-detail-page .pd-btn {
    height: 40px;
    border-radius: 12px;
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   11) ANOTHER FAVORITE PRODUCT
   ========================================================= */
.best-head {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.best-head .explore-right {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.best-wrap {
    padding: 0.6rem 0;
}

.best-grid {
    display: grid;
    grid-template-columns: var(--arrowSize) minmax(0, 1fr) var(--arrowSize);
    align-items: center;
    column-gap: var(--arrowGap);
}

.arrow-btn2 {
    width: var(--arrowSize);
    height: var(--arrowSize);
    border-radius: 999px;
    border: none;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.best-scroll {
    width: 100%;
    min-width: 0;
    display: flex;
    gap: 28px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-inline: var(--arrowGap);
    scroll-padding-inline: var(--arrowGap);
    justify-content: flex-start;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.best-scroll::-webkit-scrollbar {
    display: none;
    height: 8px;
}

.best-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}

.product-detail-page .best-card {
    width: 270px;
    min-width: 270px;
    max-width: 270px;
    flex: 0 0 270px;
    scroll-snap-align: start;
    text-align: center;
    height: auto;
}

/* =========================================================
   12) GLOBAL BOX-SIZING
   ========================================================= */
.product-detail-page,
.product-detail-page * {
    box-sizing: border-box;
}

/* ===============================
   13) DETAIL PRODUCT INFO PANEL
================================ */
.pd-info {
    background: #fff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pd-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.pd-price-highlight {
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Variant */
.variant-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.variant-pill {
    background: #f5f5f5;
    border: 1px solid transparent;
    padding: 0.45rem 0.8rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.variant-pill.active {
    background: var(--primary);
    color: #fff;
}

.pd-selected {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 6px;
}

/* =========================================================
   13) RESPONSIVE
   ========================================================= */
/* ===== Tablet (<= 991px) ===== */
@media (max-width: 991px) {
    .best-head {
        margin-top: var(--section-space-sm);
    }

    .pd-grid {
        grid-template-columns: 1fr;
    }

    .pd-imagebox {
        order: 1;
    }

    .pd-thumbs {
        order: 2;
    }

    .pd-info {
        order: 3;
    }

    .pd-info {
        padding: 22px;
    }

    .pd-header {
        flex-direction: column;
        gap: 6px;
    }
}

/* ===== Mobile (<= 575px) ===== */
@media (max-width: 575px) {
    /* Prevent body horizontal scroll page shifting */

    .product-detail-page {
        padding-left: 12px;
        padding-right: 12px;
    }

    .pd-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    /* =======================================================
     THUMBS
     ======================================================= */
    .pd-thumbs {
        height: auto;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border: none !important;
        background: transparent !important;
        overflow: hidden;
    }

    .thumb-nav {
        flex: 0 0 36px;
        width: 40px;
        height: 40px;
        background: rgba(139, 30, 30, 0.07);
        border-radius: 50% !important;
        color: var(--primary);
        font-size: 13px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none !important;
    }

    .thumb-list {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px 10px;
        scroll-padding-inline: 10px;
    }

    .thumb {
        flex: 0 0 auto;
        width: 100px;
        height: 100px;
        overflow: hidden;
    }

    .pd-imagebox {
        width: 100%;
        height:auto important;
        /*aspect-ratio: 1 / 1 !important;*/
        cursor: zoom-in;
        border: none !important;*/
        border-radius: 0px !important;*/
        background: #fafafa !important;
        display: block !important;
        overflow: hidden !important;
    }

    .pd-main-img {
        width: 100% !important;
        height: 100% !important;
        object-fit:contain;
    }

    .pd-carousel-slide:hover .pd-main-img {
        transform: none !important;
    }

    .pd-carousel-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .pd-carousel-btn.prev {
        left: 8px;
    }
    
    .pd-carousel-btn.next {
        right: 8px;
    }

    .explore-right {
        display: none;
    }

    /* =======================================================
     ACTIONS
     ======================================================= */
    .pd-actions {
        display: grid;
        grid-template-columns: auto 1fr 1fr;
        gap: 10px;
        align-items: center;
    }

    .pd-actions .pd-btn {
        width: 100%;
        min-width: 0;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .pd-title {
        font-size: 1.2rem;
    }
    .qty,
    .qty-btn,
    .qty-num {
        height: 40px;
    }

    /* =======================================================
     SIZE ROW
     ======================================================= */
    .pd-row.is-size {
        align-items: center;
    }

    .pd-row.is-size .pd-val {
        grid-column: auto;
        margin-top: 0;
        display: flex;
        flex-wrap: nowrap;
        gap: 10px;
        justify-content: flex-start;
    }

    .pd-row.is-size .size-pill {
        margin-right: 0;
    }

    .product-detail-page {
        padding-left: 0;
    }

    .pd-info {
        padding: 18px;
    }

    .variant-group {
        gap: 8px;
    }

    .product-detail-page .pd-row.is-size .pd-val,
    .product-detail-page .pd-row.is-motif .pd-val {
        grid-column: auto;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .product-detail-page .pd-row.is-size .pd-val::-webkit-scrollbar,
    .product-detail-page .pd-row.is-motif .pd-val::-webkit-scrollbar {
        display: none;
    }

    .variant-pill,
    .size-pill {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* ===============================
     Qty + Add Cart + Buy Now 1 Row
     =============================== */
    .product-detail-page .pd-info .pd-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        align-items: center !important;
    }

    .product-detail-page .pd-info .pd-actions .qty {
        width: 132px;
        height: 44px;
        border-radius: 14px;
        flex: 0 0 132px !important;
    }

    .product-detail-page .pd-info .pd-actions form {
        flex: 1 1 calc(100% - 144px) !important;
        min-width: 180px;
    }

    .product-detail-page .pd-info .pd-actions .qty-btn {
        width: 44px;
        height: 44px;
    }

    .product-detail-page .pd-info .pd-actions .qty-num {
        width: 44px;
        height: 44px;
    }

    .product-detail-page .pd-info .pd-actions .pd-btn {
        width: 100% !important;
        min-width: 0 !important;
        height: 44px !important;
        border-radius: 14px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 16px !important;
        white-space: nowrap;
    }

    /* ===============================
    ANOTHER FAVORITE PRODUCT : View 2 Cards Per Swipe
  =============================== */
    .product-detail-page .arrow-btn2 {
        display: none !important;
    }

    .product-detail-page .best-grid {
        display: block !important;
        width: 100% !important;
    }

    .product-detail-page .best-scroll {
        width: 100% !important;
        gap: 16px !important;
        padding-inline: 4px !important;
        scroll-padding-inline: 4px !important;
    }

    /* Lock horizontal scroll and center cards dynamically if there are only 1 or 2 cards */
    .product-detail-page .best-scroll:has(> .best-card:only-child) {
        overflow-x: hidden !important;
        justify-content: center !important;
    }

    .product-detail-page .best-scroll:has(> .best-card:nth-child(2):last-child) {
        overflow-x: hidden !important;
        justify-content: center !important;
    }

    .product-detail-page .best-card {
        flex: 0 0 calc(50% - 8px) !important;
        min-width: calc(50% - 8px) !important;
        max-width: calc(50% - 8px) !important;
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
    }

    /* If there is only 1 card, let it occupy a nice central size without stretching to fill the page uglily */
    .product-detail-page .best-scroll:has(> .best-card:only-child) .best-card {
        flex: 0 0 200px !important;
        min-width: 200px !important;
        max-width: 200px !important;
    }
}
