/* --- ROOT VARIABLES --- */
:root {
    --primary: #ee4d2d; /* Warna Oranye Shopee/Marketplace */
    --primary-dark: #d73d1f;
    --bg: #f5f5f5;
    --text: #2d3436;
    --text-light: #636e72;
    --white: #ffffff;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --border-radius: 12px;
}

/* --- BASE STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- HEADER & SEARCH --- */
header {
    background: var(--white);
    padding: 30px 0 20px 0;
    text-align: center;
}

header h1 a {
    color: var(--primary);
    text-decoration: none;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
}

.search-container {
    margin-top: 20px;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#searchInput {
    width: 100%;
    padding: 15px 25px;
    border-radius: 30px;
    border: 2px solid #eee;
    outline: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 6px 15px rgba(238, 77, 45, 0.15);
}

/* --- NAVIGATION MENU --- */
nav {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-top: 1px solid #f1f1f1;
    border-bottom: 1px solid #f1f1f1;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
    gap: 10px;
}

nav li a {
    display: block;
    padding: 20px 25px;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

nav li a:hover {
    color: var(--primary);
}

nav li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary);
    transition: all 0.3s;
    transform: translateX(-50%);
}

nav li a:hover::after {
    width: 100%;
}

/* --- PRODUCT GRID & CARDS --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-desc-short {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Tampilkan maks 3 baris */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.5em; /* Menjaga tombol tetap sejajar */
}
.long-description-content {
    text-align: left !important;
    display: block !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    text-indent: 0; /* Pastikan ini 0 */
    white-space: pre-wrap; /* Lebih kuat dari pre-line untuk menjaga spasi dan ganti baris */
    line-height: 1.8;      /* Biar teks yang panjang enak dibaca (gak rapat) */
    color: #444;
    font-size: 1rem;
    margin-top: 20px;
    word-wrap: break-word; /* Agar kata yang sangat panjang tidak keluar dari box */
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Memastikan judul tetap punya ruang yang sama */
.card-content h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text);
    height: 2.8em; /* Maksimal 2 baris */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Tambahan: Membatasi baris deskripsi di CSS (Double Protection) */
.card-content p:not(.price) {
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Batasi maksimal 2 baris deskripsi */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3em; /* Jaga tinggi tetap konsisten */
}

.price {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.price-action-area {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap; /* Biar kalau di HP sempit, tombolnya turun ke bawah */
}

.btn-affiliate {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.3s;
    margin-top: auto;
}

/* Styling Tombol Khusus di Halaman Detail */
.btn-affiliate-detail {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: background 0.3s;
    flex-grow: 1; /* Tombol akan memanjang jika ada ruang */
    max-width: 300px;
}

.btn-affiliate-detail:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 15px rgba(238, 77, 45, 0.3);
}

.btn-affiliate:hover {
    background: var(--primary-dark);
}

/* --- GROUPING KATEGORI --- */
.category-section {
    margin-top: 40px;
    margin-bottom: 20px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.category-header h2 {
    font-size: 1.3rem;
    color: var(--text);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-header hr {
    flex-grow: 1;
    border: 0;
    border-top: 2px solid #ddd;
}

/* --- DETAIL PAGE & CAROUSEL --- */
.detail-wrapper {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.carousel {
    flex: 1;
    min-width: 300px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 400px;
    background: #f9f9f9;
}

.carousel .carousel-item {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    background: #000; /* Hitam biar cinematic pas video loading */
}

.carousel .carousel-item.active {
    display: block;
}

/* Pastikan video nggak nutupin tombol navigasi */
video.carousel-item {
    outline: none;
}

.carousel img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.carousel img.active {
    display: block;
}

.carousel-btns {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    transform: translateY(-50%);
}

.carousel-btns button {
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s;
}

.carousel-btns button:hover {
    background: var(--primary);
}

.detail-info {
    flex: 1.2;
    min-width: 300px;
}

.price-tag {
    font-size: 2.2rem;
    color: var(--primary);
    font-weight: 900;
    margin:0;
}

/* --- PAGINATION --- */
.pagination {
    text-align: center;
    margin: 50px 0;
}

.pagination button {
    padding: 10px 18px;
    margin: 0 5px;
    border: 1px solid #ddd;
    background: var(--white);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 700;
    transition: 0.3s;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- ADS SPACE --- */
.ads-space {
    background: #f1f3f5;
    text-align: center;
    padding: 20px;
    border: 2px dashed #dee2e6;
    margin: 30px 0;
    color: #adb5bd;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* --- FOOTER --- */
footer {
    background: var(--white);
    border-top: 1px solid #eee;
    padding: 50px 0 30px 0;
    margin-top: 80px;
    text-align: center;
}

footer h2 {
    color: var(--primary);
    margin-bottom: 10px;
}

footer p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

footer .footer-links a {
    margin: 0 15px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
}

footer .footer-links a:hover {
    color: var(--primary);
}

/* Responsive untuk HP */
@media (max-width: 480px) {
    .price-action-area {
        gap: 10px;
    }
    .price-tag {
        font-size: 1.8rem;
        width: 100%; /* Harga di baris sendiri */
    }
    .btn-affiliate-detail {
        max-width: 100%; /* Tombol lebar penuh */
    }
}