*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

a { color: inherit; text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Navbar */
.navbar { background: var(--primary); color: white; padding: 12px 0; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(37,99,235,0.3); }
.nav-inner { display: flex; align-items: center; gap: 16px; }
.logo { font-size: 1.4rem; font-weight: 700; color: white; flex-shrink: 0; }
.search-form { display: flex; flex: 1; max-width: 500px; }
.search-form input { flex: 1; padding: 8px 14px; border: none; border-radius: var(--radius) 0 0 var(--radius); outline: none; font-size: 0.95rem; }
.search-form button { padding: 8px 16px; background: white; border: none; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-size: 1rem; }
.cart-btn { color: white; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.badge { background: #f59e0b; color: white; border-radius: 999px; padding: 1px 8px; font-size: 0.8rem; font-weight: 700; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--primary), #7c3aed); color: white; text-align: center; padding: 60px 20px; border-radius: var(--radius); margin: 24px 0 32px; }
.hero h1 { font-size: 2.4rem; margin-bottom: 10px; }
.hero p { font-size: 1.1rem; opacity: 0.9; }

/* Layout */
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }

/* Sidebar */
.sidebar h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px; }
.category-list { list-style: none; }
.category-list li { margin-bottom: 4px; }
.category-list a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); transition: all 0.15s; font-size: 0.95rem; }
.category-list a:hover, .category-list a.active { background: var(--primary); color: white; }

/* Products */
.result-info { margin-bottom: 16px; color: var(--text-muted); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.product-card img { width: 100%; height: 200px; object-fit: cover; }
.card-body { padding: 14px; flex: 1; }
.category-tag { background: #eff6ff; color: var(--primary); padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.card-body h3 { margin: 8px 0 6px; font-size: 0.95rem; line-height: 1.3; }
.price { color: var(--primary); font-weight: 700; font-size: 1.1rem; }
.stock-low { color: var(--danger); font-size: 0.8rem; font-weight: 600; }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; font-size: 0.95rem; text-align: center; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.product-card .btn { margin: 0 12px 12px; width: calc(100% - 24px); }

/* Product Detail */
.breadcrumb { margin: 20px 0; font-size: 0.9rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: 20px 0 40px; }
.product-detail img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.product-info .category-tag { display: inline-block; margin-bottom: 10px; }
.product-info h1 { font-size: 1.8rem; margin-bottom: 12px; }
.price-large { font-size: 2rem; color: var(--primary); font-weight: 700; margin-bottom: 16px; }
.description { color: var(--text-muted); line-height: 1.7; margin-bottom: 16px; }
.stock-info { font-size: 0.95rem; margin-bottom: 20px; }
.qty-control { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.qty-input { display: flex; align-items: center; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-input button { background: var(--bg); border: none; padding: 8px 14px; cursor: pointer; font-size: 1.1rem; font-weight: 700; }
.qty-input button:hover { background: var(--primary); color: white; }
.qty-input input { width: 60px; text-align: center; border: none; outline: none; padding: 8px 0; font-size: 1rem; font-weight: 600; }
.action-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.related { margin-top: 48px; }
.related h2 { font-size: 1.4rem; margin-bottom: 20px; }

/* Cart */
.page-title { font-size: 1.8rem; margin: 24px 0 20px; }
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.cart-items { display: flex; flex-direction: column; gap: 16px; }
.cart-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: 80px 1fr auto auto; gap: 16px; align-items: center; }
.cart-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.item-info h3 { font-size: 1rem; margin-bottom: 4px; }
.item-info h3:hover { color: var(--primary); }
.item-actions { display: flex; flex-direction: column; gap: 8px; }
.qty-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.item-subtotal { font-weight: 700; font-size: 1.05rem; color: var(--primary); white-space: nowrap; }
.cart-summary { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; position: sticky; top: 80px; }
.cart-summary h3 { font-size: 1.2rem; margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.total-row { font-weight: 700; font-size: 1.1rem; border-bottom: none; padding-top: 16px; }
.free { color: var(--success); font-weight: 600; }
.cart-summary .btn { margin-top: 16px; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; margin-top: 20px; }
.checkout-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.checkout-form h3 { margin-bottom: 20px; font-size: 1.2rem; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group textarea { width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.95rem; outline: none; transition: border-color 0.15s; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.payment-options { display: flex; flex-direction: column; gap: 10px; }
.radio-option { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color 0.15s; }
.radio-option:hover { border-color: var(--primary); }
.order-summary { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; position: sticky; top: 80px; }
.order-summary h3 { margin-bottom: 16px; font-size: 1.2rem; }
.order-item { display: flex; justify-content: space-between; padding: 8px 0; font-size: 0.9rem; color: var(--text-muted); }
.order-total { display: flex; justify-content: space-between; padding: 14px 0 0; font-weight: 700; font-size: 1.1rem; }
.order-total .price { color: var(--primary); }
hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* Success */
.success-page { text-align: center; padding: 80px 20px; }
.success-icon { font-size: 5rem; margin-bottom: 20px; }
.success-page h1 { font-size: 2rem; margin-bottom: 12px; color: var(--success); }
.success-page p { color: var(--text-muted); margin-bottom: 8px; font-size: 1.05rem; }
.success-actions { margin-top: 30px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { font-size: 1.1rem; margin-bottom: 20px; }

/* Footer */
footer { background: var(--text); color: #94a3b8; text-align: center; padding: 24px; margin-top: 60px; }

/* Responsive */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; gap: 8px; flex-wrap: wrap; }
  .sidebar h3 { display: none; }
  .category-list { display: flex; gap: 8px; flex-wrap: wrap; }
  .category-list li { margin: 0; }
  .product-detail { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .checkout-layout { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 60px 1fr; }
  .item-subtotal { grid-column: 2; }
  .nav-inner { flex-wrap: wrap; }
  .hero h1 { font-size: 1.6rem; }
}
