/* GadgetsXpress — Apple-inspired dark theme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #000;
  --surface:   rgba(255,255,255,0.06);
  --surf-h:    rgba(255,255,255,0.1);
  --border:    rgba(255,255,255,0.1);
  --border-h:  rgba(255,255,255,0.2);
  --text:      #f5f5f7;
  --text-2:    rgba(245,245,247,0.55);
  --accent:    #0071e3;
  --accent-h:  #0077ed;
  --danger:    #ff453a;
  --success:   #30d158;
  --warning:   #ffd60a;
  --r:         12px;
  --r-lg:      20px;
  --blur:      saturate(180%) blur(20px);
}

html, body { overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── HEADER ── */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(0,0,0,0.8);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 32px;
}
.logo { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.logo span { color: #0071e3; }
nav { flex: 1; display: flex; gap: 8px; }
nav a {
  padding: 6px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
nav a:hover, nav a.active { color: var(--text); background: var(--surface); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ── MOBILE NAV ── */
.nav-toggle {
  display: none; /* hidden on desktop */
  flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 6px; width: 36px; height: 36px;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px;
  transition: all 0.25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none; /* shown only when .open on mobile */
  flex-direction: column;
  background: rgba(0,0,0,0.95);
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
.mobile-nav.open { display: flex; }
.mobile-nav-link {
  display: block; padding: 14px 24px;
  color: var(--text-2); font-size: 15px; font-weight: 500;
  text-decoration: none; border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
.mobile-nav-link:last-child { border-bottom: none; }
.mobile-nav-link:hover { color: var(--text); text-decoration: none; }
.mobile-nav-link.active { color: var(--text); }
.mobile-nav-btn {
  width: 100%; text-align: left; background: none; border: none;
  cursor: pointer; font-family: inherit;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--r);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surf-h); }
.btn-danger  { background: rgba(255,69,58,0.15); color: var(--danger); border: 1px solid rgba(255,69,58,0.3); }
.btn-danger:hover { background: rgba(255,69,58,0.25); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: inherit; font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-2); }

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  backdrop-filter: var(--blur);
}

/* ── PRODUCT GRID ── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.prod-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.prod-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.prod-card-img {
  aspect-ratio: 4/3; overflow: hidden;
  background: rgba(255,255,255,0.03); position: relative;
}
.prod-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.prod-card:hover .prod-card-img img { transform: scale(1.05); }
.prod-card-body { padding: 16px; }
.prod-card-cat  { font-size: 11px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.prod-card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.prod-card-price { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.prod-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.stock-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 100px;
}
.stock-in  { background: rgba(48,209,88,0.15);  color: var(--success); }
.stock-low { background: rgba(255,214,10,0.15);  color: var(--warning); }
.stock-out { background: rgba(255,69,58,0.15);   color: var(--danger);  }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 28px; padding: 4px 0;
}
.filter-btn {
  padding: 7px 16px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-h); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── SECTION ── */
.section { padding: 48px 24px; max-width: 1280px; margin: 0 auto; }
.section-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; margin-bottom: 8px; }
.section-sub   { color: var(--text-2); font-size: 15px; margin-bottom: 32px; }

/* ── HERO ── */
.hero {
  display: flex; align-items: center;
  padding: 80px 24px 48px; text-align: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,113,227,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 50%, rgba(100,60,255,0.08) 0%, transparent 60%);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 100%, rgba(0,113,227,0.06) 0%, transparent 60%);
}
.hero-inner { max-width: 760px; margin: 0 auto; position: relative; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 100px;
  border: 1px solid rgba(0,113,227,0.35);
  background: rgba(0,113,227,0.1);
  color: #60aaff; font-size: 13px; font-weight: 600;
  letter-spacing: 0.2px; margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 800; letter-spacing: -2px;
  line-height: 1.08; margin-bottom: 20px;
}
.hero-gradient {
  background: linear-gradient(135deg, #0071e3 0%, #40c8ff 50%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.15rem; color: var(--text-2);
  line-height: 1.7; margin-bottom: 36px;
}
.hero-br { display: none; }

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 52px; }
.hero-cta { padding: 13px 28px; font-size: 15px; border-radius: 100px; }
.btn-primary.hero-cta  { box-shadow: 0 0 28px rgba(0,113,227,0.35); }

.hero-stats {
  display: flex; align-items: center; justify-content: center;
  gap: 0; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 16px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: var(--blur); overflow: hidden;
}
.hero-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 28px; gap: 3px;
}
.hero-stat-val { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.hero-stat-lbl { font-size: 12px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.hero-stat-div { width: 1px; height: 40px; background: var(--border); flex-shrink: 0; }

@media (max-width: 600px) {
  .hero { padding: 72px 20px 60px; }
  .hero h1 { letter-spacing: -1px; }
  .hero-br { display: inline; }
  .hero-stat-div { display: none; }
  .hero-stats { border-radius: 12px; }
  .hero-stat { padding: 14px 18px; flex: 1 1 40%; }
  .hero-stat:nth-child(1), .hero-stat:nth-child(3) { border-right: 1px solid var(--border); }
  .hero-stat:nth-child(1), .hero-stat:nth-child(2) { border-bottom: 1px solid var(--border); }
}

/* ── CART / CHECKOUT ── */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.cart-item {
  display: flex; gap: 16px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.cart-item-img { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-title { font-weight: 600; margin-bottom: 4px; }
.cart-item-price { color: var(--text-2); font-size: 14px; }
.qty-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.qty-btn { width: 28px; height: 28px; border-radius: 50%; background: var(--surf-h); border: none; color: var(--text); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.order-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; }
.summary-total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }

/* ── AUTH PAGES ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 40px; }
.auth-logo { text-align: center; font-size: 1.3rem; font-weight: 700; margin-bottom: 28px; }
.auth-logo span { color: var(--accent); }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.auth-sub   { color: var(--text-2); font-size: 14px; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-2); }
.alert { padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(255,69,58,0.15); border: 1px solid rgba(255,69,58,0.3); color: var(--danger); }
.alert-success { background: rgba(48,209,88,0.15); border: 1px solid rgba(48,209,88,0.3); color: var(--success); }

/* ── ORDERS ── */
.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.order-id { font-size: 13px; color: var(--text-2); font-family: monospace; }
.status-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.status-Pending    { background: rgba(255,214,10,0.15);  color: var(--warning); }
.status-Processing { background: rgba(0,113,227,0.15);   color: var(--accent); }
.status-Shipped    { background: rgba(48,209,88,0.15);   color: var(--success); }
.status-Delivered  { background: rgba(48,209,88,0.25);   color: var(--success); }
.status-Cancelled  { background: rgba(255,69,58,0.15);   color: var(--danger); }

/* ── PROFILE ── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px; text-align: center;
  color: var(--text-2); font-size: 13px; margin-top: 80px;
}

/* ── CART ICON BUTTON ── */
.cart-icon-btn {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.cart-icon-btn:hover { background: var(--surf-h); }
.cart-badge {
  position: absolute; top: -7px; right: -7px;
  min-width: 18px; height: 18px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 100px;
  align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid var(--bg);
}

/* ── CART DRAWER OVERLAY ── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.3s; backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

/* ── CART DRAWER ── */
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  background: #111; border-left: 1px solid var(--border);
  z-index: 201; display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -12px 0 48px rgba(0,0,0,0.6);
}
.cart-drawer.open { transform: translateX(0); }
body.cart-open { overflow: hidden; }

.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  font-size: 1rem; font-weight: 700; flex-shrink: 0;
}
.drawer-close {
  background: none; border: none; color: var(--text-2);
  font-size: 18px; cursor: pointer; padding: 6px 8px;
  border-radius: 8px; line-height: 1; transition: all 0.2s;
}
.drawer-close:hover { color: var(--text); background: var(--surface); }

.drawer-shipping {
  padding: 12px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.shipping-text { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.shipping-bar {
  height: 3px; background: rgba(255,255,255,0.08);
  border-radius: 100px; overflow: hidden;
}
.shipping-progress {
  height: 100%; border-radius: 100px; background: var(--accent);
  transition: width 0.5s ease, background 0.3s;
}

.drawer-items { flex: 1; overflow-y: auto; padding: 4px 0; }
.drawer-items::-webkit-scrollbar { width: 4px; }
.drawer-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.drawer-empty {
  text-align: center; padding: 60px 24px;
  color: var(--text-2); font-size: 14px;
}
.drawer-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.drawer-item:hover { background: var(--surface); }
.drawer-item-img {
  width: 72px; height: 72px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  background: var(--surface);
}
.drawer-item-img img { width: 100%; height: 100%; object-fit: cover; }
.drawer-item-info { flex: 1; min-width: 0; }
.drawer-item-title {
  font-size: 13px; font-weight: 600; margin-bottom: 4px;
  line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drawer-item-price { font-size: 14px; color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.drawer-item-qty { display: flex; align-items: center; gap: 10px; }
.drawer-item-qty .qty-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; line-height: 1;
}
.drawer-item-qty .qty-btn:hover { background: var(--border-h); }
.drawer-item-qty .qty-count { font-size: 14px; font-weight: 600; min-width: 22px; text-align: center; }
.drawer-item-remove {
  background: none; border: none; color: rgba(255,255,255,0.25);
  font-size: 15px; cursor: pointer; padding: 4px; border-radius: 6px;
  transition: color 0.2s; flex-shrink: 0; line-height: 1; align-self: center;
}
.drawer-item-remove:hover { color: var(--danger); }

.drawer-footer {
  padding: 20px 24px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.4); flex-shrink: 0;
}
.drawer-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px; font-size: 14px; color: var(--text-2);
}
.drawer-total strong { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.btn-success { background: #30d158; color: #000; }
.btn-success:hover { background: #34e45e; filter: brightness(1.05); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .cart-layout { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .hero { padding: 60px 20px; min-height: auto; }
  .section { padding: 40px 16px; }
}

/* Tablet: 2-col product grid */
@media (max-width: 640px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* Mobile: switch to hamburger, hide desktop nav + action buttons */
@media (max-width: 600px) {
  nav { display: none; }                      /* hide desktop nav links */
  .header-profile-btn { display: none; }      /* hide long email address */
  .header-register-btn { display: none; }     /* register is in mobile nav */
  .nav-toggle { display: flex; }              /* show hamburger */
  .header-inner { gap: 8px; }

  /* Touch-friendly filter bar */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .filter-btn { flex-shrink: 0; }
}

/* Small phones: 1-col product grid */
@media (max-width: 400px) {
  .products-grid { grid-template-columns: 1fr; }
  .hero h1 { letter-spacing: -0.5px; }
}
