:root {
    --primary: #1a7a4c;
    --primary-dark: #145c38;
    --primary-light: #e8f5e9;
    --gold: #b8860b;
    --gold-light: #fdf2d0;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --red: #dc2626;
    --red-light: #fef2f2;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Inter', system-ui, sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.6; min-height: 100vh; padding-top: 100px; transition: var(--transition); }

/* ============ HEADER STICKY ============ */
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(229, 231, 235, 0.5); transition: all var(--transition); }
.header.scrolled { box-shadow: var(--shadow-md); }
.header-inner { max-width: 1300px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-brand { display: flex; align-items: center; gap: 12px; cursor: pointer; text-decoration: none; flex-shrink: 0; }
.header-logo { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; transition: var(--transition); background: transparent; box-shadow: none; flex-shrink: 0; }
.header-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-xs); }
.header-logo:hover { transform: scale(1.05); }
.header-title-group { display: flex; flex-direction: column; overflow: hidden; justify-content: center; }

.header-title { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.5px; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.header-title span { color: var(--primary); }
.header-tagline { display: none; } 

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 50px; font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none; transition: all var(--transition); text-decoration: none; white-space: nowrap; letter-spacing: 0.2px; position: relative; overflow: hidden; }
.btn:active { transform: scale(0.96); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(26, 122, 76, 0.2); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: white; box-shadow: 0 4px 10px rgba(184, 134, 11, 0.2); }
.btn-gold:hover { background: #9a7209; transform: translateY(-1px); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: 40px; }
.btn-xs { padding: 5px 10px; font-size: 0.7rem; border-radius: 30px; }
.btn-danger { background: var(--red); color: white; border: none; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--gray-100); border-color: var(--gray-300); }

.cart-btn { position: relative; font-size: 1.2rem; color: var(--gray-700); cursor: pointer; padding: 8px 12px; border-radius: 50px; transition: var(--transition); background: var(--gray-100); border: 1px solid transparent; }
.cart-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.cart-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: white; font-size: 0.65rem; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: popIn 0.3s ease; }
@keyframes popIn { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

.user-dropdown { position: relative; }
.user-dropdown-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 8px 14px; border-radius: 50px; background: var(--gray-100); border: 1px solid transparent; transition: var(--transition); font-weight: 600; color: var(--gray-700); font-size: 0.85rem; }
.user-dropdown-toggle:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.user-dropdown-menu { position: absolute; top: 110%; right: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); border-radius: var(--radius-sm); box-shadow: var(--shadow-xl); min-width: 200px; padding: 8px 0; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all var(--transition); border: 1px solid var(--gray-200); z-index: 1001; }
.user-dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown-menu a, .user-dropdown-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px; border: none; background: none; cursor: pointer; font-size: 0.85rem; color: var(--gray-700); text-align: left; transition: var(--transition); font-family: inherit; }
.user-dropdown-menu a:hover, .user-dropdown-menu button:hover { background: var(--gray-50); color: var(--primary); }
.user-dropdown-menu .divider { height: 1px; background: var(--gray-200); margin: 6px 0; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; }

#authArea.hide-permanent { display: none !important; }

/* ============ SUB HEADER ============ */
.sub-header { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--gray-200); padding: 14px 24px; position: sticky; top: 72px; z-index: 999; transition: var(--transition); }
.sub-header-inner { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.search-wrapper { flex: 1; min-width: 250px; position: relative; }
.search-input { width: 100%; padding: 11px 44px 11px 18px; border-radius: 50px; border: 1.5px solid var(--gray-200); font-size: 0.9rem; transition: all var(--transition); background: var(--gray-50); font-family: inherit; }
.search-input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(26, 122, 76, 0.1); }
.search-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 1rem; pointer-events: none; transition: var(--transition); }
.search-input:focus~.search-icon { color: var(--primary); }

/* Category Chips Horizontal Scroll */
.category-chips { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; -ms-overflow-style: none; }
.category-chips::-webkit-scrollbar { display: none; }
.category-chip { flex-shrink: 0; padding: 8px 16px; border-radius: 50px; font-size: 0.8rem; font-weight: 500; cursor: pointer; border: 1.5px solid var(--gray-300); background: white; color: var(--gray-600); transition: all var(--transition); white-space: nowrap; user-select: none; text-transform: capitalize; }
.category-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.category-chip.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }

/* ============ MAIN CONTENT ============ */
.main-content { max-width: 1300px; margin: 0 auto; padding: 24px; min-height: 60vh; }
.section-title { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.section-title i { color: var(--primary); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.product-card { background: white; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--gray-200); transition: all var(--transition); cursor: pointer; position: relative; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(26, 122, 76, 0.3); }
.product-card:active { transform: scale(0.98); }
.product-image-wrapper { position: relative; width: 100%; aspect-ratio: 4/4.5; overflow: hidden; background: var(--gray-100); }
.product-image-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.product-card:hover .product-image-wrapper img { transform: scale(1.06); }

/* Teks Mid Styles */
.teks-mid-container { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding: 10px 0 20px 0; }
.teks-mid-chip { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 80px; padding: 15px 20px; border-radius: 50px; font-size: 1.15rem; font-weight: 800; background: white; border: 2.5px solid var(--primary); color: var(--primary); text-decoration: none; transition: all var(--transition); text-align: center; box-shadow: var(--shadow-sm); }
.teks-mid-chip:hover { background: var(--primary-light); transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary-dark); color: var(--primary-dark); }

/* Efek Produk Habis */
.product-card.product-habis { cursor: not-allowed; border-color: var(--gray-300); box-shadow: none; }
.product-card.product-habis:hover { transform: none; border-color: var(--gray-300); }
.product-card.product-habis img { filter: grayscale(100%); opacity: 0.6; }
.product-habis .btn-add-cart { display: none; }
.habis-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.7); color: white; padding: 10px 20px; font-weight: 800; font-size: 1.2rem; border-radius: 8px; z-index: 10; letter-spacing: 2px; box-shadow: var(--shadow-md); }

.product-badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 2; }
.badge { padding: 5px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; box-shadow: var(--shadow-sm); }
.badge-discount { background: var(--red); color: white; }
.badge-bestseller { background: var(--gold); color: white; }
.badge-custom { background: var(--primary); color: white; }
.product-info { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-name { font-weight: 700; font-size: 0.95rem; color: var(--gray-900); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.product-desc { font-size: 0.78rem; color: var(--gray-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; word-wrap: break-word; overflow-wrap: break-word; }
.product-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.product-price { font-weight: 800; font-size: 1.1rem; color: var(--primary-dark); }
.product-price-original { font-size: 0.78rem; color: var(--gray-400); text-decoration: line-through; }
.product-card .btn-add-cart { margin-top: 6px; width: 100%; justify-content: center; padding: 10px; font-size: 0.85rem; border-radius: var(--radius-xs); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }

/* ============ MODAL iOS STYLE ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all var(--transition); backdrop-filter: blur(5px); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: var(--radius); width: 95%; max-width: 650px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); transform: translateY(20px) scale(0.98); transition: all var(--transition); position: relative; }
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 900px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); z-index: 10; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--gray-100); cursor: pointer; font-size: 1rem; transition: var(--transition); display: flex; align-items: center; justify-content: center; color: var(--gray-600); }
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }
.modal-body { padding: 20px; }

.detail-slider { position: relative; width: 100%; aspect-ratio: 4/4; border-radius: var(--radius-sm); overflow: hidden; background: var(--gray-100); margin-bottom: 12px; }
.detail-slider img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; opacity: 0; transition: opacity 0.5s ease; border-radius: var(--radius-sm); }
.detail-slider img.active { opacity: 1; position: relative; }
.slider-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); border: none; cursor: pointer; z-index: 5; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); box-shadow: var(--shadow); color: var(--gray-700); }
.slider-nav:hover { background: white; box-shadow: var(--shadow-md); }
.slider-nav.prev { left: 10px; }
.slider-nav.next { right: 10px; }
.slider-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5; }
.slider-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); border: 2px solid rgba(0, 0, 0, 0.2); cursor: pointer; transition: var(--transition); }
.slider-dot.active { background: var(--primary); border-color: var(--primary); transform: scale(1.2); }

.announcement-popup { text-align: center; }
.announcement-image { width: 100%; border-radius: var(--radius-sm) var(--radius-sm) 0 0; display: block; object-fit: cover; max-height: 250px; }
.announcement-text { padding: 20px; font-size: 1rem; color: var(--gray-800); }

/* ============ PANEL ADMIN & TAB ============ */
.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab { padding: 10px 18px; border: none; background: none; cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--gray-500); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: var(--transition); border-radius: 8px 8px 0 0; font-family: inherit; }
.admin-tab:hover { color: var(--primary); background: var(--primary-light); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: white; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.admin-table th { background: var(--gray-50); font-weight: 700; color: var(--gray-700); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 5px; color: var(--gray-700); }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 14px; border-radius: var(--radius-xs); border: 1.5px solid var(--gray-200); font-size: 0.9rem; transition: var(--transition); font-family: inherit; background: var(--gray-50); }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(26, 122, 76, 0.1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.form-inline .form-group { flex: 1; min-width: 150px; }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 24px; transition: var(--transition); }
.toggle-slider:before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: var(--transition); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.toggle-switch input:checked+.toggle-slider { background: var(--primary); }
.toggle-switch input:checked+.toggle-slider:before { transform: translateX(20px); }

.checkout-section { background: var(--gray-50); padding: 15px; border-radius: var(--radius-sm); margin-top: 15px; border: 1px solid var(--gray-200); }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 12px 18px; border-radius: var(--radius-xs); color: white; font-weight: 600; font-size: 0.85rem; animation: slideInRight 0.4s ease, fadeOut 0.3s ease 2.5s forwards; box-shadow: var(--shadow-lg); max-width: 400px; display: flex; align-items: center; gap: 10px; }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* Order History Card & Saved Address Card */
.order-card, .address-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.order-card-header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--gray-100); padding-bottom: 10px; margin-bottom: 10px; }
.order-id { font-weight: 700; color: var(--gray-900); }
.order-date { font-size: 0.8rem; color: var(--gray-500); }
.order-status { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.status-belum_dibayar { background: #fee2e2; color: #b91c1c; }
.status-diproses { background: #fef3c7; color: #b45309; }
.status-dikirim { background: #e0e7ff; color: #4338ca; }
.status-selesai { background: #d1fae5; color: #047857; }

/* FOOTER */
.footer { background: white; border-top: 1px solid var(--gray-200); padding: 24px 24px; text-align: center; color: var(--gray-500); font-size: 0.85rem; margin-top: 40px; }
.footer-links a { color: var(--primary); text-decoration: none; font-weight: 500; margin: 0 8px; transition: var(--transition); }
.footer-links a:hover { color: var(--primary-dark); text-decoration: underline; }

.hidden { display: none !important; }

/* Mobile UI Fixes */
@media (max-width: 768px) {
    .header-inner { padding: 10px 14px; gap: 8px; }
    .header-title { font-size: 1.4rem; } 
    .header-logo { width: 36px; height: 36px; }
    .header-actions { gap: 6px; }
    .btn-sm { padding: 6px 12px; font-size: 0.8rem; }
    .cart-btn { padding: 6px 10px; }
    .sub-header { padding: 10px 14px; top: 60px; }
    
    .product-grid, .teks-mid-container { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .teks-mid-chip { font-size: 0.95rem; min-height: 60px; padding: 10px; border-width: 1.5px; border-radius: 30px; }
    
    .main-content { padding: 14px; }
    body { padding-top: 85px; }
    .form-inline { flex-direction: column; align-items: stretch; gap: 0; }
}