/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #121212;
  --fg: #fafafa;
  --card-bg: #1a1a1a;
  --border: #333;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --muted: #999;
  --destructive: #ef4444;
  --shadow: rgba(0, 0, 0, 0.5);
  --glow: rgba(59, 130, 246, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  gap: 2rem;
}

.brand {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  text-shadow: 0 0 20px var(--glow);
}

.nav-links {
  display: none;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* nav actions layout */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

/* SEARCH BAR (refined version) */
.search-wrap {
  position: relative;
  min-width: 190px;
  max-width: 240px;
  display: none;
}

.mobile-search-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.mobile-search-wrap .search-inner {
  display: flex;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  align-items: center;
  gap: 0.5rem;
}

.search-icon {
  font-size: 0.9rem;
  opacity: 0.8;
}

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 0.9rem;
  line-height: 1.2;
}

.search-submit {
  background: var(--primary);
  color: #041025;
  border: 0;
  border-radius: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 20px var(--glow);
}

.search-submit:active {
  transform: scale(0.97);
}

/* hide mobile-search-wrap on desktop, because desktop already has search in the header */
@media (min-width: 768px) {
  .mobile-search-wrap {
    display: none;
  }
}

/* show header search on desktop only */
@media (min-width: 768px) {
  .search-wrap {
    display: block;
    position: relative;
  }
}

.search-inner {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.5); /* subtle glass */
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.5rem 0.6rem;
  gap: 0.5rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  min-height: 40px;
  transition: all .18s ease;
}

.search-inner:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--glow), 0 30px 60px rgba(0,0,0,0.8);
}

.search-icon {
  font-size: .85rem;
  line-height: 1;
  opacity: .7;
  color: var(--muted);
}

.search-input {
  background: transparent;
  border: 0;
  outline: 0;
  font-size: .8rem;
  line-height: 1.2;
  color: var(--fg);
  flex: 1;
  min-width: 0;
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--muted);
  opacity: .6;
}

.search-submit {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: .5rem;
  font-size: .7rem;
  line-height: 1;
  font-weight: 500;
  padding: .4rem .5rem;
  color: var(--fg);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.search-submit:hover {
  background: rgba(255,255,255,0.12);
}

/* SEARCH DROPDOWN (soft aesthetic) */
.search-dropdown {
  position: absolute;
  top: calc(100% + .5rem);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  padding: .5rem 0 .5rem;
  overflow: hidden;
  z-index: 9999;
  animation: fadeIn .15s ease both;
  min-width: 200px;
}

#searchResults {
  max-height: 240px;
  overflow-y: auto;
}

/* each product row in dropdown */
.search-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: all .12s ease;
  border-left: 0;
  border-radius: .5rem;
  margin: .25rem .5rem;
}

.search-item:hover {
  background: rgba(255,255,255,0.03);
  box-shadow: 0 0 0 1px var(--border);
}

/* thumbnail */
.search-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: .5rem;
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(0,0,0,.5);
}
.search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* meta text */
.search-meta {
  min-width: 0;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
}
.search-name {
  color: var(--fg);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-extra {
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* price stack on right */
.search-price {
  color: var(--fg);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: right;
  min-width: 3rem;
}

.search-footer {
  border-top: 1px solid var(--border);
  padding: .6rem .9rem .5rem;
  text-align: center;
  font-size: .7rem;
  line-height: 1.2;
  color: var(--muted);
}

/* "no results" block */
.search-empty {
  padding: 1rem;
  text-align: center;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--muted);
  margin: .25rem .5rem .5rem;
  border-radius: .5rem;
  background: rgba(255,255,255,0.02);
  box-shadow: 0 0 0 1px var(--border);
}
.search-empty-query {
  color: var(--fg);
  font-weight: 500;
}

/* NAV ICON BUTTONS */
.icon-btn,
.hamburger {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
  position: relative;
}

.icon-btn:hover,
.hamburger:hover {
  background: var(--card-bg);
}

.badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--primary);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* MOBILE NAV */
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.mobile-nav.active,
.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
}

.mobile-nav a:hover {
  background: var(--card-bg);
}

/* Hero */
.hero {
  position: relative;
  padding: 5rem 1rem;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(168, 85, 247, 0.05));
  opacity: 0.3;
}

.hero-card {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 3rem;
  align-items: center;
}

.hero-left h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 20px var(--glow);
}

.hero-left p {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 500px;
  margin-bottom: 2rem;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-weight: 600;
  border-radius: 0.75rem;
  cursor: pointer;
  border: none;
  font-size: 1rem;
  transition: all 0.3s;
}

.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 30px var(--glow);
}

.btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px var(--glow);
}

.btn.ghost {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--fg);
}

.btn.ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn.full-width {
  width: 100%;
}

.hero-right {
  position: relative;
}

.showcase {
  position: relative;
  background: linear-gradient(180deg, #1f1f1f, #141414);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 10px 40px var(--shadow);
  transition: transform 0.5s;
}

.showcase:hover {
  transform: scale(1.02);
}

.showcase img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 0.75rem;
}

.ribbon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--glow);
}

/* Sections */
.section {
  margin: 5rem 0;
}

.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 900;
  margin-bottom: 0.75rem;
}

.muted {
  color: var(--muted);
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
}

.filters select {
  padding: 0.5rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--fg);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag:hover,
.tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Product Grids */
.top-grid,
.offers-row,
.product-grid {
  display: grid;
  gap: 1.5rem;
}

.top-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.offers-row {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Product Card */
.product-card {
  background: linear-gradient(180deg, #1f1f1f, #141414);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow);
  transition: all 0.3s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 30px var(--glow);
}

.product-img {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #222;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.product-card:hover .product-img img {
  transform: scale(1.1);
}

.product-badge {
  position: absolute;
  top: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: white;
}

.badge-discount {
  right: 0.75rem;
  background: var(--destructive);
}

.badge-new {
  left: 0.75rem;
  background: var(--primary);
}

.badge-low {
  left: 0.75rem;
  top: auto;
  bottom: 0.75rem;
  background: var(--destructive);
}

/* quick add button over image */
.quick-add {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: all .2s;
  box-shadow: 0 15px 30px rgba(0,0,0,0.6);
}

.product-card:hover .quick-add {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.product-content {
  padding: 1rem;
}

.product-content h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.product-desc {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.product-tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--card-bg);
  border-radius: 0.375rem;
  border: 1px solid var(--border);
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.product-price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.price-current {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.price-old {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: line-through;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  flex: 1;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: linear-gradient(180deg, #1f1f1f, #141414);
  border-radius: 1rem;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px var(--shadow);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--card-bg);
  border: none;
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: var(--border);
}

.modal-grid {
  display: grid;
  gap: 2rem;
}

.modal-img {
  aspect-ratio: 1;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #222;
}

.modal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-details h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.modal-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.modal-price {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.modal-price-current {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.modal-price-old {
  font-size: 1.25rem;
  color: var(--muted);
  text-decoration: line-through;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Cart Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  background: var(--bg);
  box-shadow: -10px 0 40px var(--shadow);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: right 0.3s;
}

.cart-sidebar.active {
  right: 0;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cart-header h2 {
  font-size: 1.5rem;
}

.cart-close {
  background: var(--card-bg);
  border: none;
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  font-size: 1.25rem;
  cursor: pointer;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.cart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.cart-item-img {
  width: 80px;
  height: 80px;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-details {
  flex: 1;
}

.cart-item-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cart-item-price {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.cart-qty button {
  background: none;
  border: none;
  color: var(--fg);
  width: 1.5rem;
  height: 1.5rem;
  cursor: pointer;
  font-size: 1rem;
}

.cart-qty span {
  min-width: 2rem;
  text-align: center;
  font-weight: 600;
}

.cart-remove {
  background: none;
  border: none;
  color: var(--destructive);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
}

.cart-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.cart-total span:last-child {
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  background: var(--card-bg);
  color: var(--fg);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px var(--shadow);
  z-index: 2000;
  transition: transform 0.3s;
  border: 1px solid var(--border);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
  margin-top: 5rem;
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }

  .hamburger {
    display: none;
  }

  .hero-card {
    grid-template-columns: 1fr 1fr;
  }

  .modal-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}
