/* HD GIDA B2B PORTAL - PRO DESIGN */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #10b981;
    --accent-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-100: #1e293b;
    --dark-200: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 9999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Plus Jakarta Sans', -apple-system, sans-serif; background: var(--gray-100); color: var(--dark); line-height: 1.6; }
.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* LOGIN */
.login-wrapper { display: flex; min-height: 100vh; }
.login-left { flex: 1; background: var(--gradient-dark); color: var(--white); padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 60px; }
.brand-logo { width: 64px; height: 64px; background: var(--gradient); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; }
.brand-name { font-size: 28px; font-weight: 800; display: block; }
.brand-slogan { font-size: 14px; color: var(--gray-light); }
.login-features { display: flex; flex-direction: column; gap: 32px; }
.feature-item { display: flex; align-items: flex-start; gap: 16px; }
.feature-icon { width: 48px; height: 48px; background: rgba(255,255,255,0.1); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.feature-text strong { display: block; font-size: 16px; margin-bottom: 4px; }
.feature-text span { font-size: 14px; color: var(--gray-light); }

.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--white); }
.login-box { width: 100%; max-width: 400px; }
.login-box h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.login-subtitle { color: var(--gray); margin-bottom: 32px; }

.input-group { margin-bottom: 24px; }
.input-group label { display: block; font-size: 14px; font-weight: 600; color: var(--dark-200); margin-bottom: 8px; }
.input-group input { width: 100%; padding: 16px 20px; font-size: 16px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); outline: none; transition: all 0.2s; }
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.1); }

.otp-header { text-align: center; padding: 24px; background: var(--gray-100); border-radius: var(--radius); margin-bottom: 24px; }
.otp-icon { font-size: 48px; margin-bottom: 12px; }
.otp-inputs { display: flex; gap: 12px; justify-content: center; }
.otp-input { width: 52px; height: 64px; text-align: center; font-size: 24px; font-weight: 700; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); }
.otp-input:focus { border-color: var(--primary); outline: none; }
.otp-actions { display: flex; justify-content: space-between; margin-top: 16px; }

/* BUTTONS */
.btn-primary { width: 100%; padding: 16px 24px; background: var(--gradient); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary { width: 100%; padding: 14px 24px; background: var(--gray-100); color: var(--dark); border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 12px; }
.btn-accent { padding: 12px 24px; background: var(--accent); color: var(--white); border: none; border-radius: var(--radius-full); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-link { background: none; border: none; color: var(--primary); font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-icon { background: var(--gray-100); border: none; width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--gray); }
.btn-back { background: none; border: none; padding: 8px; cursor: pointer; color: inherit; border-radius: var(--radius-sm); }
.btn-lg { padding: 18px 32px; font-size: 17px; }

/* NAVBAR */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.nav-logo { width: 36px; height: 36px; background: var(--gradient); color: var(--white); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.nav-title { font-size: 18px; font-weight: 700; }
.nav-user { display: flex; align-items: center; gap: 16px; }
.nav-user > span { font-size: 14px; color: var(--gray); }

.shop-nav { background: var(--dark); color: var(--white); }
.shop-nav .btn-back { color: var(--white); }
.cart-btn { position: relative; background: rgba(255,255,255,0.1); border: none; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--white); }
.cart-badge { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; background: var(--accent); border-radius: 50%; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* DASHBOARD */
.dashboard { padding: 24px; max-width: 800px; margin: 0 auto; width: 100%; }
.welcome-card { background: var(--gradient); color: var(--white); padding: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.welcome-label { font-size: 14px; opacity: 0.9; display: block; margin-bottom: 4px; }
.welcome-amount { font-size: 36px; font-weight: 800; }
.quick-actions { display: flex; flex-direction: column; gap: 16px; }
.action-card { background: var(--white); padding: 24px; border-radius: var(--radius); display: flex; align-items: center; gap: 20px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow); }
.action-card:hover { transform: translateX(8px); box-shadow: var(--shadow-lg); }
.action-icon { width: 56px; height: 56px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.order-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.ekstre-icon { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.action-content { flex: 1; }
.action-content h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.action-content p { font-size: 14px; color: var(--gray); }
.action-arrow { color: var(--gray-light); }

/* PAGE MAIN */
.page-main { padding: 24px; max-width: 600px; margin: 0 auto; width: 100%; }

/* PAYMENT */
.payment-card { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.payment-balance { text-align: center; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--gray-200); }
.payment-balance span { font-size: 14px; color: var(--gray); display: block; margin-bottom: 4px; }
.payment-balance strong { font-size: 32px; font-weight: 800; color: var(--primary); }
.input-currency { position: relative; }
.input-currency span { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 18px; font-weight: 600; color: var(--gray); }
.input-currency input { padding-left: 48px; font-size: 24px; font-weight: 700; }
.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
.amount-btn { padding: 14px; background: var(--gray-100); border: 2px solid transparent; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.amount-btn:hover { border-color: var(--primary); background: rgba(99,102,241,0.05); }

/* EKSTRE */
.ekstre-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); padding: 20px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.stat-card span { font-size: 13px; color: var(--gray); display: block; margin-bottom: 4px; }
.stat-card strong { font-size: 20px; font-weight: 700; }
.stat-card.highlight { background: var(--gradient); color: var(--white); }
.stat-card.highlight span { color: rgba(255,255,255,0.8); }
.text-red { color: var(--danger); }
.text-green { color: var(--accent); }
.ekstre-list { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ekstre-item { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.ekstre-item:last-child { border: none; }
.ekstre-date { font-size: 12px; color: var(--gray); }
.ekstre-desc { font-weight: 600; }
.ekstre-belge { font-size: 12px; color: var(--gray); }
.ekstre-amount { font-size: 15px; font-weight: 700; }
.ekstre-balance { font-size: 12px; color: var(--gray); }

/* SHOP */
.shop-container { display: flex; flex: 1; overflow: hidden; }
.shop-sidebar { width: 280px; background: var(--white); border-right: 1px solid var(--gray-200); padding: 24px; overflow-y: auto; }
.sidebar-title { font-size: 12px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 16px; }
.cat-list { list-style: none; }
.cat-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 4px; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.cat-item:hover { background: var(--gray-100); }
.cat-item.active { background: var(--primary); color: var(--white); }
.cat-count { font-size: 12px; padding: 2px 8px; background: var(--gray-100); border-radius: var(--radius-full); }
.cat-item.active .cat-count { background: rgba(255,255,255,0.2); color: var(--white); }
.sidebar-info { margin-top: 32px; padding: 20px; background: var(--gray-100); border-radius: var(--radius); }
.sidebar-info h4 { font-size: 14px; margin-bottom: 8px; }
.sidebar-info p { font-size: 13px; color: var(--gray); }
.sidebar-info strong { color: var(--primary); font-size: 18px; }

.shop-main { flex: 1; display: flex; flex-direction: column; background: var(--gray-100); }
.shop-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; background: var(--white); border-bottom: 1px solid var(--gray-200); }
.search-wrapper { display: flex; align-items: center; gap: 12px; background: var(--gray-100); padding: 12px 20px; border-radius: var(--radius-full); width: 320px; }
.search-wrapper input { border: none; background: none; flex: 1; font-size: 14px; outline: none; }
.search-wrapper svg { color: var(--gray); }
.shop-meta { display: flex; align-items: center; gap: 20px; }
#resultCount { font-size: 14px; color: var(--gray); }
.view-modes { display: flex; gap: 4px; }
.view-btn { padding: 8px; background: var(--gray-100); border: none; border-radius: 8px; cursor: pointer; color: var(--gray); }
.view-btn.active { background: var(--dark); color: var(--white); }

/* PRODUCTS */
.products-grid { padding: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; overflow-y: auto; flex: 1; padding-bottom: 100px; }
.products-grid.list-view { grid-template-columns: 1fr; }

.product-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s; position: relative; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }
.product-img { height: 180px; background: var(--gray-100); display: flex; align-items: center; justify-content: center; padding: 16px; position: relative; }
.product-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-badge { position: absolute; top: 12px; left: 12px; padding: 6px 12px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; }
.badge-stock { background: rgba(16,185,129,0.1); color: var(--accent); }
.badge-low { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-out { background: rgba(239,68,68,0.1); color: var(--danger); }
.product-info { padding: 16px; }
.product-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 40px; }
.product-code { font-size: 12px; color: var(--gray); margin-bottom: 12px; }
.product-price { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 16px; }
.product-units { display: flex; gap: 6px; margin-bottom: 12px; }
.unit-btn { flex: 1; padding: 8px 4px; background: var(--gray-100); border: 2px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.2s; }
.unit-btn:hover { border-color: var(--primary); }
.unit-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.unit-btn span { display: block; font-size: 10px; font-weight: 400; opacity: 0.7; }
.product-actions { display: flex; gap: 8px; }
.qty-control { display: flex; align-items: center; background: var(--gray-100); border-radius: 8px; overflow: hidden; }
.qty-btn { width: 36px; height: 36px; border: none; background: none; font-size: 18px; font-weight: 600; cursor: pointer; color: var(--dark); }
.qty-btn:hover { background: var(--gray-200); }
.qty-value { width: 40px; text-align: center; font-weight: 700; font-size: 15px; }
.add-btn { flex: 1; padding: 10px; background: var(--primary); color: var(--white); border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.add-btn:hover { background: var(--primary-dark); }
.add-btn:disabled { background: var(--gray-200); color: var(--gray); cursor: not-allowed; }

/* CART BAR */
.cart-bar { position: fixed; bottom: 0; left: 280px; right: 0; background: var(--white); padding: 16px 24px; box-shadow: 0 -4px 20px rgba(0,0,0,0.1); display: none; align-items: center; justify-content: space-between; z-index: 100; }
.cart-bar.show { display: flex; }
.cart-bar-info { display: flex; align-items: center; gap: 24px; }
.cart-bar-total { font-size: 24px; font-weight: 800; color: var(--primary); }
.cart-bar .btn-primary { width: auto; padding: 14px 32px; }

/* MODAL */
.modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--white); width: 90%; max-width: 500px; max-height: 85vh; border-radius: var(--radius); display: flex; flex-direction: column; animation: modalIn 0.3s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 20px; }
.modal-close { background: none; border: none; font-size: 28px; color: var(--gray); cursor: pointer; }
.modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--gray-200); background: var(--gray-100); border-radius: 0 0 var(--radius) var(--radius); }
.cart-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cart-total-row strong { font-size: 24px; color: var(--primary); }

.cart-item { display: flex; gap: 16px; padding: 16px; background: var(--gray-100); border-radius: var(--radius-sm); margin-bottom: 12px; }
.cart-item-img { width: 60px; height: 60px; background: var(--white); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cart-item-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.cart-item-meta { font-size: 12px; color: var(--gray); }
.cart-item-price { font-weight: 700; color: var(--primary); }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.cart-item-qty button { width: 28px; height: 28px; border: none; background: var(--white); border-radius: 6px; cursor: pointer; font-weight: 600; }
.cart-item-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 20px; }
.empty-cart { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-cart-icon { font-size: 64px; margin-bottom: 16px; }

/* TOAST */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: var(--dark); color: var(--white); padding: 16px 28px; border-radius: var(--radius-full); font-size: 14px; font-weight: 500; opacity: 0; transition: all 0.3s; z-index: 2000; }
.toast.show { opacity: 1; }
.toast.success { background: var(--accent); }
.toast.error { background: var(--danger); }

.loading-spinner { width: 40px; height: 40px; border: 4px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .login-left { display: none; }
    .shop-sidebar { width: 240px; }
    .cart-bar { left: 240px; }
}
@media (max-width: 768px) {
    .shop-sidebar { display: none; }
    .cart-bar { left: 0; }
    .products-grid { grid-template-columns: repeat(2, 1fr); padding: 16px; gap: 12px; }
    .product-img { height: 140px; }
    .ekstre-stats { grid-template-columns: 1fr; }
}
