:root {
  --primary: #0f172a;
  --accent: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --accent-solid: #2563eb;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: #e5e7eb;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --header-h: 80px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Inter", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  min-width: 320px;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
}
button, input, select { font: inherit; }
button {
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}
button:disabled { opacity: 0.6; cursor: not-allowed; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.success-text { color: var(--success); }

#alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
}
.alert {
  min-width: 320px;
  margin-bottom: 10px;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-hover);
  animation: slideIn 0.3s ease-out;
}
.alert-error { background-color: var(--danger); }
.alert-success { background-color: var(--success); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
.logo {
  background: transparent;
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -1.5px;
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
}
.nav-link:hover,
.nav-link.active { color: var(--accent-solid); }
.nav-link svg { width: 18px; height: 18px; }
.cart-trigger { position: relative; }
.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent-solid);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
}
.profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border);
  color: var(--primary);
  font-weight: 800;
}
.btn-logout {
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.auth-wrapper {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 40px 30px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
}
.brand-header {
  margin-bottom: 30px;
  text-align: center;
}
.logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -1.5px;
}
.logo-row svg { color: #2563eb; }
.tagline {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.auth-card h2 {
  margin-bottom: 25px;
  color: var(--text-main);
  font-size: 26px;
  font-weight: 700;
}
.form-group { margin-bottom: 20px; }
.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-main);
}
.label-row svg { width: 16px; height: 16px; color: var(--text-muted); }
.label-row label { font-size: 0.9rem; font-weight: 600; }
.input-wrapper { position: relative; }
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s;
}
.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--text-muted);
}
.toggle-password svg { width: 18px; height: 18px; }
.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  font-size: 1rem;
  font-weight: 700;
}
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}
.auth-toggle {
  margin-top: 20px;
  text-align: center;
}
.auth-toggle a {
  color: var(--accent-solid);
  font-weight: 700;
  text-decoration: none;
}
.text-action {
  justify-self: start;
  margin: -6px 0 4px;
  padding: 0;
  background: transparent;
  color: var(--accent-solid);
  font-weight: 800;
  font-size: 0.9rem;
}
.password-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
  line-height: 1.4;
}
.resend-otp-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent-solid);
  font-weight: 800;
}
.resend-otp-btn:disabled {
  cursor: not-allowed;
  color: var(--text-muted);
  background: var(--bg-soft);
}
.error-hint { display: none; color: var(--danger); }
.strength-meter {
  display: none;
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--border);
}
.strength-meter-bar {
  width: 0;
  height: 100%;
  transition: var(--transition);
}
.strength-weak { width: 33.33%; background: var(--danger); }
.strength-medium { width: 66.66%; background: var(--warning); }
.strength-strong { width: 100%; background: var(--success); }

.hero {
  position: relative;
  margin-top: 2rem;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  color: white;
  padding: 4rem;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}
.hero-content > span {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.hero h1 {
  margin: 1rem 0;
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.hero p {
  margin-bottom: 2rem;
  font-size: 1.1rem;
  opacity: 0.9;
}
.btn-hero {
  padding: 1rem 2rem;
  border-radius: 12px;
  background: white;
  color: var(--accent-solid);
  font-size: 1rem;
  font-weight: 800;
}
.hero-img-blob {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: blur(40px);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 3rem 0 2rem;
}
.section-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.filter-bar {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
  padding: 0.8rem;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow);
}
.filter-bar svg { color: var(--text-muted); }
.search-input {
  flex-grow: 1;
  min-width: 140px;
  border: none;
  outline: none;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}
.sort-select {
  border: none;
  outline: none;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem;
}
.product-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid transparent;
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.product-card:hover {
  transform: translateY(-8px);
  border-color: var(--border);
  box-shadow: var(--shadow-hover);
}
.product-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  background: #f1f5f9;
  color: #2563eb;
  font-size: 4rem;
}
.product-img::after {
  position: absolute;
  top: 15px;
  right: 15px;
  content: "PRO";
  padding: 4px 10px;
  border-radius: 8px;
  background: white;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.product-info {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  padding: 1.5rem;
}
.product-name {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}
.product-desc {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}
.product-price {
  margin-bottom: 1rem;
  color: var(--accent-solid);
  font-size: 1.4rem;
  font-weight: 800;
}
.btn-add-cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  padding: 0.8rem;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}
.btn-add-cart:hover { background: var(--accent-solid); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}
.overlay.active {
  opacity: 1;
  pointer-events: all;
}
#auth-overlay { z-index: 2400; }
.sidebar {
  position: fixed;
  top: 0;
  right: -450px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 450px;
  height: 100vh;
  padding: 2rem;
  background: white;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}
.sidebar.active { right: 0; }
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.sidebar-header h2 { font-weight: 800; }
.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
}
.icon-button:hover { background: #f1f5f9; }
.sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.cart-item-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #2563eb;
}
.cart-item-details { flex-grow: 1; min-width: 0; }
.cart-item-name {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-item-price {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.cart-qty-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--border);
  font-weight: 800;
}
.cart-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.cart-total-row.total {
  margin-top: 10px;
  font-size: 1.4rem;
  font-weight: 800;
}
.btn-checkout {
  width: 100%;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
}

.order-card {
  margin-bottom: 2rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
}
.order-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.order-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.status-badge {
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-delivered { background: #dcfce7; color: #166534; }
.order-item-mini {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.loader,
.empty-state {
  padding: 3rem;
  color: var(--text-muted);
  text-align: center;
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  height: 400px;
  border-radius: 20px;
}
.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .nav-links {
    gap: 0.8rem;
    overflow-x: auto;
  }
  .nav-link { font-size: 0.9rem; }
  .btn-logout { padding: 0.55rem 0.8rem; }
  .hero { padding: 2.4rem 1.5rem; }
  .hero h1 { font-size: 2.2rem; }
  .section-title { font-size: 1.85rem; }
  .filter-bar { max-width: none; }
  .product-grid { gap: 1.3rem; }
  .sidebar { max-width: 100%; }
  .order-meta { flex-direction: column; }
}

@media (max-width: 540px) {
  header { height: auto; }
  .nav-inner {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 14px 0;
  }
  .nav-links {
    justify-content: space-between;
    gap: 0.45rem;
  }
  .nav-link svg { display: none; }
  .profile-btn { display: none; }
  .btn-logout { font-size: 0.85rem; }
  .filter-bar { flex-direction: column; }
  .sort-select { padding: 0.5rem 1rem; }
  #alert-container {
    left: 12px;
    right: 12px;
  }
  .alert { min-width: 0; }
}
