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

:root {
    --wrapMax: 1440px;
    --wrapPad: clamp(16px, 4vw, 50px);
    --shadowSoft: 0 10px 24px rgba(0, 0, 0, 0.08);
    --shadowHover: 0 18px 36px rgba(0, 0, 0, 0.12);
}

.product-page {
    background: #fff;
    padding-bottom: 0;
}

.product-hero {
    height: 350px;
    background: url("../image/statistic/2.webp") center/cover no-repeat;
    border-radius: 0 0 18px 18px;
    position: relative;
    overflow: hidden;
}

.product-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
    pointer-events: none;
}

/* =========================================================
   ACTIVE TAB sCATEGORY & SUBCATEGORY
   ========================================================= */
.category-link,
.subcategory-link {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    transition: 0.2s ease;
    color: var(--primary);
}

.category-link.active,
.subcategory-link.active {
    background: rgba(139, 30, 30, 0.08);
    color: var(--primary);
    border: 1px solid rgba(139, 30, 30, 0.14);
}

/* =========================================================
   TOOLBAR
   ========================================================= */
.product-toolbar {
    max-width: var(--wrapMax);
    margin: 0 auto;
    padding: 0 var(--wrapPad);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.toolbar-left-placeholder {
    width: 280px;
    flex: 0 0 280px;
}

.product-search {
    display: flex;
    align-items: center;
    height: 45px;
}

.product-search-input {
    height: 45px;
    width: 260px;
    border: 2px solid rgba(139, 30, 30, 0.55);
    border-right: 0;
    padding: 0 14px;
    font-size: 1rem;
    border-radius: 12px 0 0 12px;
    outline: none;
    line-height: 1;
    box-shadow: none;
}

.product-search-input::placeholder {
    letter-spacing: 0.6px;
    font-weight: 700;
}

.product-search-input:focus {
    box-shadow: none;
    border-color: rgba(139, 30, 30, 0.75);
}

.product-search-input:focus + .product-search-btn {
    border-color: rgba(139, 30, 30, 0.75);
}

.product-search-btn {
    height: 45px;
    width: 46px;
    border: 2px solid rgba(139, 30, 30, 0.55);
    border-left: 0;
    background: #fff;
    color: var(--primary);
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   LAYOUT
   ========================================================= */
.product-content-wrap {
    max-width: var(--wrapMax);
    margin: 0 auto;
    padding: 0 var(--wrapPad);
}

.product-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.product-sidebar {
    position: sticky;
    top: 24px;
}

.filter-box {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadowSoft);
}

.filter-box-title {
    font-family: "Viga", sans-serif;
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 18px;
}

.filter-group + .filter-group {
    margin-top: 20px;
}

.filter-label {
    font-family: "Viga", sans-serif;
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.filter-select {
    width: 100%;
    height: 46px;
    border: 1px solid rgba(139, 30, 30, 0.22);
    border-radius: 12px;
    padding: 0 14px;
    outline: none;
    background: #fff;
    color: #333;
    box-shadow: none;
}

.filter-select:focus {
    border-color: rgba(139, 30, 30, 0.55);
}

.category-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    position: relative;
}

.category-link,
.subcategory-link {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    transition: 0.2s ease;
}

.category-link {
    padding: 12px 14px;
    background: #faf7f5;
    color: var(--primary);
    font-family: "Viga", sans-serif;
    font-size: 0.93rem;
    letter-spacing: 0.3px;
}

.category-link:hover,
.category-link.active,
.subcategory-link:hover,
.subcategory-link.active {
    background: rgba(139, 30, 30, 0.08);
    color: var(--primary);
}

.subcategory-menu {
    display: none;
    margin-top: 8px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid rgba(139, 30, 30, 0.12);
}

.subcategory-menu {
    display: none;
}

.category-item.open > .subcategory-menu {
    display: block;
}

.subcategory-link {
    padding: 8px 12px;
    color: #5f5f5f;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    grid-column: 1 / -1;
    padding: 40px 0;
    text-align: center;
    font-family: "Viga", sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary);
}

/* =========================================================
   GRID
   ========================================================= */
.product-grid-wrap {
    width: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: clamp(14px, 2vw, 24px);
    row-gap: clamp(18px, 2.2vw, 30px);
}

.product-grid-gap {
    margin-top: 25px;
}

/* =========================================================
   CARD
   ========================================================= */
.p-card {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    color: inherit;
    transition: transform 0.2s ease;
    height: 100%;
    width: 100%;
}

.p-card:hover {
    text-decoration: none !important;
    color: inherit !important;
}

.p-img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #f7f7f7;
    border: none !important;
    border-radius: 12px;
    display: block;
    height: auto !important;
}

.p-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.p-card:hover .p-img img,
.product-mini:hover .p-img img,
.best-card:hover .p-img img {
    transform: scale(1.03);
}

/* =========================================================
   CAROUSEL INSIDE CARD
   ========================================================= */
.p-img-carousel {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.p-carousel-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.p-carousel-img.active {
    position: relative;
    opacity: 1;
    z-index: 1;
}

.p-carousel-hover-zones {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    z-index: 3;
}

.hover-zone {
    flex: 1;
    height: 100%;
    cursor: pointer;
}

.p-carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.p-card:hover .p-carousel-dots,
.product-mini:hover .p-carousel-dots,
.best-card:hover .p-carousel-dots {
    opacity: 1;
}

.p-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.2s, transform 0.2s;
}

.p-dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* =========================================================
   BODY
   ========================================================= */
.p-body {
    padding-top: 10px;
    padding-inline: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.p-body-top {
    display: flex;
    flex-direction: column;
}

.p-cat {
    font-family: "Viga", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin-top: 4px;
    margin-bottom: 2px;
}

.p-name {
    font-family: "Viga", sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    color: #222;
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: calc(1.3em * 2);
}

.p-subcat {
    display: none !important;
}

.p-classification {
    display: none !important;
}

.p-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
}

.p-price {
    font-family: "Viga", sans-serif;
    font-weight: 900;
    font-size: 0.92rem;
    color: #111;
    white-space: nowrap;
}

.p-view {
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 0.72rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.p-card:hover .p-view {
    background: var(--primary);
    color: #fff;
}

/* =========================================================
   PAGER
   ========================================================= */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.pg {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: 1px solid rgba(139, 30, 30, 0.18);
    color: var(--primary);
    background: #fff;
    font-weight: 700;
}

.pg.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pg.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* =========================================================
   MOBILE FILTER TOGGLE
   ========================================================= */
.filter-toggle-btn {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(139, 30, 30, 0.18);
    border-radius: 14px;
    background: #fff;
    color: var(--primary);
    padding: 12px 14px;
    display: none;
    align-items: center;
    justify-content: space-between;
    font-family: "Viga", sans-serif;
    font-size: 0.95rem;
    box-shadow: var(--shadowSoft);
}

.filter-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

/* =========================================================
   SMALLER PRODUCT CARD
   ========================================================= */
.p-card {
    min-width: 0;
}

.p-body {
    padding-top: 10px;
    padding-inline: 2px;
}

/* =========================================================
   ARROW TAB CATEGORY DAN SUB CATEGORY
   ========================================================= */
.category-link,
.subcategory-link.toggle-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-item.has-child .toggle-icon,
.subcategory-item.has-child .toggle-icon {
    font-size: 12px;
    transition: transform 0.25s ease;
}

/* rotate kalau open */
.category-item.open > .category-link .toggle-icon,
.subcategory-item.open > .subcategory-link .toggle-icon {
    transform: rotate(90deg);
}

.category-item.has-child > .category-link,
.subcategory-item.has-child > .subcategory-link {
    cursor: pointer;
}

/* Level 3 Menu */
.subcategory-menu-level-3 {
    display: none;
    margin-top: 4px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid rgba(139, 30, 30, 0.12);
}

.subcategory-item.open > .subcategory-menu-level-3 {
    display: block;
}

.subcategory-link-level-3 {
    display: block;
    text-decoration: none;
    padding: 6px 12px;
    color: #777;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: 0.2s ease;
    margin-bottom: 2px;
}

.subcategory-link-level-3:hover,
.subcategory-link-level-3.active {
    background: rgba(139, 30, 30, 0.05);
    color: var(--primary);
}

/* =========================================================
   CHECKBOX PRODUCT TYPE
   ========================================================= */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #444;
    cursor: pointer;
}

.checkbox-item input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* =========================================================
   RESET FILTER
   ========================================================= */
.btn-reset {
    width: 100%;
    background: #fff;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: 900;
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    text-align: center;
    transition: 0.2s ease;
}

.btn-reset:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 10px 18px rgba(139, 30, 30, 0.16);
}

.btn-reset:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1199px) {
    .product-layout {
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 22px;
    }

    .toolbar-left-placeholder {
        width: 250px;
        flex-basis: 250px;
    }

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .product-toolbar {
        padding: 0 var(--wrapPad);
        justify-content: flex-end;
    }

    .toolbar-left-placeholder {
        display: none;
    }

    .product-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .product-sidebar {
        position: static;
        top: auto;
    }

    .filter-toggle-btn {
        display: flex;
        margin-bottom: 12px;
    }

    .filter-box {
        padding: 16px;
        margin-top: 10px;
    }

    .subcategory-menu {
        margin-left: 0;
        padding-left: 10px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
        row-gap: 14px;
    }

    .p-card {
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .p-img {
        aspect-ratio: 3 / 4;
        height: auto !important;
        border-radius: 12px;
    }

    .p-name {
        font-size: 0.92rem;
        min-height: calc(1.25em * 2);
    }

    .p-cat {
        font-size: 0.78rem;
        margin-top: 10px;
    }

    .p-subcat {
        font-size: 0.74rem;
        margin-top: 4px;
        min-height: 18px;
    }

    .p-classification {
        margin-top: 6px;
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    .p-bottom {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-top: 10px;
    }

    .p-price {
        font-size: 0.88rem;
        white-space: normal;
    }

    .p-view {
        width: 100%;
        text-align: center;
        padding: 0.5rem 0.7rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 575px) {
    .product-hero {
        height: 220px;
        border-radius: 0 0 14px 14px;
    }

    .product-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .toolbar-right {
        width: 100%;
    }

    .product-search {
        width: 100%;
        height: 42px;
    }

    .product-search-input {
        width: 100%;
        height: 42px;
        font-size: 0.92rem;
    }

    .product-search-btn {
        height: 42px;
        width: 44px;
    }

    .product-content-wrap {
        padding: 0 14px;
    }

    .filter-toggle-btn {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.9rem;
        border-radius: 12px;
    }

    .filter-box {
        padding: 14px;
        border-radius: 14px;
    }

    .filter-label {
        font-size: 0.88rem;
    }

    .filter-select {
        height: 42px;
        font-size: 0.9rem;
    }

    .category-link {
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .subcategory-link {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 12px;
    }

    .p-card {
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .p-img {
        aspect-ratio: 3 / 4;
        height: auto !important;
        border-radius: 10px;
    }

    .p-body {
        padding-top: 8px;
        padding-inline: 0;
    }

    .p-name {
        font-size: 0.9rem;
        line-height: 1.2;
        min-height: calc(1.2em * 2);
    }

    .p-cat {
        font-size: 0.76rem;
        margin-top: 8px;
    }

    .p-subcat {
        font-size: 0.72rem;
        margin-top: 3px;
        min-height: 16px;
    }

    .p-classification {
        margin-top: 5px;
        padding: 2px 7px;
        font-size: 0.66rem;
    }

    .p-price {
        font-size: 0.88rem;
        line-height: 1.2;
    }

    .p-view {
        padding: 0.42rem 0.55rem;
        font-size: 0.7rem;
        border-radius: 9px;
        letter-spacing: 0.4px;
    }

    .pager {
        gap: 6px;
    }

    .pg {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .empty-state {
        min-height: 24vh;
        font-size: 0.9rem;
        padding: 18px;
    }
}
