/* Products Page CSS */

/* Page header & breadcrumbs */
.page-head {
    padding: 26px 0 10px;
    background: linear-gradient(180deg, #fff, var(--bg-soft));
}
.breadcrumb {
    color: rgba(17, 24, 39, 0.6);
    font-weight: 650;
    font-size: 13px;
}
.page-title {
    margin: 10px 0 0;
    font-size: 28px;
    letter-spacing: -0.02em;
}

/* Filters + list pages */
.two-col {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 18px;
    align-items: start;
}
.filter {
    position: sticky;
    top: 92px;
    padding: 16px;
}
.filter h3 {
    margin: 0 0 10px;
    font-size: 14px;
    letter-spacing: -0.01em;
}
.brand-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
}

.field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    color: rgba(17, 24, 39, 0.8);
}

.field input {
    width: 16px;
    height: 16px;
}
.divider {
    height: 1px;
    background: rgba(17, 24, 39, 0.08);
    margin: 12px 0;
}
.range {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: rgba(17, 24, 39, 0.7);
    font-size: 13px;
}
.sortbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(17, 24, 39, 0.08);
    backdrop-filter: blur(10px);
    margin-bottom: 14px;
}
.select {
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    font-weight: 700;
}
.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
    justify-content: center;
}

.page-chip {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(17, 24, 39, 0.1);
    background: #fff;
    font-weight: 800;
    font-size: 13px;
}
.page-chip.active {
    border-color: rgba(25, 118, 210, 0.35);
    background: rgba(25, 118, 210, 0.08);
    color: var(--blue);
}

/* GRID supaya semua card sama tinggi */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: stretch; /* penting */
}

/* Product card */
.prod {
    display: flex;
    flex-direction: column;
    height: 400px; /* atur sesuai kebutuhan */
    overflow: hidden;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}
.prod:hover {
    transform: translateY(-2px);
}
.prod-img {
    aspect-ratio: 1/1;
    background:
        radial-gradient(
            130px 130px at 30% 30%,
            rgba(229, 57, 53, 0.22),
            transparent 60%
        ),
        radial-gradient(
            130px 130px at 70% 60%,
            rgba(25, 118, 210, 0.18),
            transparent 60%
        ),
        linear-gradient(180deg, #fff, #f3f6ff);
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.prod-img .badge {
    position: absolute;
    top: 12px;
    left: 12px;
}
.prod-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
}
.prod-name {
    font-weight: 700;
    margin: 0 0 6px;

    display: -webkit-box;
    -webkit-line-clamp: 2; /* max 2 baris */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;

    line-height: 1.3em; /* atur tinggi baris */
    min-height: 2.6em;
}
.prod-meta {
    margin-bottom: 8px;
}
.price {
    font-weight: 600;
}
.stars {
    color: #f59e0b;
    font-weight: 900;
}
.prod-actions {
    margin-top: auto; /* ini kuncinya */
    display: flex;
    gap: 10px;
}

/* Mobile helpers */
.mobile-filter-btn {
    display: none;
}
.filter-sheet {
    display: none;
}

/* Product Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 98;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.product-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    max-width: 820px;
    width: 90%;
    max-height: 90vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-modal.open {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #fff;
    transform: scale(1.1);
}

.product-modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow-y: auto;
    max-height: 90vh;
}

.product-modal-image {
    position: relative;
    background:
        radial-gradient(
            200px 200px at 30% 30%,
            rgba(229, 57, 53, 0.22),
            transparent 60%
        ),
        radial-gradient(
            200px 200px at 70% 60%,
            rgba(25, 118, 210, 0.18),
            transparent 60%
        ),
        linear-gradient(180deg, #fff, #f3f6ff);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border-right: 1px solid rgba(17, 24, 39, 0.08);
}

.product-modal-body {
    padding: 24px 28px; /* sedikit diperkecil */
    display: flex;
    flex-direction: column;
    gap: 10px; /* 🔥 ini bikin spacing konsisten */
    overflow-y: auto;
}

.product-modal-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25; /* 🔥 supaya judul tidak renggang */
    margin: 0; /* hapus margin bawah */
    color: var(--text);
}

.product-modal-price {
    font-size: 26px;
    font-weight: 900;
    color: var(--red);
    margin-bottom: 10px; 
}

.product-modal-description {
    margin: 0; /* hapus margin-top 16px */
}

/* 🔥 HAPUS MARGIN DEFAULT HEADING & PARAGRAF */
.product-modal-description h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.product-modal-description p {
    margin: 0;
    line-height: 1.5;
}

.product-modal-specs {
    margin: 4px 0 0;
}

.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px; /* lebih compact */
    margin-top: 4px;
}


.spec-item {
    background: rgba(17, 24, 39, 0.04);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spec-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.spec-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.product-modal-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkout-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    background: var(--red);
    color: #fff;
    box-shadow: 0 10px 24px rgba(25, 118, 210, 0.4);
    transition: all 0.2s;
}

.checkout-btn i {
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(25, 118, 210, 0.45);
}

.product-secondary-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.marketplace-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.marketplace-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 2px solid var(--line) !important;
    background-color: #fff !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer;
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.marketplace-icon.tokopedia {
    background-image: url("/assets/img/tokopedia.png");
    box-shadow: 0 0 0 2px#42B549;
}

.marketplace-icon.tokopedia:hover {
    box-shadow:
        0 0 0 2px rgba(66, 181, 73, 0.55),
        0 8px 20px rgba(66, 181, 73, 0.45);
}

.marketplace-icon.shopee {
    background-image: url("/assets/img/shopee.png");
    box-shadow: 0 0 0 2px #ee4d2d;
}

.marketplace-icon.shopee:hover {
    box-shadow:
        0 0 0 2px rgba(238, 77, 45, 0.55),
        0 8px 20px rgba(238, 77, 45, 0.45);
}

.marketplace-icon.tiktok {
    background-image: url("/assets/img/tiktokshop.png");
    box-shadow: 0 0 0 2px#000;
}

.marketplace-icon.tiktok:hover {
    box-shadow:
        0 0 0 2px rgba(0, 0, 0, 0.6),
        0 8px 20px rgba(0, 0, 0, 0.45);
}

.marketplace-icon:hover {
    transform: translateY(-1px) scale(1.03);
}

.add-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* 🔥 PENTING */
    gap: 8px;

    padding: 10px 16px; /* lebih seimbang kiri-kanan */
    min-height: 40px; /* bikin center konsisten */

    border-radius: 12px;
    border: 2px solid var(--red);
    background: #fff;

    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;

    cursor: pointer;
    transition:
        background-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.12s ease;
}

.add-cart-btn .icon {
    font-size: 14px;
    line-height: 1; /* 🔥 cegah icon dorong teks */
}

/* HOVER */
.add-cart-btn:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
    transform: translateY(-1px);
}

/* ACTIVE (klik) */
.add-cart-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.18);
}

/* FEEDBACK */
.cart-feedback {
    margin-top: 6px;
    font-size: 12px;
    color: var(--green);
}

.add-cart-btn i {
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
}

.category-grid .field {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="checkbox"],
[type="range"] {
    accent-color: var(--red);
}


.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    /* max-width: 420px; */
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.search-wrapper .search-input {
    border: none;
    outline: none;
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
}

.search-wrapper .search-btn {
    width: 46px;
    height: 42px;
    border: none;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.search-wrapper .search-btn i {
    font-size: 14px;
    color: var(--text);
}

.search-wrapper .search-btn:hover {
    background: rgba(17, 24, 39, 0.05);
}

#closeFilter {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#closeFilter:hover {
    background: rgba(229,57,53,0.1);
    color: var(--red);
}


/* Responsive Products */
@media (max-width: 980px) {
    .two-col {
        grid-template-columns: 1fr;
    }
    .filter {
        position: relative;
        top: auto;
    }
    .sortbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .sortbar > div {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .sortbar select {
        flex: 1;
        min-width: 0;
    }
    .mobile-filter-btn {
        display: inline-flex;
    }
    .filter.desktop-only {
        display: none;
    }
    .filter-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 95;
        transform: translateY(105%);
        transition: transform 0.2s ease;
        background: #fff;
        border-top-left-radius: 22px;
        border-top-right-radius: 22px;
        box-shadow: 0 -14px 50px rgba(17, 24, 39, 0.22);
        border: 1px solid rgba(17, 24, 39, 0.1);
        max-height: 82vh;
        overflow: auto;
        padding: 14px 16px 18px;
    }
    .filter-sheet.open {
        transform: translateY(0);
    }
    .sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 10px;
    }
}
@media (max-width: 720px) {
    .sortbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .sortbar > div {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .sortbar select {
        flex: 1;
        min-width: 0;
    }
    .mobile-filter-btn {
        display: inline-flex;
    }
    .filter.desktop-only {
        display: none;
    }
    .filter-sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 95;
        transform: translateY(105%);
        transition: transform 0.2s ease;
        background: #fff;
        border-top-left-radius: 22px;
        border-top-right-radius: 22px;
        box-shadow: 0 -14px 50px rgba(17, 24, 39, 0.22);
        border: 1px solid rgba(17, 24, 39, 0.1);
        max-height: 82vh;
        overflow: auto;
        padding: 14px 16px 18px;
    }
    .filter-sheet.open {
        transform: translateY(0);
    }
    .sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 10px;
    }

    .prod {
        height: 300px; /* lebih proporsional untuk 2 kolom */
    }

    .prod-body {
        font-size: 15px;
        font-weight: 700 !important;
    }

    .grid-3,
    .grid-4 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        align-items: stretch;
    }

    /* Mobile Modal */
    .product-modal {
        width: 95%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        top: auto;
        bottom: 0;
        transform: translate(-50%, 100%);
    }

    .product-modal.open {
        transform: translate(-50%, 0);
    }

    .product-modal-content {
        grid-template-columns: 1fr;
    }

    .product-modal-image {
        border-right: none;
        border-bottom: 1px solid rgba(17, 24, 39, 0.08);
        padding: 24px;
    }

    .product-modal-body {
        padding: 24px;
    }

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

    /* === IMAGE SLIDER === */
    .image-slider {
        position: relative;
        width: 100%;
        max-width: 400px;
        aspect-ratio: 1 / 1;
        margin: 0 auto;
        overflow: hidden;
        border-radius: 18px;
        border: 6px solid var(--line);
        touch-action: pan-y; /* 🔥 penting untuk swipe */
        user-select: none;
    }

    .slider-track {
        display: flex;
        height: 100%;
        transition: transform 0.35s ease;
        will-change: transform;
    }

    .slider-image {
        width: 100%;
        flex-shrink: 0;
        object-fit: cover;
        pointer-events: none;
    }

    /* === ARROW === */
    .slider-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: none;
        background: rgba(0, 0, 0, 0.45);
        color: #fff;
        font-size: 22px;
        cursor: pointer;
        z-index: 3;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .slider-arrow.left {
        left: 10px;
    }
    .slider-arrow.right {
        right: 10px;
    }

    .slider-arrow:hover {
        background: rgba(0, 0, 0, 0.65);
    }

    /* === MOBILE FRIENDLY === */
    @media (max-width: 640px) {
        .slider-arrow {
            width: 34px;
            height: 34px;
            font-size: 20px;
        }
    }
}
