/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; cursor: pointer; text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select { font-family: inherit; }

/* ========== HEADER ========== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  height: 70px;
}
.logo { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 22px; font-weight: 800; color: #1a1a2e; }
.logo-accent { color: #f97316; }
.search-box {
  flex: 1; max-width: 480px; display: flex;
  border: 2px solid #e2e8f0; border-radius: 12px; overflow: hidden;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: #f97316; }
.search-box input {
  flex: 1; padding: 10px 16px; border: none; outline: none;
  font-size: 15px; background: transparent;
}
.search-btn {
  padding: 10px 16px; background: #f97316; color: #fff;
  font-size: 16px; border: none; transition: background 0.2s;
}
.search-btn:hover { background: #ea580c; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.cart-btn {
  position: relative; cursor: pointer; padding: 8px 12px;
  border-radius: 10px; transition: background 0.2s;
}
.cart-btn:hover { background: #f1f5f9; }
.cart-icon { font-size: 24px; }
.cart-count {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
#authArea, #userArea { display: flex; gap: 8px; align-items: center; }
.user-greeting { font-weight: 600; font-size: 14px; color: #334155; }
.mobile-menu-btn { display: none; font-size: 28px; background: none; padding: 8px; }

/* ========== BUTTONS ========== */
.btn {
  padding: 10px 24px; border-radius: 10px; font-weight: 600; font-size: 15px;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: #f97316; color: #fff; }
.btn-primary:hover { background: #ea580c; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(249,115,22,0.4); }
.btn-outline { background: transparent; color: #475569; border: 2px solid #e2e8f0; }
.btn-outline:hover { border-color: #f97316; color: #f97316; }
.btn-hero {
  background: #f97316; color: #fff; padding: 16px 40px; font-size: 18px;
  border-radius: 14px; box-shadow: 0 8px 24px rgba(249,115,22,0.35);
}
.btn-hero:hover { background: #ea580c; transform: translateY(-2px); box-shadow: 0 12px 32px rgba(249,115,22,0.45); }
.btn-sm { padding: 6px 16px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-cart {
  background: #f97316; color: #fff; padding: 10px 20px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
}
.btn-cart:hover { background: #ea580c; }

/* ========== HERO ========== */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 100px 24px 80px; text-align: center; color: #fff;
}
.hero-content { position: relative; z-index: 2; max-width: 700px; margin: 0 auto; }
.hero h1 { font-size: clamp(32px, 5vw, 56px); font-weight: 800; line-height: 1.15; margin-bottom: 20px; }
.hero p { font-size: 18px; color: #94a3b8; margin-bottom: 36px; }
.hero-shapes { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.shape {
  position: absolute; border-radius: 50%; opacity: 0.08;
}
.shape-1 { width: 400px; height: 400px; background: #f97316; top: -100px; right: -100px; animation: float 8s ease-in-out infinite; }
.shape-2 { width: 300px; height: 300px; background: #3b82f6; bottom: -80px; left: -60px; animation: float 10s ease-in-out infinite reverse; }
.shape-3 { width: 200px; height: 200px; background: #22c55e; top: 50%; left: 60%; animation: float 6s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* ========== FEATURES ========== */
.features {
  max-width: 1280px; margin: -40px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  position: relative; z-index: 3;
}
.feature-card {
  background: #fff; border-radius: 16px; padding: 28px 24px;
  text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,0.1); }
.feature-icon { font-size: 36px; display: block; margin-bottom: 12px; }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: #64748b; }

/* ========== SECTIONS ========== */
.section { max-width: 1280px; margin: 0 auto; padding: 60px 24px; }
.section-title {
  font-size: 28px; font-weight: 800; margin-bottom: 32px; text-align: center;
}

/* ========== CATEGORIES GRID ========== */
.categories-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.category-card {
  background: #fff; border-radius: 16px; padding: 32px 24px;
  text-align: center; cursor: pointer; transition: all 0.3s;
  border: 2px solid transparent; box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.category-card:hover {
  border-color: #f97316; transform: translateY(-6px);
  box-shadow: 0 8px 30px rgba(249,115,22,0.15);
}
.category-card .cat-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.category-card h3 { font-size: 17px; margin-bottom: 6px; }
.category-card p { font-size: 13px; color: #64748b; }

/* ========== PRODUCTS GRID ========== */
.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px;
}
.product-card {
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  transition: transform 0.3s, box-shadow 0.3s; cursor: pointer;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 12px 36px rgba(0,0,0,0.1); }
.product-img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  background: #f1f5f9;
}
.product-info { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.product-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.product-desc { font-size: 13px; color: #64748b; margin-bottom: 10px; }
.product-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.product-rating { font-size: 13px; color: #f59e0b; }
.product-reviews { font-size: 12px; color: #94a3b8; }
.product-price-row { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.product-price { font-size: 20px; font-weight: 800; color: #f97316; }
.product-old-price { font-size: 14px; color: #94a3b8; text-decoration: line-through; }
.product-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; margin-bottom: 8px; width: fit-content;
}
.badge-sale { background: #fef2f2; color: #ef4444; }
.badge-new { background: #f0fdf4; color: #22c55e; }
.product-card .btn-cart { margin-top: 12px; }

/* ========== THEME TOGGLE ========== */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 12px;
  background: #f1f5f9; border: 2px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s; flex-shrink: 0;
}
.theme-toggle:hover { border-color: #f97316; transform: scale(1.08); }
.theme-icon { font-size: 20px; transition: transform 0.3s; }
.theme-toggle:active .theme-icon { transform: rotate(20deg); }

/* ========== CATALOG HEADER ========== */
.catalog-header { display: flex; align-items: center; gap: 20px; margin-bottom: 8px; }
.catalog-header .section-title { text-align: left; margin-bottom: 0; }
.catalog-filters { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 18px; border-radius: 20px; font-size: 14px; font-weight: 500;
  background: #fff; border: 2px solid #e2e8f0; cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: #f97316; color: #f97316; }
.chip.active { background: #f97316; color: #fff; border-color: #f97316; }
.sort-select select {
  padding: 8px 16px; border-radius: 10px; border: 2px solid #e2e8f0;
  font-size: 14px; outline: none; background: #fff; cursor: pointer;
}
.sort-select select:focus { border-color: #f97316; }

/* ========== PRODUCT DETAIL ========== */
.product-detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px;
  margin-top: 24px; background: #fff; border-radius: 20px;
  padding: 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.detail-img { width: 100%; border-radius: 16px; object-fit: cover; aspect-ratio: 4/3; }
.detail-name { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.detail-desc { font-size: 15px; color: #64748b; margin-bottom: 16px; }
.detail-price { font-size: 32px; font-weight: 800; color: #f97316; margin-bottom: 8px; }
.detail-old-price { font-size: 18px; color: #94a3b8; text-decoration: line-through; margin-left: 12px; }
.detail-rating { font-size: 16px; color: #f59e0b; margin-bottom: 20px; }
.detail-stock { font-size: 14px; color: #22c55e; font-weight: 600; margin-bottom: 24px; }

/* ========== CART SIDEBAR ========== */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }
.cart-sidebar {
  position: fixed; top: 0; right: -420px; width: 400px; height: 100vh;
  background: #fff; z-index: 210; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.15); transition: right 0.3s ease;
}
.cart-sidebar.open { right: 0; }
.cart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid #e2e8f0;
}
.cart-header h3 { font-size: 18px; }
.close-cart { font-size: 24px; background: none; color: #64748b; padding: 4px 8px; border-radius: 8px; }
.close-cart:hover { background: #f1f5f9; }
.cart-items { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-empty { text-align: center; color: #94a3b8; padding: 40px 0; }
.cart-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid #f1f5f9; align-items: center;
}
.cart-item-img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #f1f5f9; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-price { font-size: 15px; font-weight: 700; color: #f97316; }
.cart-item-qty {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.qty-btn {
  width: 28px; height: 28px; border-radius: 8px;
  background: #f1f5f9; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: #e2e8f0; }
.cart-item-remove {
  color: #ef4444; background: none; font-size: 18px; padding: 4px;
}
.cart-footer { padding: 20px 24px; border-top: 1px solid #e2e8f0; }
.cart-total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.total-price { color: #f97316; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 20px; padding: 40px;
  max-width: 440px; width: 90%; position: relative;
  transform: scale(0.9); transition: transform 0.3s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; font-size: 22px; color: #94a3b8;
}
.modal-close:hover { color: #1a1a2e; }
.modal h2 { font-size: 24px; font-weight: 800; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 12px 16px; border: 2px solid #e2e8f0;
  border-radius: 10px; font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: #f97316; }
.form-error { color: #ef4444; font-size: 14px; margin-bottom: 12px; display: none; }
.form-success { color: #22c55e; font-size: 14px; margin-bottom: 12px; display: none; }
.modal-switch { text-align: center; margin-top: 16px; font-size: 14px; color: #64748b; }
.modal-switch a { color: #f97316; font-weight: 600; }

/* ========== FOOTER ========== */
.footer {
  background: #1a1a2e; color: #94a3b8; padding-top: 60px; margin-top: 40px;
}
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px 40px;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px;
}
.footer-col h4 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.footer-col p { font-size: 14px; margin-bottom: 6px; }
.footer-col a { display: block; font-size: 14px; padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: #f97316; }
.footer-bottom {
  text-align: center; padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1a1a2e; color: #fff; padding: 14px 24px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY(80px); opacity: 0; transition: all 0.3s;
  z-index: 999;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .search-box { display: none; }
  .header-actions { display: none; }
  .mobile-menu-btn { display: block; margin-left: auto; }
  .features { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  .hero { padding: 60px 20px 50px; }
  .cart-sidebar { width: 100%; right: -100%; }
  .hero h1 { font-size: 28px; }
}

/* ========== ANIMATIONS ========== */
.product-card { animation: fadeInUp 0.4s ease backwards; }
.product-card:nth-child(1) { animation-delay: 0.0s; }
.product-card:nth-child(2) { animation-delay: 0.05s; }
.product-card:nth-child(3) { animation-delay: 0.1s; }
.product-card:nth-child(4) { animation-delay: 0.15s; }
.product-card:nth-child(5) { animation-delay: 0.2s; }
.product-card:nth-child(6) { animation-delay: 0.25s; }
.product-card:nth-child(7) { animation-delay: 0.3s; }
.product-card:nth-child(8) { animation-delay: 0.35s; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== DARK MODE ========== */
body.dark {
  background: #0f172a;
  color: #e2e8f0;
}
body.dark .header {
  background: rgba(15,23,42,0.95);
  border-bottom-color: #1e293b;
}
body.dark .logo-text { color: #e2e8f0; }
body.dark .search-box { border-color: #334155; background: #1e293b; }
body.dark .search-box input { color: #e2e8f0; background: transparent; }
body.dark .search-box input::placeholder { color: #64748b; }
body.dark .search-box:focus-within { border-color: #f97316; }
body.dark .search-btn { background: #f97316; }
body.dark .cart-btn:hover { background: #1e293b; }
body.dark .theme-toggle { background: #1e293b; border-color: #334155; }
body.dark .theme-toggle:hover { border-color: #f97316; }
body.dark .btn-outline { color: #94a3b8; border-color: #334155; }
body.dark .btn-outline:hover { border-color: #f97316; color: #f97316; }
body.dark .user-greeting { color: #e2e8f0; }
body.dark .feature-card {
  background: #1e293b; border: 1px solid #334155;
}
body.dark .feature-card h3 { color: #e2e8f0; }
body.dark .feature-card p { color: #94a3b8; }
body.dark .category-card {
  background: #1e293b; border: 1px solid #334155;
}
body.dark .category-card:hover { border-color: #f97316; }
body.dark .category-card h3 { color: #e2e8f0; }
body.dark .category-card p { color: #94a3b8; }
body.dark .product-card {
  background: #1e293b;
  border: 1.5px solid #475569;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
body.dark .product-card:hover {
  box-shadow: 0 8px 28px rgba(249,115,22,0.2);
  border-color: #f97316;
}
body.dark .product-name { color: #f1f5f9; }
body.dark .product-desc { color: #94a3b8; }
body.dark .product-reviews { color: #64748b; }
body.dark .product-price { color: #fb923c; }
body.dark .product-old-price { color: #64748b; }
body.dark .badge-sale { background: #450a0a; color: #fca5a5; }
body.dark .badge-new { background: #052e16; color: #86efac; }
body.dark .chip {
  background: #1e293b; border-color: #334155; color: #94a3b8;
}
body.dark .chip:hover { border-color: #f97316; color: #f97316; }
body.dark .chip.active { background: #f97316; color: #fff; border-color: #f97316; }
body.dark .sort-select select {
  background: #1e293b; border-color: #334155; color: #e2e8f0;
}
body.dark .product-detail {
  background: #1e293b; border: 1px solid #334155;
}
body.dark .detail-name { color: #f1f5f9; }
body.dark .detail-desc { color: #94a3b8; }
body.dark .detail-old-price { color: #64748b; }
body.dark .cart-sidebar { background: #1e293b; }
body.dark .cart-header { border-bottom-color: #334155; }
body.dark .cart-header h3 { color: #e2e8f0; }
body.dark .close-cart { color: #94a3b8; }
body.dark .close-cart:hover { background: #334155; }
body.dark .cart-item { border-bottom-color: #334155; }
body.dark .cart-item-name { color: #e2e8f0; }
body.dark .cart-item-price { color: #fb923c; }
body.dark .qty-btn { background: #334155; color: #e2e8f0; }
body.dark .qty-btn:hover { background: #475569; }
body.dark .cart-footer { border-top-color: #334155; }
body.dark .total-price { color: #fb923c; }
body.dark .modal { background: #1e293b; }
body.dark .modal h2 { color: #f1f5f9; }
body.dark .modal-close { color: #64748b; }
body.dark .modal-close:hover { color: #e2e8f0; }
body.dark .form-group label { color: #cbd5e1; }
body.dark .form-group input {
  background: #0f172a; border-color: #334155; color: #e2e8f0;
}
body.dark .form-group input::placeholder { color: #475569; }
body.dark .form-group input:focus { border-color: #f97316; }
body.dark .modal-switch { color: #64748b; }
body.dark .modal-switch a { color: #fb923c; }
body.dark .footer { background: #020617; }
body.dark .footer-col h4 { color: #e2e8f0; }
body.dark .footer-col p { color: #64748b; }
body.dark .footer-col a { color: #64748b; }
body.dark .footer-col a:hover { color: #f97316; }
body.dark .footer-bottom { border-top-color: rgba(255,255,255,0.05); }
body.dark .footer-bottom p { color: #475569; }
body.dark .product-img { background: #334155; }

/* product cards always have visible border even in light mode */
.product-card {
  border: 1.5px solid #d1d5db;
}
.product-card:hover {
  border-color: #f97316;
}