@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary-color: #A0522D; /* Sienna Brown */
    --secondary-color: #FFD700; /* Bumblebee Yellow / Gold */
    --background-color: #FFF8E1; /* Cornsilk / Cream */
    --text-color: #333;
    --card-bg: #ffffff;
    --shadow: 0 4px 8px rgba(0,0,0,0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    text-align: center;
    padding: 1rem;
    color: white;
    background: url('images/header-background.png');
    background-size: cover;
    background-position: center;
}

footer {
    text-align: center;
    padding: 1rem;
    color: white;
    background: url('images/footer-background.png');
    background-size: cover;
    background-position: center;
}

header h1 {
    color: white;
    margin-bottom: 0;
}

header p {
    margin-top: 0.5rem;
    margin-bottom: 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    display: inline-block;
}

main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

h1, h2, h3 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-subtitle {
    margin-top: 3rem;
}

.page {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

#cart-page, #checkout-page, #invoice-page {
    max-width: 700px;
    margin: 2rem auto 0;
}

.hidden {
    display: none;
}

.product-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

/* Layout hack untuk section dengan 1 atau 4 produk agar rata kiri */
.product-container.layout-group-align-start {
    /* Lebar maksimal diatur agar hanya muat 3 kartu (3*250px) + 2 gap (2*1.5rem) */
    /* Ini akan memaksa kartu ke-4 untuk turun ke baris baru */
    max-width: 820px; 
    margin-left: auto;
    margin-right: auto;
    justify-content: flex-start; /* Sejajarkan item ke kiri */
}
.product-card {
    background: var(--card-bg);
    flex: 0 1 250px; /* flex-grow, flex-shrink, flex-basis */
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s;
    /* Jadikan kartu sebagai flex container vertikal */
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-image-container {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background-color: #f0f0f0; /* Placeholder saat gambar loading */
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease; /* Transisi untuk hover zoom jika diinginkan */
}

.product-card-body {
    padding: 0.75rem;
    /* 1. Jadikan flex container dengan arah vertikal */
    display: flex;
    flex-direction: column;
    /* 2. Pastikan elemen ini mengisi sisa ruang di dalam kartu */
    flex-grow: 1;
}

.product-card-body .btn {
    /* 3. Margin atas otomatis akan mendorong tombol ke bawah */
    margin-top: auto;
    width: 100%;
}

.product-card h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-color);
    line-height: 1.3;
}
.pcs-badge {
    background-color: var(--secondary-color);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    vertical-align: middle;
    /* Memberi sedikit jarak dari teks utama */
    margin-left: 4px; 
}

/* --- Mini Slideshow di Kartu Produk --- */
.product-image-container.mini-slideshow > img {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    /* Pastikan gambar tidak bisa diklik saat tidak aktif */
    pointer-events: none;
}

.product-image-container.mini-slideshow > img.active {
    opacity: 1;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    font-size: 1rem;
}

.price-line {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    /* 4. Beri jarak konsisten sebelum tombol */
    margin-bottom: 0.75rem;
}

.stock-status {
    background-color: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.add-to-cart-icon-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.add-to-cart-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-color);
    stroke-width: 3;
    stroke-linecap: round;
}

/* --- Slideshow Styles --- */
.slideshow-container {
    position: relative;
    margin: 0 auto 2rem; /* Margin bottom to separate from catalog */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow);
    aspect-ratio: 16 / 9; /* Default aspect ratio */
    max-width: 820px; /* Samakan dengan lebar katalog produk */
    background-color: #e0e0e0; /* Placeholder color while images load */
}

.slideshow-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slideshow-btn {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
    user-select: none;
    transition: background-color 0.3s ease;
    z-index: 10;
    display: none; /* Sembunyikan di mobile secara default */
}

.slideshow-btn:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.slideshow-btn.prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}

.slideshow-btn.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.slideshow-dots {
    text-align: center;
    position: absolute;
    bottom: 15px;
    width: 100%;
    z-index: 10;
}

.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.dot {
    cursor: pointer;
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.dot.active, .dot:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* --- Testimonial Ticker Styles --- */
#testimonial-ticker-container {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    /* Samakan dengan lebar katalog produk dan tengahkan */
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.ticker-label {
    font-weight: 600;
    padding-right: 0.75rem;
    border-right: 2px solid rgba(255,255,255,0.5);
    margin-right: 0.75rem;
}

.ticker-wrap {
    flex: 1;
    overflow: hidden;
}

#testimonial-ticker-text {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: marquee 30s linear infinite;
}

@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: #804020;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
}
.btn-secondary:hover {
    background-color: #e6c300;
}

.btn-custom-pink {
    background-color: #FF69B4; /* Hot Pink */
    color: white;
}

.btn-custom-pink:hover {
    background-color: #FF1493; /* Deep Pink */
}

#floating-cart {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

#floating-cart-link {
    display: block;
    width: 60px;
    height: 60px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    text-decoration: none;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #DC143C;
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cart-item, .invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
}
.cart-item-details strong {
    font-size: 0.9rem;
}

/* --- Green prices for cart page --- */
#cart-page .cart-item-details small,
#cart-page .cart-item-price,
#cart-page #cart-total {
    color: #28a745;
}

.invoice-item {
    font-size: 0.9rem;
    padding: 0.6rem 0;
}

.invoice-item-qty {
    color: #28a745;
    font-weight: 600;
}

.cart-item-details { flex: 2; }
.cart-item-qty { 
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
}
.cart-item-price { 
    flex: 1; 
    text-align: right; 
    font-size: 0.9rem; /* Mengubah ukuran font harga di keranjang */
}
.qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem; /* Mengurangi jarak antar tombol */
}
.qty-controls button {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background-color: var(--secondary-color);
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1;
    transition: background-color 0.2s;
}
.qty-controls button:hover {
    background-color: #e6c300;
}

.qty-controls span {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
}

.cart-summary { text-align: center; margin-top: 2rem; }

.cart-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#back-to-katalog {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}
#back-to-katalog:hover {
    background-color: #f8f9fa;
}

.testimonial-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #eee;
    text-align: center;
}

.testimonial-section p {
    margin-bottom: 1.5rem;
    color: #555;
}

#testimonial-form {
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}
#checkout-form {
    max-width: 600px;
    margin: 0 auto;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.payment-method-static label {
    text-align: center;
    margin-bottom: 0.75rem;
}

.payment-details {
    background-color: #f0f8ff; /* AliceBlue */
    border: 1px solid #b0e0e6; /* PowderBlue */
    border-radius: 5px;
    padding: 1rem;
    text-align: center;
}
.payment-details p {
    margin: 0 0 0.5rem 0;
}
.account-number-wrapper {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}
.account-number-badge {
    background-color: #87CEEB; /* SkyBlue */
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}
.account-number-badge:hover {
    background-color: #00BFFF; /* DeepSkyBlue */
}
.copy-notice {
    font-size: 0.8rem !important; /* Use important to override other p styles */
    font-style: italic;
    color: #DC143C; /* Crimson */
    margin-top: 0.75rem !important;
}
.form-actions {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
}

.btn-link {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}
.btn-link:hover {
    background-color: #f8f9fa;
}

#invoice-details {
    background: #f9f9f9;
    padding: 1.2rem;
    border-radius: 8px;
    border: 1px dashed var(--primary-color);
    margin-bottom: 1.5rem;
}

#invoice-details p, #invoice-details h3 {
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

#invoice-details h3:last-of-type {
    font-size: 1.1rem;
    margin-top: 1rem;
}

.invoice-notice {
    background-color: #fff5f5;
    color: #DC143C;
    font-weight: 600;
    border: 1px solid #e0718c;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    margin: 1.5rem auto 0;
    max-width: 80%;
}

/* Animation for floating cart */
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.shake {
  animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

#invoice-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.invoice-share-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.invoice-share-options .btn {
    width: 100%;
    box-sizing: border-box; /* Memastikan padding tidak menambah lebar */
    text-align: center;
}

.invoice-loading-notice {
    font-style: italic;
    color: #555;
    margin-top: 1rem;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: translateY(0);
}

.image-modal-content {
    background: transparent;
    padding: 0;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    position: relative;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

#image-modal-src {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

/* Sesuaikan posisi tombol close untuk modal gambar & galeri */
#image-modal .modal-close,
#gallery-modal .modal-close {
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    z-index: 2010; /* Pastikan di atas konten modal */
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #aaa;
    cursor: pointer;
}

#modal-variations-container {
    margin: 1.5rem 0;
}

.variation-option {
    display: block;
    margin-bottom: 0.75rem;
}

.variation-option .price-modifier {
    color: #28a745; /* Green color like stock status */
    font-weight: 600;
    font-size: 0.9em;
}

.modal-actions {
    text-align: center;
    margin-top: 1.5rem;
}

/* --- Multi Variation Modal Styles --- */
.modal-subtitle {
    font-size: 0.9rem;
    color: #555;
    text-align: center;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

#multi-modal-variations-container {
    margin: 1.5rem 0;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 10px; /* Ruang untuk scrollbar */
}

.multi-variation-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.multi-modal-summary {
    text-align: center;
    font-weight: 600;
    margin-top: 1rem;
}

/* --- Gallery Modal Styles --- */
#gallery-modal .modal-content {
    max-width: 600px; /* A bit wider for the gallery */
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.gallery-container-in-modal {
    position: relative;
    border-radius: 8px;
    overflow: hidden; /* To contain the rounded corners of the slideshow */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.gallery-modal-slideshow {
    width: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
    aspect-ratio: 1 / 1;
    background-color: #f0f0f0;
}

.gallery-modal-slideshow:active {
    cursor: grabbing;
}

.gallery-modal-slideshow .slideshow-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.gallery-modal-slideshow .slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.gallery-modal-slideshow .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.gallery-container-in-modal .slideshow-btn {
    display: none;
}

.gallery-container-in-modal .slideshow-dots .dot {
    background-color: rgba(0, 0, 0, 0.4);
}

.gallery-container-in-modal .slideshow-dots .dot.active {
    background-color: rgba(0, 0, 0, 0.9);
}

@media (max-width: 600px) {
    .product-container {
        /* Cukup atur ulang gap untuk mobile */
        gap: 1rem;
        justify-content: flex-start; /* Sejajarkan item ke kiri di mobile */
    }

    .product-card {
        /* Atur agar 2 produk per baris. 50% - (setengah dari gap) */
        flex: 0 1 calc(50% - 0.5rem);
    }

    .product-card h3, .product-card .product-price {
        font-size: 0.85rem;
    }
    .stock-status {
        font-size: 0.7rem;
        padding: 1px 6px;
    }
    .product-card h3 {
        line-height: 1.3;
    }

    .cart-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    .cart-actions .btn {
        width: 100%;
        max-width: none;
    }

    .form-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem; /* Mengurangi jarak antar tombol di mobile */
    }

    .form-actions .btn {
        width: 100%;
        max-width: none;
    }

    .slideshow-container {
        aspect-ratio: 4 / 3; /* Taller for mobile */
        margin-bottom: 1.5rem;
    }

    .slideshow-btn {
        font-size: 16px;
        padding: 12px;
    }
}

/* Tampilkan tombol navigasi slideshow hanya di desktop */
@media (min-width: 768px) {
    .slideshow-btn {
        display: block;
    }
}