/* Variabel CSS untuk Light dan Dark Mode */
:root {
    --primary: #00bfff;
    --secondary: #ff6b6b;
    --accent: #4ecdc4;
    --success: #00b894;
    --warning: #fdcb6e;
    --info: #00a6ff;
    
    /* Light Mode Variables */
    --bg-color: #f5f7ff;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    --header-bg: linear-gradient(135deg, var(--primary), #6c5ce7);
    --footer-bg: #2d3436;
    --footer-text: #f8f9fa;
    
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-color: #1a1d21;
    --card-bg: #2d3436;
    --text-color: #f8f9fa;
    --text-secondary: #b2bec3;
    --border-color: #636e72;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    
    --header-bg: linear-gradient(135deg, #2d3436, #1a1d21);
    --footer-bg: #1a1d21;
}

/* Reset & Base Styles */
* {
    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);
    line-height: 1.6;
    transition: var(--transition);
    padding-bottom: 70px; /* Space for bottom nav */
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== HEADER UNTUK SEARCH ========== */
.search-header {
    background: var(--header-bg);
    color: white;
    padding: 10px 0;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.back-button {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    flex-shrink: 0;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.header-title {
    flex: 1;
    text-align: center;
    padding: 0 15px;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-spacer {
    width: 30px;
    flex-shrink: 0;
}

/* ========== SEARCH BAR ========== */
.search-container {
    margin-bottom: 25px;
    width: 100%;
}

.search-bar {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-button {
    padding: 0 25px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.search-button:hover {
    background: #00a2e6;
}

.search-tips {
    padding: 10px 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.8;
}

.search-tips i {
    color: var(--warning);
    margin-right: 5px;
}

/* ========== QUICK FILTERS (KATEGORI) ========== */
.quick-filters {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 0;
    margin-bottom: 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.quick-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-color);
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.3);
}

/* ========== RESULTS INFO ========== */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

#resultsCount {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

.sort-options select {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.sort-options select:hover {
    border-color: var(--primary);
}

/* ========== PRODUCTS GRID - FIX UNTUK SEMUA DEVICE ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
    width: 100%;
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.product-card:hover::before {
    opacity: 1;
}

.product-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 8px;
    transition: var(--transition);
}

.product-card:hover .product-icon {
    transform: scale(1.05);
}

.product-name {
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    background: rgba(0, 191, 255, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
    display: inline-block;
}

.product-price {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.product-variant-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ========== NO RESULTS ========== */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 20px;
    opacity: 0.7;
}

.no-results h3 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 600;
}

.no-results p {
    font-size: 0.9rem;
}

/* ========== PRODUCT MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { 
        transform: translateY(50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--secondary);
    transform: rotate(90deg);
}

.product-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.product-detail-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-right: 15px;
}

.product-detail-title {
    flex: 1;
}

.modal-title {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

.modal-price {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.modal-description {
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
}

.variant-selection {
    margin-bottom: 20px;
}

.variant-title {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--text-color);
}

.variant-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.variant-option {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.variant-option:hover {
    border-color: var(--primary);
}

.variant-option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.variant-name {
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.variant-price {
    font-weight: bold;
    font-size: 0.9rem;
}

.add-to-cart-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: 1rem;
    margin-top: 20px;
}

.add-to-cart-btn:hover {
    background: #00a2e6;
    transform: translateY(-2px);
}

/* ========== TOAST NOTIFICATION ========== */
.toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s, fadeOut 0.5s 2.5s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

/* ========== FOOTER ========== */
footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
}

.footer-section p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-section a {
    color: var(--footer-text);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    margin-bottom: 8px;
    opacity: 0.8;
    font-size: 0.9rem;
}

.footer-section a:hover {
    opacity: 1;
    color: var(--primary);
    transform: translateX(5px);
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.social-icons a:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 100;
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ========== CART BADGE ========== */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* ========== BOTTOM NAVIGATION ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 90;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    position: relative;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .header-title h1 {
        font-size: 1.1rem;
    }
    
    .search-input {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .search-button {
        padding: 0 20px;
    }
    
    .modal-content {
        max-width: 95%;
        margin: 20px auto;
        padding: 20px;
    }
    
    .variant-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-filters {
        padding: 12px 0;
        margin-bottom: 15px;
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .results-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .product-card {
        padding: 10px;
    }
    
    .product-icon {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }
    
    .product-name {
        font-size: 0.8rem;
        min-height: 2.4em;
    }
    
    .modal-content {
        width: 98%;
        padding: 15px;
        margin: 10px auto;
    }
    
    .product-detail-header {
        flex-direction: column;
        text-align: center;
        margin-bottom: 15px;
    }
    
    .product-detail-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 400px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .product-card {
        padding: 8px;
    }
    
    .product-icon {
        font-size: 1.6rem;
    }
    
    .product-name {
        font-size: 0.75rem;
    }
    
    .quick-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .search-tips {
        font-size: 0.8rem;
        padding: 8px 0 0 0;
    }
    
    .results-info {
        padding: 10px 0;
        margin-bottom: 15px;
    }
    
    #resultsCount {
        font-size: 0.9rem;
    }
    
    .sort-options select {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .header-title h1 {
        font-size: 1rem;
        padding: 0 10px;
    }
}

/* Desktop */
@media (min-width: 769px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }
    
    .product-card {
        padding: 15px;
    }
    
    .product-icon {
        font-size: 2.5rem;
    }
    
    .product-name {
        font-size: 0.9rem;
    }
}

/* Fix untuk HP kecil */
@media (max-height: 600px) {
    .modal-content {
        max-height: calc(100vh - 20px);
        margin: 10px auto;
        overflow-y: auto;
    }
    
    .modal {
        align-items: flex-start;
        padding-top: 10px;
    }
}

/* FIX UNTUK HILANGKAN HIGHLIGHT BIRU DI HP */
button,
a,
input,
textarea,
select,
.close-modal,
.variant-option,
.add-to-cart-btn,
.filter-btn,
.search-button,
.theme-toggle,
.nav-item,
.back-button {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    outline: none !important;
}

/* Untuk accessibility (keyboard navigation) */
button:focus-visible,
a:focus-visible,
.close-modal:focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px !important;
}