/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #a5b4fc;
  --bg: #0f0f11;
  --surface: #18181b;
  --surface2: #232329;
  --border: #2e2e38;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ─── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ─── Layout containers ────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }

/* ─── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,15,17,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.navbar .container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.navbar .brand {
  font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.navbar nav { display: flex; gap: 8px; align-items: center; }
.navbar nav a {
  color: var(--muted); padding: 6px 14px; border-radius: 8px;
  font-size: .9rem; font-weight: 500; transition: color .2s, background .2s;
}
.navbar nav a:hover { color: var(--text); background: var(--surface2); text-decoration: none; }

/* Cart badge */
.cart-link { position: relative; }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; border: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 14px rgba(99,102,241,.4);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px rgba(99,102,241,.55);
}

.btn-outline {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-light); }

.btn-danger {
  background: var(--danger); color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-success {
  background: var(--success); color: #fff;
}
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-sm { padding: 6px 14px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-body { padding: 20px; }

/* ─── Product grid ─────────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.product-card { cursor: pointer; }
.product-card .thumb {
  width: 100%; height: 200px; object-fit: cover;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
}
.product-card .card-body { display: flex; flex-direction: column; gap: 10px; }
.product-card .cat-badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surface2); color: var(--muted);
  padding: 3px 10px; border-radius: 20px; width: fit-content;
}
.product-card .price {
  font-size: 1.3rem; font-weight: 800; color: var(--accent-light);
}

/* ─── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,.18), transparent);
  text-align: center; padding: 100px 20px 80px;
}
.hero p { color: var(--muted); max-width: 520px; margin: 16px auto 36px; font-size: 1.05rem; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  background: var(--surface2); border: 1.5px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 10px 14px; font-size: .95rem; font-family: inherit;
  transition: border-color .2s, box-shadow .2s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
select option { background: var(--surface2); }

/* File upload zone */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
  color: var(--muted);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent); background: rgba(99,102,241,.06);
}
.upload-zone .icon { font-size: 2.5rem; margin-bottom: 10px; }
.upload-preview { max-height: 160px; border-radius: 8px; margin: 12px auto 0; }

/* ─── Cart ─────────────────────────────────────────────────────────────────── */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td {
  padding: 14px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.cart-table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qty-control button:hover { background: var(--accent); border-color: var(--accent); }

.cart-summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-top: 32px;
  max-width: 380px; margin-left: auto;
}
.cart-summary .row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cart-summary .row:last-child { border: none; font-weight: 700; font-size: 1.15rem; }

/* ─── Checkout ─────────────────────────────────────────────────────────────── */
.checkout-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 36px; align-items: start;
}
@media (max-width: 768px) {
  .checkout-layout { grid-template-columns: 1fr; }
}

.order-summary-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; position: sticky; top: 84px;
}
.order-summary-box h3 { margin-bottom: 16px; }
.summary-line {
  display: flex; justify-content: space-between; padding: 8px 0;
  font-size: .92rem; border-bottom: 1px solid var(--border);
}
.summary-line:last-of-type { border: none; font-weight: 700; font-size: 1.1rem; }

/* ─── Order status ─────────────────────────────────────────────────────────── */
.order-status-card {
  max-width: 580px; margin: 60px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 40px;
  text-align: center;
}
.status-badge {
  display: inline-block; padding: 10px 26px; border-radius: 30px;
  font-size: 1rem; font-weight: 700; letter-spacing: .04em; margin: 24px 0;
}
.status-PAYMENT_PENDING  { background: #78350f33; color: #fbbf24; }
.status-PAYMENT_RECEIVED { background: #14532d33; color: #4ade80; }
.status-IN_PROGRESS      { background: #312e8133; color: #a5b4fc; }
.status-COMPLETED        { background: #14532d55; color: #86efac; }

.status-steps { display: flex; justify-content: center; gap: 0; margin: 32px 0; flex-wrap: wrap; }
.step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1; min-width: 80px; position: relative;
}
.step::before {
  content: ''; position: absolute; top: 14px; left: 50%; right: -50%;
  height: 2px; background: var(--border); z-index: 0;
}
.step:last-child::before { display: none; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--surface2); z-index: 1; display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
}
.step.active .step-dot { background: var(--accent); border-color: var(--accent); }
.step.done .step-dot { background: var(--success); border-color: var(--success); }
.step-label { font-size: .7rem; color: var(--muted); text-align: center; }
.step.active .step-label, .step.done .step-label { color: var(--text); }

/* ─── Admin ─────────────────────────────────────────────────────────────────── */
.admin-layout {
  display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px);
}
.admin-sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 0;
}
.admin-sidebar a {
  display: block; padding: 10px 20px; color: var(--muted);
  font-weight: 500; font-size: .9rem; border-left: 3px solid transparent;
  transition: color .2s, border-color .2s, background .2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  color: var(--text); background: var(--surface2); border-color: var(--accent);
  text-decoration: none;
}
.admin-content { padding: 32px; }

.orders-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.orders-table th, .orders-table td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.orders-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.orders-table tr:hover td { background: var(--surface2); }

/* ─── Toasts ────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface2); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 10px;
  font-size: .9rem; box-shadow: var(--shadow);
  animation: slideIn .3s ease;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Spinner / loading ─────────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(15,15,17,.7);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}

/* ─── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 20px; color: var(--muted);
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 16px; }

/* ─── Modals ─────────────────────────────────────────────────────────────────  */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); z-index: 150;
  display: none; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 520px; width: 90%;
  max-height: 90vh; overflow-y: auto;
  animation: popIn .2s ease;
}
@keyframes popIn {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.modal-close {
  background: none; border: none; color: var(--muted); font-size: 1.4rem;
  cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* ─── Variant selector ──────────────────────────────────────────────────────── */
.variant-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-chip {
  padding: 6px 14px; border-radius: 8px;
  background: var(--surface2); border: 1.5px solid var(--border);
  color: var(--muted); font-size: .82rem; cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.variant-chip.selected {
  border-color: var(--accent); color: var(--accent-light); background: rgba(99,102,241,.1);
}
.variant-chip:hover { border-color: var(--accent-light); }

/* ─── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .section { padding: 40px 0; }
  .hero { padding: 60px 16px 50px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 0; }
  .admin-sidebar a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
}

/* ─── Utility ────────────────────────────────────────────────────────────────  */
.text-muted   { color: var(--muted); }
.text-accent  { color: var(--accent-light); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.gap-4 { gap: 16px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
