:root,
[data-theme="dark"] {
  --primary: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #273449;
  --border: #334155;
  --muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;

  --alert-success-bg: #14532d;
  --alert-success-text: #bbf7d0;
  --alert-error-bg: #7f1d1d;
  --alert-error-text: #fecaca;
  --alert-info-bg: #1e3a8a;
  --alert-info-text: #bfdbfe;

  --badge-pending-bg: #78350f;
  --badge-pending-text: #fde68a;
  --badge-success-bg: #14532d;
  --badge-success-text: #bbf7d0;
  --badge-error-bg: #7f1d1d;
  --badge-error-text: #fecaca;
}

[data-theme="light"] {
  --primary: #1a1a1a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-alt: #f3f4f6;
  --border: #e5e5e5;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;

  --alert-success-bg: #dcfce7;
  --alert-success-text: #166534;
  --alert-error-bg: #fee2e2;
  --alert-error-text: #991b1b;
  --alert-info-bg: #dbeafe;
  --alert-info-text: #1e40af;

  --badge-pending-bg: #fef3c7;
  --badge-pending-text: #92400e;
  --badge-success-bg: #dcfce7;
  --badge-success-text: #166534;
  --badge-error-bg: #fee2e2;
  --badge-error-text: #991b1b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--primary);
  line-height: 1.5;
  transition: background .2s ease, color .2s ease;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: inherit; text-decoration: none; }

/* HEADER */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background .2s ease, border-color .2s ease;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
}
.logo { font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.logo-img { height: 40px; width: auto; display: block; }
@media (max-width: 480px) {
  .logo-img { height: 32px; }
}
.header-inner nav {
  display: flex;
  align-items: center;
}
.header-inner nav a {
  margin-left: 24px;
  font-weight: 500;
  position: relative;
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 20px;
  padding: 0;
}
.theme-toggle:hover { background: var(--surface-alt); }
.cart-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* HERO / BANNER */
.hero {
  background: linear-gradient(135deg, #0b1e3d 0%, #1a56b0 60%, #4a90d9 100%);
  border-radius: 16px;
  margin-top: 24px;
  padding: 50px 30px;
  color: #fff;
  text-align: center;
}
.hero-inner h1 { margin: 0 0 10px; font-size: 2rem; }
.hero-inner p { margin: 0 0 20px; opacity: .9; }
.hero-inner .btn-primary { display: inline-block; }

/* HERO SLIDESHOW (product carousel on homepage) */
.hero-slider {
  position: relative;
  margin-top: 24px;
  border-radius: 16px;
  overflow: hidden;
  background: #0b1e3d;
}
.hero-slider-track {
  display: flex;
  transition: transform .5s ease;
}
.hero-slide {
  position: relative;
  flex: 0 0 100%;
  display: block;
  height: 340px;
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-slide-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px 24px;
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0));
  color: #fff;
}
.hero-slide-caption h3 { margin: 0 0 4px; font-size: 1.2rem; }
.hero-slide-price { font-weight: 700; }
.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.4);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.hero-prev { left: 12px; }
.hero-next { right: 12px; }
.hero-nav:hover { background: rgba(0,0,0,.65); }
.hero-dots {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.5);
  cursor: pointer;
  padding: 0;
}
.hero-dot.active { background: #fff; }
@media (max-width: 600px) {
  .hero-slide { height: 220px; }
}

/* BADGE PRODUK */
.product-card { position: relative; }
.badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: .7rem; font-weight: 700; padding: 4px 10px;
  border-radius: 20px; color: #fff; text-transform: uppercase;
}
.badge-terlaris { background: #e11d48; }
.badge-baru { background: #16a34a; }
.badge-diskon { background: #f59e0b; }

/* TOMBOL WA MENGAMBANG */
.wa-float {
  position: fixed; bottom: 20px; right: 20px; z-index: 999;
  background: #25D366; color: #fff; width: 56px; height: 56px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.wa-float:hover { filter: brightness(1.05); }

/* GRID PRODUK */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 30px 0;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s ease, transform .15s ease, background .2s ease, border-color .2s ease;
}
.product-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.35); transform: translateY(-2px); }
.product-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--surface-alt); }
.product-card .no-image {
  width: 100%; aspect-ratio: 1/1; background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .85rem;
}
.product-card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card h3 { margin: 0; font-size: 1rem; }
.price { font-weight: 700; color: var(--accent); }
.stock-note { font-size: .8rem; color: var(--muted); }

/* BUTTONS */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: .9rem;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--surface-alt); color: var(--primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* PRODUCT DETAIL */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 30px 0;
}
.product-detail img { width: 100%; border-radius: 12px; }
@media (max-width: 700px) {
  .product-detail { grid-template-columns: 1fr; }
}

/* CART TABLE */
table.cart-table { width: 100%; border-collapse: collapse; margin: 20px 0; background: var(--surface); }
table.cart-table th, table.cart-table td {
  padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem;
}
table.cart-table input[type=number] { width: 60px; padding: 6px; }

.cart-summary {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; max-width: 350px; margin-left: auto;
}
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.cart-summary .total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
input, textarea, select {
  color: var(--primary);
  background: var(--surface-alt);
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
  background: var(--surface-alt); color: var(--primary);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--muted); }
.checkout-grid {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; margin: 30px 0;
}
@media (max-width: 800px) { .checkout-grid { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: .9rem; }
.alert-success { background: var(--alert-success-bg); color: var(--alert-success-text); }
.alert-error { background: var(--alert-error-bg); color: var(--alert-error-text); }
.alert-info { background: var(--alert-info-bg); color: var(--alert-info-text); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* FOOTER */
.site-footer { margin-top: 60px; padding: 30px 0; text-align: center; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }

/* ADMIN */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #111827; color: #fff; padding: 20px 0; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 12px 24px; color: #d1d5db; font-size: .9rem; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: #1f2937; color: #fff; }
.admin-sidebar .brand { padding: 0 24px 20px; font-weight: 700; color: #fff; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #1f2937; margin-bottom: 12px; padding-bottom: 20px; }
.admin-sidebar .brand-img { width: 100%; max-width: 160px; height: auto; display: block; background: #fff; border-radius: 6px; padding: 6px; }
.admin-content { flex: 1; padding: 30px; background: var(--bg); }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
table.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .88rem; text-align: left; }
table.admin-table th { background: var(--surface-alt); }
.badge { padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-text); }
.badge-settlement, .badge-capture { background: var(--badge-success-bg); color: var(--badge-success-text); }
.badge-expire, .badge-cancel, .badge-deny { background: var(--badge-error-bg); color: var(--badge-error-text); }
.login-box { max-width: 380px; margin: 80px auto; background: var(--surface); padding: 30px; border-radius: 12px; border: 1px solid var(--border); }
