/* ===== CSS Variables ===== */
:root {
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: #eef2ff;
  --color-accent: #f59e0b;
  --color-accent-hover: #d97706;
  --color-bg: #f9fafb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-white: #ffffff;
  --color-border: #e5e7eb;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.15);
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --max-width: 1200px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-hover); }

/* ===== Navbar ===== */
.navbar {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  height: 68px;
  gap: 2.5rem;
}

.nav-brand {
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.nav-links a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: all var(--transition);
}

.nav-links a:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.nav-lang { margin-left: auto; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--color-border);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--transition);
}

.lang-switch:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

/* ===== Container ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem;
  flex: 1;
  width: 100%;
}

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 50%, #fef3c7 100%);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(79,70,229,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(124,58,237,0.06) 0%, transparent 50%);
  animation: heroFloat 20s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 2%); }
}

.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  position: relative;
  background: linear-gradient(135deg, #1e1b4b, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

/* ===== Section Title ===== */
.section-title, .page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1.75rem;
  letter-spacing: -0.02em;
}

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
}

.product-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  border: 1px solid rgba(0,0,0,0.04);
  transition: all var(--transition);
  display: block;
  color: var(--color-text);
  position: relative;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
  color: var(--color-text);
}

.product-card:hover .product-image {
  background: #e0e7ff;
}

.product-card:hover .image-placeholder span {
  transform: scale(1.15) rotate(-5deg);
}

.product-image {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3.5rem;
}

.image-placeholder span { transition: transform var(--transition); }
.image-placeholder.large { font-size: 6rem; }

.product-info { padding: 1.25rem 1.5rem; }

.product-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.product-price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* ===== Product Detail ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: all var(--transition);
}

.back-link:hover { color: var(--color-primary); background: var(--color-primary-light); }

.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.5rem;
  align-items: start;
}

.product-detail-image {
  background: linear-gradient(135deg, #f1f5f9, #e0e7ff);
  border-radius: var(--radius-xl);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.product-detail-name {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.product-detail-category {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
}

.product-detail-price {
  font-size: 2rem;
  font-weight: 900;
  color: var(--color-primary);
  margin-bottom: 1.25rem;
}

.product-detail-desc {
  color: var(--color-text-muted);
  line-height: 1.8;
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

.add-to-cart-form { display: flex; align-items: flex-end; gap: 1rem; }

.quantity-group { display: flex; flex-direction: column; gap: 0.3rem; }

.quantity-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quantity-group input {
  width: 72px;
  padding: 0.6rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  text-align: center;
  font-weight: 600;
  transition: border-color var(--transition);
}

.quantity-group input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px rgba(79,70,229,0.1); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79,70,229,0.45);
  color: var(--color-white);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-danger { background: var(--color-danger); color: var(--color-white); }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); color: var(--color-white); }

.btn-lg { padding: 0.85rem 2.25rem; font-size: 1.05rem; border-radius: 12px; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; border-radius: 6px; }

/* ===== Cart Table ===== */
.cart-table-wrapper, .orders-table-wrapper {
  overflow-x: auto;
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.04);
}

.cart-table, .orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
}

.cart-table th, .cart-table td,
.orders-table th, .orders-table td {
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.cart-table th, .orders-table th {
  background: #f9fafb;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.cart-table tbody tr { transition: background var(--transition); }
.cart-table tbody tr:hover,
.orders-table tbody tr:hover { background: #fafbff; }

.cart-table tfoot td { border-bottom: none; background: #f9fafb; }
.cart-total-label { text-align: right; }
.cart-total-value { font-size: 1.25rem; font-weight: 800; color: var(--color-primary); }

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

.qty-input {
  width: 64px;
  padding: 0.4rem;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 600;
}

.cart-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ===== Checkout Form ===== */
.checkout-form {
  background: var(--color-white);
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.04);
  max-width: 640px;
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  margin-top: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.form-section-title:not(:first-of-type) { margin-top: 2rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-group { margin-bottom: 1.5rem; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all var(--transition);
  font-family: var(--font);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

.checkout-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  gap: 1rem;
}

/* ===== Order Confirm ===== */
.order-confirm {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  max-width: 500px;
  margin: 0 auto;
}

.confirm-icon { font-size: 4rem; margin-bottom: 1rem; }

.order-confirm h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  color: var(--color-success);
}

.confirm-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }

/* ===== Orders Table ===== */
.order-id { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.85rem; font-weight: 600; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-pending::before { background: #f59e0b; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-processing::before { background: #3b82f6; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-completed::before { background: #10b981; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-cancelled::before { background: #ef4444; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  border: 2px dashed var(--color-border);
}

.empty-state p {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}

/* ===== Error Page ===== */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.error-content { text-align: center; }
.error-title { font-size: 2.5rem; font-weight: 900; color: var(--color-danger); margin-bottom: 1rem; }
.error-message { font-size: 1.15rem; color: var(--color-text-muted); margin-bottom: 2rem; }

/* ===== Footer ===== */
.footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 2rem;
  text-align: center;
}

.footer-container p { color: var(--color-text-muted); font-size: 0.85rem; }

.req-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.7rem !important;
  color: #c0c5ce !important;
  margin-top: 0.35rem;
}

/* ===== Hero Extras ===== */
.hero-badge {
  display: inline-block;
  background: rgba(79,70,229,0.1);
  color: var(--color-primary);
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 1rem;
  position: relative;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  position: relative;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  margin-top: 2.5rem;
  position: relative;
}

.stat { text-align: center; }
.stat-num { display: block; font-size: 1.75rem; font-weight: 900; color: var(--color-primary); }
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Section Header ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.75rem;
}

.section-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
}

.page-subtitle {
  color: var(--color-text-muted);
  margin-top: -1rem;
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* ===== Card Badges ===== */
.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-primary);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 2;
}

.card-badge.premium { background: linear-gradient(135deg, #f59e0b, #d97706); }
.card-badge.urgent { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ===== Product Tags ===== */
.product-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }

.tag {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== Product Meta ===== */
.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.product-stock {
  font-size: 0.75rem;
  color: var(--color-success);
  font-weight: 600;
}

.product-stock.low { color: var(--color-danger); }

.product-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin: 0.3rem 0;
}

/* ===== Product Detail Features ===== */
.product-detail-features {
  display: flex;
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.detail-feature {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.detail-feature-icon { font-size: 1.1rem; }

.stock-info {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-success);
  margin-bottom: 1rem;
}

.stock-info.low { color: var(--color-danger); }

/* ===== Features Section ===== */
.features-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--color-border);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--color-white);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0,0,0,0.04);
  box-shadow: var(--shadow-xs);
  text-align: center;
  transition: all var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Placeholder Card ===== */
.placeholder-card { opacity: 0.5; cursor: default; }
.placeholder-card:hover { transform: none; box-shadow: var(--shadow-xs); }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.product-card, .cart-table-wrapper, .orders-table-wrapper, .checkout-form, .order-confirm {
  animation: fadeIn 0.4s ease-out both;
}

.product-grid .product-card:nth-child(2) { animation-delay: 0.05s; }
.product-grid .product-card:nth-child(3) { animation-delay: 0.1s; }
.product-grid .product-card:nth-child(4) { animation-delay: 0.15s; }
.product-grid .product-card:nth-child(5) { animation-delay: 0.2s; }
.product-grid .product-card:nth-child(6) { animation-delay: 0.25s; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-container { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; gap: 0.5rem; }
  .nav-links { order: 3; width: 100%; gap: 0.25rem; padding-bottom: 0.5rem; overflow-x: auto; }
  .hero { padding: 2.5rem 1.5rem; border-radius: var(--radius-lg); }
  .hero h1 { font-size: 2rem; }
  .product-detail-layout { grid-template-columns: 1fr; gap: 2rem; }
  .form-row { grid-template-columns: 1fr; }
  .cart-actions, .checkout-actions { flex-direction: column; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
  .checkout-form { padding: 1.5rem; }
  .container { padding: 1.5rem 1rem; }
}
