/* ==========================================================================
   Produk Banner - Public Styles
   ========================================================================== */

/* --- Grid Base Styles --- */
.produk-banner-grid {
    display: grid;
    grid-template-columns: repeat(var(--produk-cols, 3), 1fr);
    gap: var(--pb-gap, 24px);
    padding: 24px 0;
    width: 100%;
}

/* Horizontal Scroll Support */
.produk-banner-grid[data-scroll="horizontal"] {
    display: grid;
    grid-auto-flow: column;
    /* Calculate the exact width of each column to fit exactly --produk-cols columns in the viewport container */
    grid-auto-columns: calc((100% - (var(--produk-cols, 3) - 1) * var(--pb-gap, 24px)) / var(--produk-cols, 3));
    grid-template-columns: none;
    /* override the base grid-template-columns */
    grid-template-rows: repeat(var(--produk-rows, 1), 1fr);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 24px;
}

.produk-banner-grid[data-scroll="horizontal"]::-webkit-scrollbar {
    height: 8px;
}

.produk-banner-grid[data-scroll="horizontal"]::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.produk-banner-grid[data-scroll="horizontal"]::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.produk-banner-grid[data-scroll="horizontal"]::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.produk-banner-grid[data-scroll="horizontal"]>.produk-banner-card {
    scroll-snap-align: start;
    height: 100%;
}

/* Vertical Scroll Support */
.produk-banner-grid[data-scroll="vertical"] {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 12px;
}

.produk-banner-grid[data-scroll="vertical"]::-webkit-scrollbar {
    width: 8px;
}

.produk-banner-grid[data-scroll="vertical"]::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.produk-banner-grid[data-scroll="vertical"]::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.produk-banner-grid[data-scroll="vertical"]::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* --- Card Styles --- */
.produk-banner-card {
    background: var(--pb-bg, #ffffff);
    border: none;
    border-radius: var(--pb-radius, 16px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.produk-banner-image {
    width: 100%;
    padding-top: 50%;
    background-size: var(--pb-img-fit, cover);
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    position: relative;
}

.produk-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.produk-image-placeholder svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    stroke: #cbd5e1;
}

.produk-banner-content {
    padding: 0 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-grow: 1;
}

.produk-banner-title {
    margin: 0 0 24px 0 !important;
    font-size: 22px;
    font-weight: 700;
    color: var(--pb-title, #175e71);
    line-height: 1.2;
}

.produk-banner-divider {
    width: 100%;
    border: none;
    border-top: 1px solid var(--pb-title, #175e71);
    margin: 0 0 24px 0 !important;
}

.produk-banner-start {
    font-size: 14px;
    font-weight: 500;
    color: var(--pb-title, #175e71);
    margin-bottom: 8px;
}

.produk-banner-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--pb-price, #175e71);
    margin-bottom: 20px;
}

.produk-banner-btn {
    display: block;
    width: 100%;
    background: var(--pb-btn-bg, #216a7e);
    color: var(--pb-btn-text, #ffffff);
    text-align: center;
    padding: 12px 0;
    border-radius: var(--pb-radius, 8px);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    margin-top: auto;
    transition: opacity 0.3s ease;
}

.produk-banner-btn:hover {
    opacity: 0.85;
    color: var(--pb-btn-text, #ffffff);
}

.produk-empty {
    padding: 24px;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

/* Responsive Grid Adjustments */
@media (max-width: 1024px) {
    .produk-banner-grid:not([data-scroll="horizontal"]) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .produk-banner-grid:not([data-scroll="horizontal"]) {
        grid-template-columns: 1fr !important;
    }
}

/* --- Tombol Bandingkan Styles --- */
.produk-banner-card .produk-compare-btn {
    display: block;
    width: 100%;
    background: var(--pb-btn-bg, #216a7e);
    color: var(--pb-btn-text, #ffffff);
    text-align: center;
    padding: 12px 0;
    border-radius: var(--pb-radius, 8px);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 10px; /* Diubah dari auto agar tidak tumpang tindih dengan Lihat */
    border: none; /* Penting untuk tag <button> */
    cursor: pointer; /* Penting untuk tag <button> */
    transition: opacity 0.3s ease;
    outline: none;
}

.produk-banner-card .produk-compare-btn:hover {
    opacity: 0.85;
    color: var(--pb-btn-text, #ffffff);
    background: var(--pb-btn-bg, #216a7e); /* Paksa background tetap sama agar tema tidak menimpanya */
    border: none; /* Cegah tema menambah border saat hover */
}

.produk-banner-card .produk-compare-btn:active,
.produk-banner-card .produk-compare-btn:focus {
    transform: none !important; /* Menghapus animasi skala/pergeseran saat diklik */
    box-shadow: none !important; /* Menghapus bayangan saat diklik */
    outline: none !important; /* Menghapus garis outline saat diklik */
    background: var(--pb-btn-bg, #216a7e) !important; /* Mencegah tema mengubah background saat diklik */
    color: var(--pb-btn-text, #ffffff) !important; /* Mencegah tema mengubah warna teks saat diklik */
    border: none !important;
}

/* --- Badge Styles --- */
.produk-banner-badge-new {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--pb-badge-bg, #ef4444);
    color: var(--pb-badge-text, #ffffff);
    padding: 4px 12px;
    border-radius: var(--pb-badge-radius, 4px);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Produk Compare - Comparison Component Styles
   ========================================================================== */

/* --- Wrapper --- */
.produk-compare-wrapper {
    padding: 32px 0;
    width: 100%;
}

/* --- Header --- */
.produk-compare-header {
    text-align: center;
    margin-bottom: 32px;
}

.produk-compare-heading {
    font-size: 28px;
    font-weight: 700;
    color: var(--pb-compare-heading-color, var(--pb-title, #175e71));
    margin: 0 0 8px 0;
}

.produk-compare-subtitle {
    font-size: 15px;
    color: #64748b;
    margin: 0;
}

/* --- Selectors Area --- */
.produk-compare-selectors {
    display: none !important;
}

.produk-compare-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
    animation: produkCompareSlotIn 0.3s ease forwards;
}

.produk-compare-slot-enter {
    opacity: 0;
    transform: translateY(-8px);
}

.produk-compare-slot-exit {
    animation: produkCompareSlotOut 0.25s ease forwards;
}

@keyframes produkCompareSlotIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

@keyframes produkCompareSlotOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.produk-compare-select {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: var(--pb-radius, 8px);
    font-size: 14px;
    color: #334155;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    appearance: auto;
}

.produk-compare-select:focus {
    border-color: var(--pb-btn-bg, #216a7e);
    box-shadow: 0 0 0 3px rgba(33, 106, 126, 0.15);
}

.produk-compare-select.produk-compare-loading {
    opacity: 0.6;
    pointer-events: none;
}

.produk-compare-remove-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.produk-compare-remove-slot:hover {
    background: #fecaca;
    transform: scale(1.1);
}

/* --- Add Button --- */
.produk-compare-add-wrap {
    display: none !important;
}

.produk-compare-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--pb-radius, 8px);
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.produk-compare-add-btn:hover {
    border-color: var(--pb-btn-bg, #216a7e);
    color: var(--pb-btn-bg, #216a7e);
    background: rgba(33, 106, 126, 0.04);
}

/* --- Empty State --- */
.produk-compare-empty {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: var(--pb-radius, 8px);
    border: 1px dashed #e2e8f0;
}

.produk-compare-empty svg {
    margin-bottom: 12px;
    opacity: 0.6;
}

.produk-compare-empty p {
    margin: 0;
    font-size: 15px;
}

/* --- Comparison Table --- */
.produk-compare-table-wrap {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    container-type: inline-size;
    border: 1px solid #e2e8f0;
    border-radius: var(--pb-radius, 8px);
}

.produk-compare-table-wrap.produk-compare-table-visible {
    opacity: 1;
    transform: translateY(0);
}

.produk-compare-table-wrap::-webkit-scrollbar {
    height: 6px;
}

.produk-compare-table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.produk-compare-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.produk-compare-table {
    display: grid;
    /* Force exactly 2 product columns visible at a time using container query units */
    grid-template-columns: var(--compare-label-width, 140px) repeat(var(--compare-cols, 2), calc((100cqi - var(--compare-label-width, 140px)) / 2));
    width: max-content;
    min-width: 100%;
    background: #ffffff;
}

.produk-compare-row {
    display: contents;
}

.produk-compare-row:nth-child(even) .produk-compare-label,
.produk-compare-row:nth-child(even) .produk-compare-cell {
    background: #f8fafc;
}

.produk-compare-label {
    display: flex;
    align-items: center;
    padding: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-compare-text, #475569);
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    background: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    left: 0;
    z-index: 10;
    white-space: nowrap; /* Prevent wrapping so width can follow title length */
}

.produk-compare-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-size: 14px;
    color: var(--pb-compare-text, #334155);
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #f1f5f9;
    background: #ffffff;
    text-align: center;
}

.produk-compare-cell p {
    margin: 0;
}

.produk-compare-cell p + p {
    margin-top: 8px;
}

.produk-compare-cell ul,
.produk-compare-cell ol {
    margin: 0;
    padding-left: 20px;
    text-align: left;
}

.produk-compare-cell li {
    margin-bottom: 4px;
}

.produk-compare-cell li:last-child {
    margin-bottom: 0;
}

.produk-compare-cell:last-child {
    border-right: none;
}

.produk-compare-row:last-child .produk-compare-label,
.produk-compare-row:last-child .produk-compare-cell {
    border-bottom: none;
}

/* Cell variants */
.produk-compare-cell-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--pb-title, #175e71);
}

.produk-compare-cell-desc {
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
}

/* Image */
.produk-compare-img-wrap {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 4/3;
    border-radius: calc(var(--pb-radius, 8px) / 2);
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.produk-compare-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.produk-compare-img-placeholder {
    background: #f1f5f9;
}

.produk-compare-img-placeholder svg {
    opacity: 0.5;
}

.produk-compare-no-bg {
    background: transparent;
}

.produk-compare-no-bg img {
    mix-blend-mode: multiply;
    object-fit: contain;
}

/* Price */
.produk-compare-start-text {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.produk-compare-price-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--pb-price, #175e71);
}

.produk-compare-na {
    color: #cbd5e1;
    font-size: 16px;
}

/* Remove button in table */
.produk-compare-table-remove {
    background: transparent;
    color: #94a3b8; /* Warna abu-abu netral */
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    font-size: 16px;
    outline: none;
    box-shadow: none;
}

.produk-compare-table-remove:hover,
.produk-compare-table-remove:active,
.produk-compare-table-remove:focus {
    color: #ef4444; /* Warna merah saat didekati */
    background: transparent;
    transform: none;
    outline: none;
    box-shadow: none;
}

/* Action button */
.produk-compare-detail-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--pb-btn-bg, #216a7e);
    color: var(--pb-btn-text, #ffffff);
    border-radius: var(--pb-radius, 8px);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.3s ease, transform 0.15s ease;
}

.produk-compare-detail-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
    color: var(--pb-btn-text, #ffffff);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .produk-compare-selectors {
        flex-direction: column;
    }

    .produk-compare-slot {
        min-width: 100%;
    }

    .produk-compare-table {
        grid-template-columns: var(--compare-label-width, 100px) repeat(var(--compare-cols, 2), minmax(150px, 1fr));
    }

    .produk-compare-label {
        font-size: 12px;
        padding: 12px 10px;
    }

    .produk-compare-cell {
        padding: 12px 10px;
        font-size: 13px;
    }

    .produk-compare-heading {
        font-size: 22px;
    }

    .produk-compare-img-wrap {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .produk-compare-table {
        grid-template-columns: var(--compare-label-width, 80px) repeat(var(--compare-cols, 2), minmax(120px, 1fr));
    }

    .produk-compare-label {
        font-size: 11px;
        padding: 10px 8px;
    }
}

/* ==========================================================================
   Produk Variant - Child & Parent Layout Styles
   ========================================================================== */

/* --- Wrapper --- */
.produk-variant-wrapper {
    padding: 24px 0;
    width: 100%;
}

.produk-variant-error {
    padding: 16px;
    text-align: center;
    color: #ef4444;
    background: #fef2f2;
    border: 1px dashed #fecaca;
    border-radius: 8px;
    font-size: 14px;
}

/* --- Grid --- */
.produk-variant-grid {
    display: grid;
    grid-template-columns: repeat(var(--pv-cols, 3), 1fr);
    gap: 32px;
    align-items: start;
}

/* --- Card --- */
.produk-variant-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* --- Title --- */
.produk-variant-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

/* --- Image --- */
.produk-variant-image {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.produk-variant-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.produk-variant-image-placeholder {
    background: #f8fafc;
    border-radius: 8px;
}

.produk-variant-image-placeholder svg {
    opacity: 0.4;
}

/* --- Price Button --- */
.produk-variant-price-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--pv-btn-bg, #cc0000) !important;
    color: var(--pv-btn-text, #ffffff) !important;
    border: none;
    border-radius: 999px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 24px;
    transition: filter 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    line-height: 1;
}

.produk-variant-price-btn:hover {
    filter: brightness(0.85);
    transform: translateY(-1px);
    color: var(--pv-btn-text, #ffffff) !important;
}

.produk-variant-price-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--pv-btn-text, #ffffff) !important;
    opacity: 0.85;
    margin-right: 4px;
}

.produk-variant-price-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--pv-btn-text, #ffffff) !important;
}

.produk-variant-price-asterisk {
    font-size: 12px;
    color: var(--pv-btn-text, #ffffff) !important;
    opacity: 0.85;
    margin-left: -2px;
    vertical-align: super;
}

.produk-variant-price-arrow {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: var(--pv-btn-text, #ffffff) !important;
}

/* --- Specification Section --- */
.produk-variant-spec-section {
    width: 100%;
    text-align: left;
}

.produk-variant-spec-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--pv-spec-label-color, #1a1a2e) !important;
    margin: 0 0 10px 0;
    text-align: center;
}

.produk-variant-spec-box {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px 24px;
    min-height: 120px;
}

.produk-variant-spec-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--pv-spec-text-color, #333333) !important;
}

.produk-variant-spec-content p {
    margin: 0 0 8px 0;
    color: inherit !important;
}

.produk-variant-spec-content p:last-child {
    margin-bottom: 0;
}

.produk-variant-spec-content ul,
.produk-variant-spec-content ol {
    margin: 0;
    padding-left: 20px;
    color: inherit !important;
}

.produk-variant-spec-content li {
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: inherit !important;
}

.produk-variant-spec-content strong {
    color: #1a1a2e;
}

.produk-variant-spec-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    margin: 0;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .produk-variant-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 640px) {
    .produk-variant-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .produk-variant-title {
        font-size: 16px;
    }

    .produk-variant-price-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .produk-variant-price-value {
        font-size: 14px;
    }

    .produk-variant-spec-box {
        padding: 16px 18px;
    }
}

/* --- Compare Link Button --- */
.produk-variant-compare-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    font-size: 15px;
    font-weight: 700;
    background: var(--pv-btn-bg, #cc0000) !important;
    color: var(--pv-btn-text, #ffffff) !important;
    text-decoration: none;
    border: none;
    border-radius: 999px;
    padding: 12px 28px;
    transition: filter 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    line-height: 1;
}

.produk-variant-compare-link-btn:hover {
    filter: brightness(0.85);
    transform: translateY(-1px);
    color: var(--pv-btn-text, #ffffff) !important;
}