/* ===== VARIABLES ===== */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --card-bg: #f9f9f9;
    --border-color: #e8e8e8;
    --hover-bg: #f1f1f1;
}

.dark-mode {
    --bg-color: #121212;
    --text-color: #ffffff;
    --card-bg: #1e1e1e;
    --border-color: #2a2a2a;
    --hover-bg: #2a2a2a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }

/* ===== HEADER (DESKTOP DEFAULT) ===== */
header {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 12px 40px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    z-index: 100;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    order: 1; 
}

.logo img { height: 28px; width: auto; }

.search-container {
    position: relative;
    flex-grow: 1;
    max-width: 450px;
    order: 2; 
    margin-right: auto; 
}

#searchInput {
    width: 100%;
    padding: 8px 40px 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: transparent;
    color: var(--text-color);
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

#searchInput:focus { border-color: var(--text-color); }

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-color);
    opacity: 0.5;
}

nav { order: 3; } 

nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
}

nav ul li a {
    font-size: 0.9rem; 
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

nav ul li a:hover { opacity: 1; }

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    order: 4; /* Urutan terakhir */
}

.theme-toggle svg { width: 20px; height: 20px; opacity: 0.8; }
.theme-toggle:hover svg { opacity: 1; }

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ===== SEARCH DROPDOWN ===== */
.search-results {
    position: absolute;
    top: 110%;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.search-results.active { display: block; }

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background-color: var(--hover-bg); }
.search-item img { width: 35px; height: 35px; object-fit: cover; border-radius: 4px; }

/* ===== HERO SLIDER ===== */
.hero-slider {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    height: 400px;
    overflow: hidden;
    position: relative;
}

.slides {
    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; }

/* ===== PRODUCTS ===== */
.products-section { padding: 40px; }

.products-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.product-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.product-card:hover { transform: translateY(-3px); }
.product-card img { width: 100%; height: 180px; object-fit: cover; }
.product-info { padding: 12px 15px; }
.product-info h3 { font-size: 0.95rem; margin-bottom: 4px; font-weight: 600; }
.product-info p { font-size: 0.8rem; color: gray; }

.no-results { text-align: center; padding: 40px; font-size: 1.1rem; }

/* ===== FOOTER ===== */
footer {
    border-top: 1px solid var(--border-color);
    padding: 20px 40px;
    margin-top: 40px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.socials { display: flex; gap: 15px; }

/* ===== RESPONSIVE (TABLET & MOBILE) ===== */

[data-theme="dark"] .logo img {
    filter: invert(1);
}

@media (max-width: 768px) {
    header {
        padding: 12px 20px;
        gap: 12px;
    }
    
    .logo { order: 1; }
    .search-container { 
        order: 2; 
        max-width: none; 
        margin-right: 0; 
        flex-grow: 1; 
    }
    .theme-toggle { order: 3; }
    
    nav {
        order: 4; 
        width: 100%; 
        border-top: 1px solid var(--border-color); 
        padding-top: 10px;
    }
    
    nav ul {
        justify-content: center; 
        gap: 30px;
    }
    
    .hero-slider { height: 250px; }
    .products-section { padding: 20px; }
}

@media (max-width: 480px) {
    .logo span { display: none; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .product-card img { height: 120px; }
}

/* ===== DROPDOWN NAV ===== */
nav ul li.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    min-width: 150px;
    padding: 10px 0;
    z-index: 999;
    list-style: none;
    flex-direction: column;
    gap: 0;
}

.dropdown:hover .dropdown-content {
    display: flex;
}

.dropdown-content li a {
    display: block;
    padding: 8px 20px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.dropdown-content li a:hover {
    background-color: var(--hover-bg);
    opacity: 1;
}