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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --radius: 20px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] {
    --bg-color: #0b1120;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow-md: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.4);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.7; overflow-x: hidden; transition: background-color 0.4s ease, color 0.4s ease; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; border-radius: 12px; }

/* Sticky Glass Header */
header {
    background-color: rgba(var(--surface), 0.85); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    position: fixed; width: 100%; top: 0; z-index: 1000;
    transition: all 0.3s ease;
}
header.scrolled {
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background-color: rgba(var(--surface), 0.95);
}
.nav-container { max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.nav-links { display: flex; gap: 2.5rem; align-items: center; font-weight: 500; }
.nav-links a { transition: color 0.3s ease; }
.nav-links a:hover { color: var(--primary); text-shadow: 0 0 10px rgba(99,102,241,0.3); }

/* Cart & Icons */
.cart-icon { position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; font-size: 1.4rem; border-radius: 50%; background: var(--surface-hover); transition: transform 0.3s; }
.cart-icon:hover { transform: scale(1.1); }
#cart-badge { position: absolute; top: -2px; right: -2px; background: var(--primary-gradient); color: white; border-radius: 20px; padding: 2px 6px; font-size: 0.75rem; font-weight: 700; box-shadow: 0 2px 5px rgba(99, 102, 241, 0.5); }
.menu-toggle { display: none; cursor: pointer; font-size: 1.8rem; color: var(--text-main); }
.theme-toggle { cursor: pointer; background: var(--surface-hover); border: none; color: var(--text-main); font-size: 1.2rem; padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; transition: transform 0.3s; }
.theme-toggle:hover { transform: rotate(30deg) scale(1.1); }

main { max-width: 1200px; margin: 80px auto 0; padding: 3rem 1.5rem; min-height: 70vh; } 

/* Ultra Premium Hero */
.hero {
    text-align: center; padding: 7rem 2rem; background: var(--surface); border-radius: 30px; margin-bottom: 5rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.blob { position: absolute; border-radius: 50%; filter: blur(60px); z-index: 0; opacity: 0.5; animation: floatBlob 10s infinite alternate cubic-bezier(0.4, 0, 0.2, 1); }
.blob-1 { width: 300px; height: 300px; background: #6366f1; top: -100px; left: -100px; }
.blob-2 { width: 300px; height: 300px; background: #a855f7; bottom: -100px; right: -100px; animation-delay: -5s; }
@keyframes floatBlob { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(60px, 60px) scale(1.3); } }
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 4rem; font-weight: 800; line-height: 1.1; margin-bottom: 1.5rem; letter-spacing: -1px; }
.text-gradient-animated { background: linear-gradient(270deg, #6366f1, #a855f7, #ec4899, #6366f1); background-size: 300% 300%; animation: gradientShift 8s ease infinite; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Premium Buttons */
.btn {
    background: var(--primary-gradient); color: white; padding: 1rem 2.5rem; border: none; border-radius: 50px; font-weight: 600; font-size: 1.1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; overflow: hidden;
}
.btn::after { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: 0.5s; }
.btn:hover::after { left: 100%; }
.btn:hover { transform: translateY(-5px) scale(1.02); box-shadow: var(--shadow-glow); color: white; }

/* Filter Bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 3rem; align-items: center; }
.search-input {
    flex: 1; min-width: 250px; padding: 0.8rem 1.2rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 50px; background: var(--surface); color: var(--text-main); outline: none; transition: border-color 0.3s, box-shadow 0.3s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
#category-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.category-btn { 
    padding: 0.5rem 1.2rem; border: 1px solid var(--border); background: var(--surface); 
    color: var(--text-muted); border-radius: 50px; cursor: pointer; font-weight: 500; 
    font-size: 0.95rem; transition: all 0.3s ease;
}
.category-btn:hover { border-color: var(--primary); color: var(--primary); }
.category-btn.active { background: var(--primary-gradient); color: white; border: none; box-shadow: 0 4px 10px rgba(99,102,241,0.3); }

/* Grid & Cards */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2.5rem; margin-top: 2rem; }
.product-card {
    background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-12px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.product-image { height: 240px; width: 100%; object-fit: cover; border-radius: 20px 20px 0 0; transition: transform 0.5s ease; }
.product-card:hover .product-image { transform: scale(1.05); }
.product-info { padding: 1.8rem; flex-grow: 1; display: flex; flex-direction: column; background: var(--surface); position: relative; z-index: 2; }
.product-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.3; }
.product-price { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.discount-price { text-decoration: line-through; color: var(--text-muted); font-size: 1rem; margin-right: 0.5rem; font-weight: 500; }
.badge { position: absolute; top: 15px; right: 15px; background: var(--surface); color: var(--primary); padding: 0.4rem 1.2rem; border-radius: 50px; font-size: 0.8rem; font-weight: 700; box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 3; border: 2px solid var(--primary); backdrop-filter: blur(5px); }

/* Floating Label Form Elements */
.form-floating { position: relative; margin-bottom: 2rem; }
.form-floating input, .form-floating textarea {
    width: 100%; padding: 1.2rem 1rem 0.8rem; font-size: 1rem; border: 2px solid var(--border); border-radius: 12px; background: var(--bg-color); color: var(--text-main); outline: none; transition: border-color 0.3s, box-shadow 0.3s;
}
.form-floating label {
    position: absolute; left: 1rem; top: 1.2rem; color: var(--text-muted); font-weight: 500; cursor: text; transition: transform 0.3s, color 0.3s, font-size 0.3s; transform-origin: left top; pointer-events: none;
}
.form-floating input:focus, .form-floating textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.1); background: var(--surface); }
.form-floating input:focus ~ label, .form-floating input:not(:placeholder-shown) ~ label,
.form-floating textarea:focus ~ label, .form-floating textarea:not(:placeholder-shown) ~ label {
    transform: translateY(-0.8rem) scale(0.8); color: var(--primary); font-weight: 600;
}

/* Scroll Reveal Classes */
.reveal { opacity: 0; transform: translateY(50px); transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* Toasts */
#toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 15px; width: 90%; max-width: 400px; }
@media (min-width: 768px) { #toast-container { left: auto; right: 30px; transform: none; width: auto; min-width: 350px; } }
.toast { background: var(--surface); color: var(--text-main); border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); border: 1px solid rgba(99,102,241,0.2); overflow: hidden; position: relative; display: flex; align-items: center; padding: 1.2rem 1.5rem; font-weight: 600; font-size: 1rem; animation: toastSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 5px; background: var(--primary-gradient); width: 100%; transform-origin: left; animation: progressShrink 3s linear forwards; }
@keyframes toastSlideUp { from { transform: translateY(100%) scale(0.9); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toastFadeOut { from { transform: translateY(0) scale(1); opacity: 1; } to { transform: translateY(20px) scale(0.9); opacity: 0; } }
@keyframes progressShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Cart Kad */
.cart-item-card { display: flex; align-items: center; justify-content: space-between; background: var(--surface); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; gap: 1.5rem; transition: transform 0.3s, box-shadow 0.3s; }
.cart-item-card:hover { transform: translateX(10px); box-shadow: var(--shadow-md); border-color: rgba(99,102,241,0.5); }
.cart-item-info { display: flex; align-items: center; gap: 1.5rem; flex: 1; }
.cart-item-actions { display: flex; align-items: center; gap: 2rem; }
.qty-selector { display: flex; align-items: center; gap: 1rem; background: var(--bg-color); padding: 0.5rem; border-radius: 50px; border: 2px solid var(--border); }
.qty-btn { width: 35px; height: 35px; border-radius: 50%; border: none; cursor: pointer; background: var(--surface); color: var(--text-main); font-weight: bold; font-size: 1.2rem; box-shadow: var(--shadow-sm); transition: all 0.2s; }
.qty-btn:hover { background: var(--primary); color: white; transform: scale(1.1); }

/* Utilities & Footer */
footer { padding: 4rem 1.5rem 2rem; border-top: 1px solid var(--border); margin-top: 5rem; background: var(--surface); }
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; max-width: 600px; margin: 0 auto; text-align: center; }
.social-link { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--text-main); font-size: 1.1rem; background: var(--bg-color); padding: 10px 25px; border-radius: 50px; transition: all 0.3s; }
.social-link:hover { color: white; background: #E1306C; transform: translateY(-5px); box-shadow: 0 10px 20px rgba(225, 48, 108, 0.3); }
.social-link svg { width: 24px; height: 24px; }

/* ==========================================
   MOBILE VIEW (DIPERBAIKI DENGAN SISTEM GRID MUTLAK)
   ========================================== */
@media (max-width: 768px) {
    
    main { margin-top: 60px; padding: 2rem 1rem; }
    .hero { padding: 4rem 1rem; border-radius: 20px; }
    .hero h1 { font-size: 2.3rem; }
    
    /* --- Menu Mobile Guna Sistem GRID --- */
    .nav-links {
        display: grid; /* TUKAR KEPADA GRID */
        grid-template-columns: 1fr 1fr; /* Wajibkan 2 kolum sama rata */
        width: 100%; position: absolute; 
        top: 100%; left: 0; 
        background: var(--surface); 
        padding: 0 1.5rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); 
        max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    }
    
    .nav-links.active { max-height: 400px; opacity: 1; padding: 1rem 1.5rem 2rem; }
    
    /* Utama & Servis ambil penuh dari kiri ke kanan */
    .nav-links li:nth-child(1), 
    .nav-links li:nth-child(2) { 
        grid-column: 1 / -1; 
        width: 100%; text-align: center; padding: 15px 0; border-bottom: 1px dashed var(--border); 
    }
    
    /* Troli & Bulan wajib ambil separuh ruang masing-masing */
    .nav-links li:nth-child(3), 
    .nav-links li:nth-child(4) { 
        grid-column: span 1; 
        display: flex; justify-content: center; align-items: center; padding-top: 20px; 
    }
    
    .menu-toggle { display: block; }
    
    #category-filters { justify-content: center; margin-top: 10px; width: 100%; }
    .category-btn { padding: 0.4rem 1rem; font-size: 0.85rem; margin-bottom: 5px; }

    .checkout-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .cart-item-card { flex-direction: column; align-items: flex-start; padding: 1.2rem; }
    .cart-item-info { width: 100%; }
    .cart-item-info img { width: 70px !important; height: 70px !important; border-radius: 12px; }
    .cart-item-actions { width: 100%; justify-content: space-between; border-top: 1px dashed var(--border); padding-top: 1rem; margin-top: 1rem; }
    
    .cart-item-info h3 { font-size: 1.05rem !important; }
    .cart-item-actions p { font-size: 1.3rem !important; }
    .qty-btn { width: 30px; height: 30px; font-size: 1rem; }
}
