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

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.cart-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
  border-radius: 8px;
  transition: background 0.15s;
}

.cart-btn:hover {
  background: var(--bg);
}

.cart-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  transform: translate(25%, -25%);
}

.cart-badge:empty,
.cart-badge[data-count="0"] {
  display: none;
}

/* ===== Sections ===== */
.section {
  display: none;
  padding: 40px 0 80px;
}

.section.active {
  display: block;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 8px;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ===== Products Grid ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -5px rgb(0 0 0 / 0.1);
}

.product-image {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
}

.product-body {
  padding: 20px;
}

.product-body h3 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.product-price {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.product-body p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* ===== Cart ===== */
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.cart-header h1 {
  font-size: 1.75rem;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cart-empty p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.cart-item-image {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-info h4 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.cart-item-info .price {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item-qty button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-qty span {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
}

.cart-item-total {
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.25rem;
  line-height: 1;
}

.cart-item-remove:hover {
  color: var(--danger);
}

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 40px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 1rem;
}

.summary-row.total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
  font-size: 1.25rem;
  font-weight: 700;
}

/* ===== Payment ===== */
.payment-section {
  margin-top: 8px;
}

.payment-section h2 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.payment-note {
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 600px;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.payment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.payment-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-weight: 700;
  font-size: 0.75rem;
  color: white;
  letter-spacing: 0.02em;
}

.payment-icon.paypal {
  background: #003087;
}

.payment-icon.venmo {
  background: #008cff;
}

.payment-icon.zelle {
  background: #6d1ed4;
}

.payment-card h3 {
  margin-bottom: 8px;
}

.payment-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.payment-detail {
  font-size: 1.05rem !important;
  color: var(--text) !important;
  margin-bottom: 16px !important;
  word-break: break-all;
}

.payment-card .btn {
  margin-bottom: 10px;
}

.payment-card .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.order-note {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 20px 24px;
}

.order-note h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.order-note ul {
  margin: 0 0 12px 20px;
  color: var(--text-muted);
}

.order-note p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  transform: translateY(12px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--text);
}

.modal-body {
  padding: 0;
}

.modal-image {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border-radius: 16px 16px 0 0;
}

.modal-info {
  padding: 24px;
}

.modal-info h2 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.modal-price {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

.modal-desc {
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.qty-control {
  margin-bottom: 20px;
}

.qty-control label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.qty-buttons {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.qty-buttons button {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg);
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text);
}

.qty-buttons button:hover {
  background: #e2e8f0;
}

.qty-buttons input {
  width: 48px;
  height: 40px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  -moz-appearance: textfield;
}

.qty-buttons input::-webkit-outer-spin-button,
.qty-buttons input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .cart-item {
    flex-wrap: wrap;
  }

  .cart-item-total {
    width: 100%;
    text-align: left;
    margin-top: 4px;
  }

  .payment-methods {
    grid-template-columns: 1fr;
  }
}
