/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e85d04;
  --primary-dark: #c44d00;
  --primary-light: #fff3ed;
  --secondary: #2d6a4f;
  --accent: #f4a261;
  --bg: #f8f9fa;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --border: #e0e0e0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s ease;
}

html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== NAVBAR ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.5rem;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.4rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.nav-brand i { font-size: 1.6rem; }
.nav-search { flex: 1; display: flex; max-width: 480px; }
.nav-search input { flex: 1; padding: 0.55rem 1rem; border: 2px solid var(--border); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); outline: none; transition: var(--transition); }
.nav-search input:focus { border-color: var(--primary); }
.nav-search button { padding: 0.55rem 1rem; background: var(--primary); color: white; border: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; transition: var(--transition); }
.nav-search button:hover { background: var(--primary-dark); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.btn-nav { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; transition: var(--transition); white-space: nowrap; }
.btn-nav:hover { background: var(--primary); color: white; }
.btn-cart { position: relative; padding: 0.5rem 0.75rem; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 1.1rem; transition: var(--transition); }
.btn-cart:hover { background: var(--primary-dark); transform: scale(1.05); }
.cart-badge { position: absolute; top: -6px; right: -6px; background: #e63946; color: white; font-size: 0.7rem; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ===== PAGES ===== */
.page { display: none; min-height: calc(100vh - 64px); }
.page.active { display: block; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #7b2d00 100%);
  color: white; padding: 4rem 1.5rem 3rem;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2rem;
}
.hero-content h1 { font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 800; margin-bottom: 0.75rem; }
.hero-content p { font-size: 1.1rem; opacity: 0.9; max-width: 520px; margin: 0 auto 1.5rem; }
.hero-stats { display: flex; gap: 3rem; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat span { font-size: 2rem; font-weight: 800; }
.stat small { opacity: 0.8; font-size: 0.85rem; }

/* ===== BUTTONS ===== */
.btn-primary { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; transition: var(--transition); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,93,4,0.4); }
.btn-secondary { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; background: white; color: var(--text); border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; transition: var(--transition); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-full { width: 100%; justify-content: center; }
.btn-back { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); transition: var(--transition); margin-bottom: 1rem; }
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

/* ===== CATEGORIES ===== */
.categories { padding: 2rem 0 1rem; }
.categories h2 { margin-bottom: 1rem; font-size: 1.3rem; }
.category-list { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.category-btn { padding: 0.5rem 1.2rem; border: 2px solid var(--border); border-radius: 50px; background: white; cursor: pointer; font-weight: 500; transition: var(--transition); white-space: nowrap; }
.category-btn:hover, .category-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== PRODUCTS SECTION ===== */
.products-section { padding: 1.5rem 0 3rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.section-header h2 { font-size: 1.3rem; }
.sort-filter select { padding: 0.5rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); background: white; cursor: pointer; outline: none; }
.sort-filter select:focus { border-color: var(--primary); }

/* ===== PRODUCT GRID ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }

.product-card {
  background: white; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: var(--transition); cursor: pointer;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.product-card-img { position: relative; height: 200px; overflow: hidden; background: #f0f0f0; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-card-img img { transform: scale(1.05); }
.product-badge { position: absolute; top: 0.5rem; left: 0.5rem; background: var(--primary); color: white; font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 50px; }
.product-badge.new { background: var(--secondary); }
.product-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.product-category { font-size: 0.75rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.product-name { font-weight: 700; font-size: 0.95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-seller { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }
.product-price { font-size: 1.1rem; font-weight: 800; color: var(--primary); margin-top: auto; }
.product-stock { font-size: 0.75rem; color: var(--text-muted); }
.product-stock.low { color: #e63946; }
.product-card-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--border); display: flex; gap: 0.5rem; }
.btn-add-cart { flex: 1; padding: 0.5rem; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.btn-add-cart:hover { background: var(--primary-dark); }
.btn-detail { padding: 0.5rem 0.75rem; background: white; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.btn-detail:hover { border-color: var(--primary); color: var(--primary); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 1.1rem; margin-bottom: 1rem; }

/* ===== CART SIDEBAR ===== */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-sidebar { position: fixed; top: 0; right: -420px; width: 100%; max-width: 420px; height: 100vh; background: white; z-index: 201; display: flex; flex-direction: column; box-shadow: -4px 0 20px rgba(0,0,0,0.15); transition: right 0.3s ease; }
.cart-sidebar.open { right: 0; }
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.cart-header h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.cart-header button { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.cart-header button:hover { color: var(--primary); }
.cart-items { flex: 1; overflow-y: auto; padding: 1rem 1.5rem; }
.empty-cart { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-cart i { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.3; display: block; }
.cart-item { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.cart-item-img { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; background: #f0f0f0; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { color: var(--primary); font-weight: 700; font-size: 0.9rem; }
.cart-item-qty { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.qty-btn { width: 26px; height: 26px; border: 1px solid var(--border); background: white; border-radius: 4px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.qty-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.qty-num { font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-remove { background: none; border: none; color: #e63946; cursor: pointer; font-size: 1rem; padding: 0.25rem; transition: var(--transition); }
.cart-item-remove:hover { transform: scale(1.2); }
.cart-footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border); }
.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 1.1rem; }
.cart-total strong { color: var(--primary); font-size: 1.3rem; }

/* ===== FORM CARD ===== */
.form-card { background: white; border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.form-card h3 { font-size: 1rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; color: var(--text); border-bottom: 2px solid var(--primary-light); padding-bottom: 0.75rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-group input, .form-group select, .form-group textarea { padding: 0.65rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; transition: var(--transition); background: white; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,93,4,0.1); }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 1rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== IMAGE UPLOAD ===== */
.image-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; cursor: pointer; transition: var(--transition); min-height: 160px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.image-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
#imageUploadPlaceholder i { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 0.5rem; display: block; }
#imageUploadPlaceholder p { font-weight: 600; color: var(--text-muted); }
#imageUploadPlaceholder small { color: var(--text-muted); font-size: 0.8rem; }
#imagePreview { width: 100%; max-height: 240px; object-fit: contain; border-radius: var(--radius-sm); }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: center; gap: 1rem; padding: 1.5rem 0 1rem; flex-wrap: wrap; }
.page-header h2 { font-size: 1.4rem; display: flex; align-items: center; gap: 0.5rem; }

/* ===== CHECKOUT ===== */
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; padding-bottom: 3rem; }
.sticky-card { position: sticky; top: 80px; }
.shipping-options { display: flex; flex-direction: column; gap: 0.75rem; }
.shipping-option { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.shipping-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.shipping-option input { accent-color: var(--primary); }
.shipping-info { flex: 1; }
.shipping-info strong { display: block; font-size: 0.95rem; }
.shipping-info span { font-size: 0.8rem; color: var(--text-muted); }
.shipping-cost { font-weight: 700; color: var(--primary); white-space: nowrap; }
.payment-options { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }
.payment-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.2rem; border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-weight: 500; }
.payment-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.payment-option input { accent-color: var(--primary); }
.checkout-item { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.checkout-item img { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; background: #f0f0f0; }
.checkout-item-info { flex: 1; }
.checkout-item-info .name { font-weight: 600; font-size: 0.9rem; }
.checkout-item-info .qty { font-size: 0.8rem; color: var(--text-muted); }
.checkout-item-price { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.summary-totals { margin-top: 1rem; }
.summary-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.9rem; color: var(--text-muted); }
.summary-row.total { font-size: 1.1rem; font-weight: 800; color: var(--text); border-top: 2px solid var(--border); margin-top: 0.5rem; padding-top: 0.75rem; }
.summary-row.total span:last-child { color: var(--primary); }

/* ===== ORDERS ===== */
.order-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.order-tab { padding: 0.6rem 1.2rem; background: none; border: none; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 600; color: var(--text-muted); transition: var(--transition); margin-bottom: -2px; }
.order-tab:hover { color: var(--primary); }
.order-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.order-card { background: white; border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.order-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.order-id { font-weight: 700; font-size: 0.95rem; }
.order-date { font-size: 0.8rem; color: var(--text-muted); }
.order-status { padding: 0.3rem 0.9rem; border-radius: 50px; font-size: 0.8rem; font-weight: 700; }
.status-pending { background: #fff3cd; color: #856404; }
.status-processing { background: #cce5ff; color: #004085; }
.status-shipped { background: #d4edda; color: #155724; }
.status-delivered { background: #d1ecf1; color: #0c5460; }
.status-cancelled { background: #f8d7da; color: #721c24; }
.order-items-preview { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.order-item-thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; background: #f0f0f0; }
.order-card-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.order-total { font-weight: 800; color: var(--primary); }
.order-actions { display: flex; gap: 0.5rem; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; transition: var(--transition); border: none; }
.btn-sm-primary { background: var(--primary); color: white; }
.btn-sm-primary:hover { background: var(--primary-dark); }
.btn-sm-outline { background: white; color: var(--text); border: 1px solid var(--border) !important; }
.btn-sm-outline:hover { border-color: var(--primary) !important; color: var(--primary); }
.order-timeline { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.timeline-step { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.4rem 0; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 4px; }
.timeline-dot.done { background: var(--secondary); }
.timeline-dot.active { background: var(--primary); box-shadow: 0 0 0 3px rgba(232,93,4,0.2); }
.timeline-text { font-size: 0.85rem; color: var(--text-muted); }
.timeline-text strong { display: block; color: var(--text); font-size: 0.9rem; }

/* ===== PRODUCT DETAIL ===== */
.detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 1rem 0 3rem; }
.detail-img-wrap { border-radius: var(--radius); overflow: hidden; background: #f0f0f0; aspect-ratio: 1; }
.detail-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { display: flex; flex-direction: column; gap: 1rem; }
.detail-category { font-size: 0.8rem; color: var(--primary); font-weight: 700; text-transform: uppercase; }
.detail-name { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.detail-price { font-size: 2rem; font-weight: 800; color: var(--primary); }
.detail-seller { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; background: var(--primary-light); border-radius: var(--radius-sm); }
.detail-seller i { color: var(--primary); }
.detail-desc { color: var(--text-muted); line-height: 1.7; }
.detail-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.detail-meta-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.detail-qty-wrap { display: flex; align-items: center; gap: 1rem; }
.detail-qty-wrap label { font-weight: 600; }
.qty-control { display: flex; align-items: center; gap: 0.5rem; }
.qty-control button { width: 36px; height: 36px; border: 2px solid var(--border); background: white; border-radius: var(--radius-sm); cursor: pointer; font-size: 1.1rem; transition: var(--transition); }
.qty-control button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.qty-control span { font-size: 1.1rem; font-weight: 700; min-width: 32px; text-align: center; }
.detail-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.detail-actions .btn-primary, .detail-actions .btn-secondary { flex: 1; justify-content: center; padding: 0.85rem; }

/* ===== SUCCESS PAGE ===== */
.success-card { max-width: 480px; margin: 4rem auto; text-align: center; background: white; border-radius: var(--radius); padding: 3rem 2rem; box-shadow: var(--shadow); }
.success-icon { font-size: 4rem; color: var(--secondary); margin-bottom: 1rem; }
.success-card h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.success-card p { color: var(--text-muted); margin-bottom: 0.5rem; }
.success-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: #1a1a2e; color: white; padding: 0.85rem 1.5rem; border-radius: 50px; font-weight: 600; z-index: 999; transition: transform 0.3s ease; white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--secondary); }
.toast.error { background: #e63946; }

/* ===== FOOTER ===== */
.footer { background: #1a1a2e; color: #ccc; padding: 3rem 0 1.5rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer h4 { color: white; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.footer p { font-size: 0.9rem; line-height: 1.7; }
.footer ul li { padding: 0.25rem 0; font-size: 0.9rem; cursor: pointer; transition: var(--transition); }
.footer ul li:hover { color: var(--accent); }
.social-links { display: flex; gap: 0.75rem; }
.
