/* =========================================
   1. VARIABLES (DARK THEME)
   ========================================= */
:root {
    --primary: #3b82f6;       /* Biru Terang */
    --primary-dark: #2563eb;  
    --accent: #22c55e;        /* Hijau Neon */
    --accent-dark: #16a34a;
    
    --bg-body: #0f172a;       /* Background Utama Gelap */
    --bg-card: #1e293b;       /* Background Kartu */
    --bg-input: #334155;      /* Background Input */
    
    --text-main: #f1f5f9;     /* Teks Putih */
    --text-muted: #94a3b8;    /* Teks Abu */
    
    --border-color: #334155;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

a { text-decoration: none; }
ul { list-style: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* =========================================
   2. HEADER & HERO
   ========================================= */
.main-header {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky; top: 0; z-index: 100;
    border-bottom: 1px solid var(--border-color);
}
.header-content { display: flex; justify-content: flex-start; align-items: center; }

.logo { font-size: 1.8rem; font-weight: 800; color: var(--text-main); letter-spacing: -1px; }
.logo span { color: var(--primary); text-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }

.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    color: var(--text-main);
    text-align: center;
    padding: 4rem 1rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
}
.hero h2 { font-size: 2.5rem; margin-bottom: 0.5rem; font-weight: 700; }
.hero p { color: var(--text-muted); }

/* =========================================
   3. SEARCH BAR & TOOLBAR
   ========================================= */
.shop-toolbar-wrapper {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px; padding: 15px 0;
    box-shadow: var(--shadow-sm);
}
.toolbar-inner { display: block; }

.toolbar-form {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
}

/* Search Box */
.search-box { position: relative; width: 100%; max-width: 400px; }
.search-box input {
    width: 100%; padding: 10px 15px 10px 40px;
    border-radius: 50px; border: 1px solid var(--border-color);
    background: var(--bg-body); color: var(--text-main);
    transition: 0.3s;
}
.search-box input:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* Right Group */
.toolbar-right-group { display: flex; align-items: center; gap: 20px; }
.product-count { color: var(--text-muted); font-size: 0.9rem; }
.product-count b { color: var(--text-main); }

.select-wrapper {
    position: relative; display: flex; align-items: center;
    background: var(--bg-body); border-radius: 50px; padding: 0 20px;
    border: 1px solid var(--border-color);
}
.select-wrapper:hover { border-color: var(--primary); }
.select-wrapper i { color: var(--primary); margin-right: 8px; pointer-events: none; }
.custom-select { 
    border: none; background: transparent; padding: 10px 5px; 
    font-weight: 600; cursor: pointer; outline: none; color: var(--text-main); 
}
.custom-select option { background: var(--bg-card); color: var(--text-main); }

/* =========================================
   4. PRODUCT GRID
   ========================================= */
.main-content { padding-bottom: 60px; flex: 1; }
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 25px; width: 100%;
}
@media (min-width: 1024px) {
    .product-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

.product-card {
    background: var(--bg-card);
    border-radius: 16px; overflow: hidden;
    box-shadow: var(--shadow-md); transition: transform 0.3s ease;
    display: flex; flex-direction: column;
    border: 1px solid var(--border-color);
}
.product-card:hover { 
    transform: translateY(-8px); box-shadow: var(--shadow-lg); 
    border-color: var(--primary);
}

.img-wrapper {
    height: 220px; background: #020617;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; border-bottom: 1px solid var(--border-color);
}
.img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.product-card:hover .img-wrapper img { transform: scale(1.1); }

.product-details { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.product-title { font-size: 1.1rem; color: var(--text-main); margin-bottom: 5px; font-weight: 600; }
.product-desc { 
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; 
    line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; 
}
.product-price { font-size: 1.3rem; color: var(--primary); font-weight: 700; margin-bottom: 20px; margin-top: auto; text-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }

.btn-buy {
    background-color: var(--accent); color: #fff;
    padding: 12px; border-radius: 10px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: 0.3s; text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-buy:hover { background-color: var(--accent-dark); box-shadow: 0 0 10px rgba(34, 197, 94, 0.4); }

/* =========================================
   5. ADMIN PANEL
   ========================================= */
.admin-body { background: #020617; } 
.admin-nav { 
    background: var(--bg-card); color: var(--text-main); 
    padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 1px solid var(--border-color);
}
.admin-container { 
    max-width: 1400px; width: 95%; 
    margin: 40px auto; padding: 0 20px; 
}

/* Tabs System */
.tab-navigation { display: flex; gap: 5px; padding-left: 10px; margin-bottom: 0; }
.tab-btn { 
    padding: 12px 25px; background: var(--bg-body); color: var(--text-muted); 
    border: 1px solid transparent; border-bottom: none;
    border-radius: 10px 10px 0 0; font-weight: 600; cursor: pointer; 
}
.tab-btn:hover { color: var(--text-main); background: #334155; }
.tab-btn.active { 
    background: var(--bg-card); color: var(--primary); 
    border: 1px solid var(--border-color); border-bottom: 1px solid var(--bg-card);
    position: relative; z-index: 2; 
}

/* Logic Hide/Show Tabs */
.tab-content { display: none; animation: slideUp 0.3s ease-out; }
.tab-content.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Forms */
.admin-card { 
    background: var(--bg-card); 
    border-radius: 0 12px 12px 12px; 
    box-shadow: var(--shadow-md); position: relative; z-index: 1; 
    border: 1px solid var(--border-color);
}
.tab-navigation + .tab-content .admin-card { border-top-left-radius: 0; }
.card-header { background: rgba(255, 255, 255, 0.03); padding: 20px 30px; border-bottom: 1px solid var(--border-color); }
.card-header h3 { color: var(--text-main); margin: 0; }
.card-body { padding: 30px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group textarea, .file-input { 
    width: 100%; padding: 12px; background: var(--bg-input); 
    color: var(--text-main); border: 1px solid var(--border-color); border-radius: 8px; 
}
.form-group input:focus { border-color: var(--primary); outline: none; }

.btn-primary { width: 100%; padding: 14px; border: none; border-radius: 8px; background: var(--primary); color: white; font-weight: 700; cursor: pointer; }
.btn-success { width: 100%; padding: 14px; border: none; border-radius: 8px; background: var(--accent); color: white; font-weight: 700; cursor: pointer; }
.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; color: #fff; }
.alert.success { background: rgba(34, 197, 94, 0.2); border: 1px solid var(--accent); color: var(--accent); }
.alert.info { background: rgba(59, 130, 246, 0.2); border: 1px solid var(--primary); color: var(--primary); }

/* Tables & Modals */
.table-responsive { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.admin-table th, .admin-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.admin-table th { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); }
.admin-table tr:hover { background: rgba(255, 255, 255, 0.02); }
.admin-table img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }

.action-btn { padding: 6px 12px; border-radius: 6px; color: white; border: none; cursor: pointer; margin-right: 5px; }
.btn-edit { background: #eab308; color: #000; }
.btn-delete { background: #ef4444; }

.modal { display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal.show { display: flex; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: 12px; width: 100%; max-width: 500px; position: relative; border: 1px solid var(--border-color); }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }

/* Login & Footer */
.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; background: var(--bg-body); }
.login-box { background: var(--bg-card); padding: 40px; border-radius: 16px; width: 100%; max-width: 400px; text-align: center; border: 1px solid var(--border-color); }
.login-box button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; }
footer { text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.9rem; margin-top: auto; border-top: 1px solid var(--border-color); background: var(--bg-card); }

/* Responsive */
@media (max-width: 768px) {
    .product-grid { grid-template-columns: 1fr 1fr; }
    .toolbar-form { flex-direction: column-reverse; gap: 15px; }
    .search-box, .toolbar-right-group { width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) { .product-grid { grid-template-columns: 1fr; } }