/* ============================
   RESET & BASE
   ============================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --border: #2a2a2a;
  --accent: #f0f0f0;
  --accent-muted: #888;
  --highlight: #ffffff;
  --danger: #e55;
  --success: #4caf50;
  --radius: 10px;
  --transition: 0.2s ease;
  --font: 'Segoe UI', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

/* ============================
   HEADER
   ============================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--highlight);
}

.nav { display: flex; gap: 28px; }

.nav__link {
  font-size: 0.875rem;
  color: var(--accent-muted);
  transition: color var(--transition);
}
.nav__link:hover { color: var(--highlight); }

.cart-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  transition: border-color var(--transition), color var(--transition);
}
.cart-btn:hover { border-color: var(--accent); color: var(--highlight); }

/* ============================
   USER MENU
   ============================ */
.header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu { position: relative; }

.user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: border-color var(--transition);
}
.user-menu__trigger:hover { border-color: var(--accent); color: var(--highlight); }

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--highlight);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}

.user-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  overflow: hidden;
  display: none;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.user-menu__dropdown.open { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-size: 0.875rem;
  color: var(--accent-muted);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
  text-decoration: none;
}
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--highlight); }

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--highlight);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  display: none;
}
.cart-count.visible { display: flex; }

/* ============================
   HERO
   ============================ */
.hero {
  padding: 80px 0 70px;
  border-bottom: 1px solid var(--border);
}

.hero__inner { max-width: 620px; }

.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.hero__tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--accent-muted);
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--highlight);
  margin-bottom: 20px;
}
.hero__title span { color: var(--accent-muted); }

.hero__sub {
  font-size: 1.1rem;
  color: var(--accent-muted);
  margin-bottom: 36px;
}

/* ============================
   BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition);
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--highlight); color: var(--bg); }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--accent); }
.btn--full { width: 100%; }

/* ============================
   SHOP
   ============================ */
.shop { padding: 60px 0 80px; }

.shop__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 36px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--highlight);
}

.shop__controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  width: 240px;
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--accent-muted); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent-muted);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--highlight);
  border-color: var(--highlight);
  color: var(--bg);
}

/* ============================
   PRODUCTS GRID
   ============================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.loader {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--accent-muted);
  padding: 60px 0;
  font-size: 0.9rem;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--accent-muted);
  padding: 60px 0;
}

/* ============================
   PRODUCT CARD
   ============================ */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), transform var(--transition);
}
.product-card:hover {
  border-color: #444;
  transform: translateY(-3px);
}

.product-card__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #1a1a1a;
}

.product-card__body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card__category {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-muted);
}

.product-card__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--highlight);
}

.product-card__desc {
  font-size: 0.8rem;
  color: var(--accent-muted);
  flex: 1;
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.product-card__price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--highlight);
}

.product-card__stock {
  font-size: 0.7rem;
  color: var(--accent-muted);
}
.product-card__stock.low { color: #f0a050; }

.add-to-cart-btn {
  background: var(--highlight);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}
.add-to-cart-btn:hover { opacity: 0.85; }

/* ============================
   CART DRAWER
   ============================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.overlay.active { opacity: 1; pointer-events: all; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.cart-drawer__header h3 { font-size: 1.1rem; font-weight: 700; color: var(--highlight); }

.close-btn {
  background: none;
  border: none;
  color: var(--accent-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color var(--transition);
}
.close-btn:hover { color: var(--highlight); }

.cart-drawer__items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-empty { color: var(--accent-muted); font-size: 0.9rem; text-align: center; margin-top: 40px; }

.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cart-item__img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  background: #1a1a1a;
  flex-shrink: 0;
}

.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { font-size: 0.875rem; font-weight: 600; color: var(--highlight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item__price { font-size: 0.8rem; color: var(--accent-muted); margin-top: 2px; }

.cart-item__controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.qty-btn {
  background: var(--border);
  border: none;
  color: var(--accent);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.qty-btn:hover { background: #333; }

.qty-value { font-size: 0.875rem; font-weight: 600; min-width: 20px; text-align: center; }

.remove-btn {
  background: none;
  border: none;
  color: var(--accent-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
  transition: color var(--transition);
}
.remove-btn:hover { color: var(--danger); }

.cart-drawer__footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--accent-muted);
}
.cart-total strong { color: var(--highlight); font-size: 1.1rem; }

/* ============================
   TOAST
   ============================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 500;
  transition: transform 0.3s ease, opacity 0.3s;
  opacity: 0;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================
   RESPONSIVE
   ============================ */
/* ============================
   CHECKOUT MODAL
   ============================ */
.checkout-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.checkout-overlay.open { opacity: 1; pointer-events: all; }

.checkout-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.96);
  transition: transform 0.2s;
}
.checkout-overlay.open .checkout-modal { transform: scale(1); }

.checkout-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.checkout-modal__header h3 { font-size: 1rem; font-weight: 700; }

.checkout-modal__items { padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; }

.checkout-item {
  display: flex; align-items: center; gap: 12px;
}
.checkout-item__img {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 6px; background: #1a1a1a; flex-shrink: 0;
}
.checkout-item__name { font-size: 0.875rem; font-weight: 600; flex: 1; }
.checkout-item__price { font-size: 0.875rem; font-weight: 700; color: var(--highlight); }

.checkout-modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}

.checkout-info {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
  font-size: 0.8rem; color: var(--accent-muted);
}
.checkout-info svg { flex-shrink: 0; margin-top: 2px; }

.checkout-total {
  display: flex; justify-content: space-between;
  font-size: 0.9rem; color: var(--accent-muted);
}
.checkout-total strong { font-size: 1.1rem; color: var(--highlight); }

@media (max-width: 640px) {
  .shop__header { flex-direction: column; }
  .shop__controls { align-items: flex-start; width: 100%; }
  .search-input { width: 100%; }
  .hero__title { font-size: 2.5rem; }
  .nav { display: none; }
  .header__right { gap: 6px; }
  #loginBtn { display: none; }
}
