*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --text: #0f172a;
  --muted: #64748b;
  --bg: #f6f7fb;
  --card-border: #eef2ff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

a {
  color: #4f46e5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Animated background layer (subtle gradient motion) */
body::before {
  content: "";
  position: fixed;
  inset: -40%;
  z-index: -1;
  background:
    radial-gradient(800px circle at 15% 20%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(700px circle at 85% 25%, rgba(79, 70, 229, 0.18), transparent 50%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(99, 102, 241, 0.10), rgba(236, 72, 153, 0.06));
  animation: ecom-bg-shift 14s ease-in-out infinite;
}

/* Subtle sheen/noise */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(115deg,
      rgba(255, 255, 255, 0.00) 0px,
      rgba(255, 255, 255, 0.00) 12px,
      rgba(255, 255, 255, 0.04) 13px,
      rgba(255, 255, 255, 0.00) 26px);
  opacity: 0.35;
  pointer-events: none;
}

@keyframes ecom-bg-shift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1.02);
  }

  50% {
    transform: translate3d(2%, 1.5%, 0) scale(1.05);
  }

  100% {
    transform: translate3d(-2%, -1%, 0) scale(1.02);
  }
}

/* ── Navbar ── */
.navbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(238, 242, 255, 0.9);
  padding: 0 2.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.06);
}

.brand {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links a {
  color: #334155;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
  text-decoration: none;
}

.nav-user {
  color: #6366f1;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
}

/* ── Container ── */
.container {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 2rem;
  flex: 1;
}

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s;
  text-align: center;
  letter-spacing: 0.01em;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-2), #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #4f46e5;
  color: #4f46e5;
}

.btn-outline:hover {
  background: #4f46e5;
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Page title ── */
.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: #1a1a2e;
  letter-spacing: -0.5px;
}

/* ── Card ── */
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
  padding: 1.5rem;
}

/* ── Product grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.product-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #f1f5f9;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}

.product-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover img {
  transform: scale(1.03);
}

.card-body {
  padding: 0.9rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.product-name {
  font-weight: 700;
  font-size: 0.93rem;
  line-height: 1.35;
  color: #1e293b;
}

.product-price {
  color: #4f46e5;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

.product-meta {
  font-size: 0.76rem;
  color: #94a3b8;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.8rem;
}

.card-actions .btn {
  flex: 1;
  font-size: 0.82rem;
  padding: 0.45rem 0.5rem;
}

/* ── Search bar ── */
.search-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  background: #fff;
  padding: 0.75rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.search-bar input {
  flex: 1;
  min-width: 160px;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus {
  border-color: #4f46e5;
}

.search-bar select {
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.92rem;
  outline: none;
  background: #fff;
  cursor: pointer;
}

/* ── Detail page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.detail-grid img {
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .1);
}

.detail-price {
  font-size: 2rem;
  font-weight: 800;
  color: #4f46e5;
  margin: 0.75rem 0;
  letter-spacing: -1px;
}

.detail-desc {
  color: #64748b;
  line-height: 1.75;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.in-stock {
  color: #059669;
  font-weight: 700;
}

.out-stock {
  color: #dc2626;
  font-weight: 700;
}

@media (max-width: 680px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Forms ── */
.form-wrap {
  max-width: 460px;
  margin: 2rem auto;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.93rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fafafa;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  background: #fff;
}

.form-hint {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* ── Admin Add Product Form ── */
.product-form {
  max-width: 640px;
  margin: 1.5rem auto 2rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
  border: 1px solid #f1f5f9;
  padding: 1.5rem 1.25rem;
}

.product-form .form-row {
  margin-bottom: 1.15rem;
}

.product-form .form-row label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #374151;
}

.product-form .form-row input[type="text"],
.product-form .form-row input[type="number"],
.product-form .form-row select,
.product-form .form-row textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.93rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  background: #fafafa;
}

.product-form .form-row textarea {
  resize: vertical;
  min-height: 120px;
}

.product-form .form-row input:focus,
.product-form .form-row select:focus,
.product-form .form-row textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  background: #fff;
}

.product-form input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1.5px dashed #c7d2fe;
  border-radius: 12px;
  background: #fbfbff;
}

.product-form input[type="file"]::-webkit-file-upload-button {
  background: #4f46e5;
  color: #fff;
  border: 0;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.product-form .btn {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
}

/* ── Cart ── */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 800px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  border: 1px solid #f1f5f9;
}

.cart-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
}

.cart-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
}

.cart-item-price {
  color: #4f46e5;
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.qty-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-form input {
  width: 55px;
  padding: 0.4rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
}

.cart-summary {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .04);
  position: sticky;
  top: 84px;
  border: 1px solid #f1f5f9;
}

.cart-summary h3 {
  margin-bottom: 1.1rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #64748b;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.2rem;
  border-top: 2px solid #f1f5f9;
  padding-top: 0.8rem;
  margin: 0.8rem 0 1.25rem;
  color: #1e293b;
}

/* ── Orders ── */
.order-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  border: 1px solid #f1f5f9;
  transition: box-shadow 0.15s;
}

.order-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.order-id {
  font-weight: 800;
  font-size: 1rem;
  color: #1e293b;
}

.badge {
  padding: 0.28rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-confirmed {
  background: #fef9c3;
  color: #854d0e;
}

.badge-processing {
  background: #dbeafe;
  color: #1e40af;
}

.badge-shipped {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-delivered {
  background: #dcfce7;
  color: #166534;
}

.badge-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.order-lines {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.order-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: #94a3b8;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.order-total {
  font-weight: 800;
  color: #4f46e5;
  font-size: 1rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 4rem 1rem 2.5rem;
  background: linear-gradient(135deg, #f8f7ff 0%, #eef2ff 100%);
  border-radius: 20px;
  margin-bottom: 2.5rem;
  border: 1px solid #e0e7ff;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 900;
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.hero p {
  color: #64748b;
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1.1rem;
  color: #1e293b;
  letter-spacing: -0.3px;
}

/* ── Footer ── */
.footer {
  background: #1a1a2e;
  color: #64748b;
  text-align: center;
  padding: 1.25rem;
  font-size: 0.83rem;
  margin-top: auto;
}



@media (max-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}