/* ==========================================================================
   1. BASE STYLES & LAYOUT CENTERING
   ========================================================================== */
:root {
    --user-primary: <?php echo htmlspecialchars($accent_color);
    ?>;
}


/* Styling khusus ketika halaman dibuka di dalam iframe mockup HP */
body.is-iframe {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Menyesuaikan kontainer utama agar tidak over-scale di dalam mockup */
body.is-iframe .store-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-bottom: 20px !important;
    box-sizing: border-box !important;
}

/* Menyesuaikan Banner agar proporsional di dalam iframe */
body.is-iframe .store-banner,
body.is-iframe .store-banner-wrapper {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Mengatur tata letak produk di dalam iframe */
body.is-iframe .layout-list .product-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 20px !important;
    padding: 15px !important;
    width: 94% !important;
}

body.is-iframe .layout-list .product-card .product-image,
body.is-iframe .layout-list .product-card img {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
}

body.is-iframe .layout-list .product-card .product-details {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
}

body.is-iframe .layout-list .product-card .product-title {
    font-size: 1rem !important;
    margin-bottom: 2px !important;
}

body.is-iframe .layout-list .product-card .product-desc {
    font-size: 0.9rem !important;
    margin-bottom: 4px !important;
}

body.is-iframe .layout-list .product-card .product-price {
    font-size: 1rem !important;
}

body.is-iframe .store-footer {
    margin-bottom: 0 auto !important;
}

html,
body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    background-color: #0f172a;
    /* Warna latar belakang luar */
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* Membuat kontainer persis di tengah layar horizontal */
    align-items: flex-start;
}

/* Scrollbar Bawaan (Clean View) */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* ==========================================================================
   2. MAIN CONTAINER (DESKTOP CENTERING & MOBILE FRAME)
   ========================================================================== */
.store-container {
    width: 100%;
    max-width: 480px;
    /* Batasi lebar maksimal ala tampilan HP di desktop */
    min-height: 100vh;
    margin: 0 auto;
    /* Posisi terpusat di tengah layar */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    /* Efek pembatas visual di desktop */
}

.store-content {
    padding: 0 20px 20px 20px;
    flex: 1;
    /* Mendorong footer ke paling bawah */
}

/* ==========================================================================
   3. FOOTER PROFILE STYLING
   ========================================================================== */
.store-footer {
    width: 100%;
    padding: 24px 20px;
    background-color: rgba(15, 23, 42, 0.8);
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    margin-top: auto;
}

.store-footer p {
    margin: 0;
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
}

.store-footer img {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* ==========================================================================
   4. STORE HEADER & PROFILE
   ========================================================================== */
.store-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: linear-gradient(135deg, #0284c7, #0f172a);
    display: block;
}

.store-header {
    text-align: center;
    padding: 0 20px 20px 20px;
    position: relative;
}

.store-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: -45px auto 12px auto;
    border: 4px solid #0f172a;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.store-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.store-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 6px 0;
    color: #f8fafc;
}

.store-bio {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0 auto 15px auto;
    max-width: 500px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1e293b;
    color: #f8fafc;
    text-decoration: none;
    border: 1px solid #334155;
    transition: all 0.2s;
}

.social-btn:hover {
    background: var(--user-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ==========================================================================
   5. PRODUCT CARDS & LAYOUTS (EQUAL HEIGHT GRID FIXED)
   ========================================================================== */
.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-items: stretch;
}

.layout-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    height: 100%;
}

.product-card {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #334155;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: var(--user-primary);
}

.layout-list .product-card {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.layout-list .product-image {
    width: 120px;
    height: 120px;
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    /* Presisi rasio 1:1 */
    height: auto;
    object-fit: cover;
    background-color: #0f172a;
    flex-shrink: 0;
}

.product-details {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* KUNCI TINGGI JUDUL (Maksimal 2 baris) */
.product-title {
    font-size: 0.85rem;
    font-weight: bold;
    margin: 0 0 4px 0;
    color: #f8fafc;
    line-height: 1.3;
    height: 2.6em;
    /* Mengunci ruang 2 baris teks */

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* KUNCI TINGGI DESKRIPSI (Maksimal 2 baris) */
.product-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
    line-height: 1.3;
    height: 2.6em;
    /* Mengunci ruang 2 baris teks */

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* HARGA SELALU RATA DI BAWAH */
.product-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--user-primary);
    margin-top: auto;
    padding-top: 4px;
}

.badge-type {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.6rem;
    border-radius: 4px;
    background: #334155;
    color: #cbd5e1;
    margin-bottom: 6px;
    width: fit-content;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* LAYOUT LIST OVERRIDE (AGAR TAMPILAN LIST TETAP NORMAL) */
.layout-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layout-list .product-card-link {
    height: auto;
}

.layout-list .product-card {
    flex-direction: row;
    align-items: center;
}

.layout-list .product-image {
    width: 90px;
    height: 90px;
    aspect-ratio: 1 / 1;
}

.layout-list .product-title,
.layout-list .product-desc {
    height: auto;
    /* Mengembalikan tinggi alami untuk mode list */
}

/* ==========================================================================
   6. MODAL & CAROUSEL
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

.modal-content {
    background: #1e293b;
    max-width: 440px !important;
    width: 90% !important;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #334155;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 260px;
    background: #000;
    overflow: hidden;
}

.carousel-slide {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.carousel-slide.active {
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 18px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.thumbnail-container {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    background: #0f172a;
}

.thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    opacity: 0.6;
    cursor: pointer;
    border: 2px solid transparent;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--user-primary);
}

.modal-body {
    padding: 18px;
}

.btn-buy {
    display: block;
    text-align: center;
    background: var(--user-primary);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
}

/* ==========================================================================
   7. BACKGROUND PATTERNS
   ========================================================================== */
/* CSS Patterns */
.pattern-dots {
    background-color: #0f172a !important;
    background-image: radial-gradient(#334155 1px, transparent 1px) !important;
    background-size: 12px 12px !important;
}

.pattern-grid {
    background-color: #0f172a !important;
    background-image: linear-gradient(to right, #1e293b 1px, transparent 1px), linear-gradient(to bottom, #1e293b 1px, transparent 1px) !important;
    background-size: 16px 16px !important;
}

.pattern-stripes {
    background-color: #0f172a !important;
    background-image: repeating-linear-gradient(45deg, #1e293b 0, #1e293b 2px, transparent 0, transparent 10px) !important;
}

.pattern-waves {
    background-color: #0f172a !important;
    background-image: radial-gradient(circle at 100% 150%, #1e293b 24%, #0f172a 25%, #0f172a 28%, #1e293b 29%, #1e293b 36%, transparent 36%), radial-gradient(circle at 0 150%, #1e293b 24%, #0f172a 25%, #0f172a 28%, #1e293b 29%, #1e293b 36%, transparent 36%) !important;
    background-size: 24px 12px !important;
}

/* ==========================================================================
   8. RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 480px) {
    .store-container {
        box-shadow: none;
    }

    .carousel-container {
        height: 200px;
    }

    .modal-content {
        max-height: 95vh;
        border-radius: 8px;
    }

    .layout-list .product-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .layout-list .product-image {
        width: 100%;
        height: 140px;
    }
}