:root {
  --bg: #fafafa; --card: #ffffff; --card-2: #f4f4f4;
  --border: #dbdbdb; --fg: #262626; --muted: #8e8e8e;
  --accent: #0095f6; --accent-d: #0077ed; --accent-2: #ff3040;
  --danger: #ed4956; --success: #2ecc71;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--fg); height: 100vh; overflow: hidden; }
.mono { font-family: ui-monospace, "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d1d1; border-radius: 3px; }

.app-container { position: relative; z-index: 10; height: 100vh; display: flex; flex-direction: column; }

.header { height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; background: var(--card); flex-shrink: 0; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo { 
  width: 36px; height: 36px; border-radius: 10px; 
  background: linear-gradient(135deg, #ee2b3a, #c81d25); 
  display: flex; align-items: center; justify-content: center; 
  color: #fff; box-shadow: 0 2px 8px rgba(238, 43, 58, 0.3); 
  border: none; cursor: pointer; 
}
.brand-text { display: none; }
@media (min-width: 640px) { .brand-text { display: block; } .header { padding: 0 20px; gap: 20px; } }
.brand-title { font-weight: 800; font-size: 16px; line-height: 1; } 
.brand-title span { color: var(--accent); }
.brand-sub { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 3px; }

.search-wrap { flex: 1; max-width: 500px; position: relative; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
#searchInput { width: 100%; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px 10px 44px; color: var(--fg); font-size: 14px; transition: all 0.2s; }
#searchInput:focus { outline: none; border-color: #a1a1a1; background: var(--card); }

.header-right { display: flex; align-items: center; gap: 16px; }
.density-toggle { display: flex; gap: 4px; background: var(--card-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.density-btn { padding: 6px; border-radius: 6px; color: var(--muted); cursor: pointer; display: flex; align-items: center; transition: all 0.2s; background: none; border: none; }
.density-btn.active { background: var(--accent); color: #fff; }

.main-content { flex: 1; overflow-y: auto; padding: 16px 20px 100px; }
.banners-wrap { padding: 0 0 16px; flex-shrink: 0; }
.banner-container { position: relative; height: 80px; margin-bottom: 8px; border-radius: 12px; overflow: hidden; }
.banner-slide { width: 100%; height: 100%; padding: 16px; color: #fff; display: flex; justify-content: space-between; align-items: center; opacity: 0; position: absolute; top: 0; left: 0; transition: opacity 0.5s ease; }
.banner-slide.active { opacity: 1; position: relative; }
.banner-slide h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.banner-slide p { font-size: 12px; opacity: 0.9; }
.info-text-wrap { position: relative; height: 20px; overflow: hidden; }
.info-text { position: absolute; top: 0; left: 0; width: 100%; opacity: 0; transition: opacity 0.5s ease; font-size: 12px; color: var(--muted); }
.info-text.active { opacity: 1; }

.category-tabs { display: flex; gap: 8px; overflow-x: auto; white-space: nowrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.cat-pill { padding: 8px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.cat-pill:hover { color: var(--fg); }
.cat-pill.active { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(0, 149, 246, 0.3); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin: 20px 0 12px; }
.section-header h3 { font-size: 16px; font-weight: 700; }

/* Horizontal Slider (Alfagift Style) */
.h-slider { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }
.h-slider::-webkit-scrollbar { display: none; }
.h-card { min-width: 140px; max-width: 140px; scroll-snap-align: start; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: all 0.2s; }
.h-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.h-card .product-img { width: 100%; aspect-ratio: 1; }
.h-card .card-body { padding: 8px; }

.product-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.density-compact .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.density-dense .product-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

.product-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: all 0.2s ease; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.product-card:active { transform: scale(0.98); }
.product-img { width: 100%; aspect-ratio: 1; background: var(--card-2); overflow: hidden; position: relative; }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.product-card:hover .product-img img { transform: scale(1.05); }
.badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 5px; text-transform: uppercase; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.badge-habis { background: var(--danger); color: #fff; top: 8px; right: 8px; left: auto; }
.card-body { padding: 10px; }
.card-name { font-weight: 600; font-size: 13px; line-height: 1.3; margin-bottom: 4px; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--fg); }
.card-price { font-family: ui-monospace, "Roboto Mono", monospace; font-weight: 700; color: var(--fg); font-size: 14px; margin-bottom: 4px; }
.card-stock { font-size: 9px; margin-bottom: 4px; font-weight: 500; }
.stock-aman { color: var(--muted); }
.stock-tipis { color: var(--accent); }
.stock-habis { color: var(--danger); }
.stock-bar { height: 3px; background: #efefef; border-radius: 2px; overflow: hidden; }
.stock-bar-fill { height: 100%; transition: width 0.4s ease; }

.skeleton-card { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; aspect-ratio: 1; position: relative; overflow: hidden; }
.skeleton-card::after, .spinner { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent); animation: shimmer 1.5s infinite; }
.spinner { position: relative; width: 24px; height: 24px; border: 3px solid #efefef; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
.scroll-loader { display: flex; justify-content: center; padding: 20px; }

.floating-cart { position: fixed; bottom: 24px; right: 24px; background: var(--accent); color: #fff; font-weight: 700; padding: 12px 24px; border-radius: 16px; box-shadow: 0 8px 24px rgba(0, 149, 246, 0.4); display: flex; align-items: center; gap: 12px; cursor: pointer; border: none; z-index: 50; transition: transform 0.2s; }
.floating-cart:active { transform: scale(0.95); }
.cart-icon-wrap { position: relative; }
.cart-badge { position: absolute; top: -8px; right: -10px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--accent); }
.cart-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.cart-total { font-family: ui-monospace, "Roboto Mono", monospace; font-size: 14px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(8px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.show { display: flex; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cart-drawer { position: fixed; top: 0; right: 0; height: 100%; width: 380px; max-width: 100%; background: var(--card); border-left: 1px solid var(--border); display: flex; flex-direction: column; animation: slideInRight 0.4s cubic-bezier(0.34, 1.4, 0.64, 1); }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--card); }
.drawer-title-wrap { display: flex; align-items: center; gap: 10px; }
.drawer-title { font-size: 16px; font-weight: 700; color: var(--fg); }
.drawer-subtitle { font-size: 10px; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); border: 1px solid transparent; color: var(--fg); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.icon-btn:hover { color: var(--danger); border-color: var(--border); }
.cart-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.cart-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.cart-item-img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--card-2); }
.cart-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.cart-item-price { font-size: 12px; color: var(--muted); font-family: ui-monospace, "Roboto Mono", monospace; }
.cart-item-total { font-family: ui-monospace, "Roboto Mono", monospace; font-size: 14px; font-weight: 700; color: var(--fg); }
.drawer-footer { padding: 16px; border-top: 1px solid var(--border); background: var(--card); }

.modal-box { background: var(--card); border-radius: 20px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.15); animation: modalIn 0.4s cubic-bezier(0.34, 1.4, 0.64, 1); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 20px; font-weight: 700; color: var(--fg); }
.modal-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 24px; }
.input-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; display: block; margin-bottom: 8px; }
.input-field { width: 100%; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: var(--fg); font-size: 14px; transition: all 0.2s; }
.input-field:focus { outline: none; border-color: #a1a1a1; background: var(--card); }
.error-text { color: var(--danger); font-size: 12px; margin-top: 8px; }

.btn-primary { width: 100%; background: var(--accent); color: #fff; font-weight: 700; padding: 14px; border-radius: 12px; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all 0.2s; font-size: 14px; }
.btn-primary:hover { background: var(--accent-d); box-shadow: 0 4px 12px rgba(0, 149, 246, 0.3); }
.btn-primary:active { transform: scale(0.98); }
.mt-4 { margin-top: 16px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--card); border: 1px solid var(--border); padding: 14px 24px; border-radius: 12px; z-index: 1000; opacity: 0; transition: all 0.35s cubic-bezier(0.34, 1.4, 0.64, 1); display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--fg); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Category Page Header */
.cat-page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.cat-page-header h3 { font-size: 18px; font-weight: 700; }
.back-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--fg); }