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

:root {
  --green: #14532d; --green-light: #166534; --green-bright: #22c55e;
  --green-pale: #dcfce7; --amber: #fbbf24; --amber-dark: #f59e0b;
  --gray-50: #f9fafb; --gray-100: #f3f4f6;
  --gray-200: #e5e7eb; --gray-300: #d1d5db; --gray-400: #9ca3af;
  --gray-500: #6b7280; --gray-700: #374151; --gray-900: #111827;
  --white: #ffffff; --red: #dc2626;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50); color: var(--gray-900);
  line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
}

/* ===== Header + Steps ===== */
header {
  background: var(--white); border-bottom: 2px solid var(--gray-200);
  padding: 0; position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.header-brand { text-decoration: none; font-size: 1.15rem; font-weight: 700; color: var(--green); white-space: nowrap; }
.step-indicator { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.step-indicator .step { color: var(--gray-400); font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.step-indicator .step.active { color: var(--green); font-weight: 700; background: var(--green-pale); }
.step-indicator .step.done { color: var(--green-bright); }
.step-indicator .step-arrow { color: var(--gray-300); font-size: 0.75rem; }

/* ===== Page Layouts ===== */
.page { flex: 1; }
.page-wide { max-width: 1400px; margin: 0 auto; padding: 32px; width: 100%; }
.page-center { max-width: 640px; margin: 40px auto; padding: 0 24px; }

/* ===== Split Layout (Step 1) ===== */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}
.split-left h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 20px; color: var(--gray-900); }

/* ===== Product Grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.product-card {
  border: 2px solid var(--gray-200); border-radius: 10px; overflow: hidden;
  background: var(--white); transition: border-color .15s, box-shadow .15s;
}
.product-card img { width: 100%; height: 130px; object-fit: cover; display: block; }
.product-card-body { padding: 12px; }
.product-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.product-price { font-size: 0.85rem; color: var(--green); font-weight: 600; margin-bottom: 8px; }
.product-card.is-selected { border-color: var(--green-bright); box-shadow: 0 0 0 1px rgba(34,197,94,.3); }
.product-card.unavailable { opacity: 0.55; pointer-events: none; }
.product-card.unavailable img { filter: grayscale(0.6); }

/* Autocomplete dropdown */
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  z-index: 999;
  max-height: 240px;
  overflow-y: auto;
}
.ac-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--gray-100);
}
.ac-item:hover { background: var(--gray-50); }
.ac-item:last-child { border-bottom: none; }
.ac-main { font-size: 0.95rem; color: var(--gray-900); }
.ac-secondary { font-size: 0.8rem; color: var(--gray-400); margin-top: 2px; }

.btn-add {
  width: 100%; padding: 8px; border: 1px solid var(--amber); border-radius: 8px;
  background: var(--white); color: var(--amber-dark); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn-add:hover { background: var(--amber); color: var(--gray-900); }

/* ===== Cart Panel ===== */
.cart-panel {
  background: var(--white); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
  padding: 24px; position: sticky; top: 80px;
}
.cart-panel h2 { font-size: 1.15rem; color: var(--green); margin-bottom: 12px; font-weight: 700; }
.cart-items { display: grid; gap: 0; }
.cart-item {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info strong { display: block; font-size: 0.9rem; }
.cart-item-unit { font-size: 0.78rem; color: var(--gray-400); }
.cart-item-qty { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 26px; height: 26px; border: 1px solid var(--gray-200); border-radius: 6px;
  background: var(--white); font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--gray-700);
}
.qty-btn:hover { border-color: var(--green); color: var(--green); }
.qty-value { min-width: 20px; text-align: center; font-weight: 600; }
.cart-item-total { font-weight: 600; white-space: nowrap; font-size: 0.95rem; }
.cart-item-remove { background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 1rem; }
.cart-item-remove:hover { color: var(--red); }
.cart-footer { padding-top: 12px; border-top: 2px solid var(--gray-200); margin-top: 8px; }
.cart-subtotal-row { display: flex; justify-content: space-between; font-size: 1.05rem; padding: 4px 0 12px; }
.hint { font-size: 0.85rem; color: var(--gray-500); }
.hint-inline { font-weight: 400; color: var(--gray-400); font-size: 0.82rem; }

/* ===== Card (steps 2-5) ===== */
.card {
  background: var(--white); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
  padding: 32px;
}
.card h2 { font-size: 1.3rem; color: var(--green); margin-bottom: 20px; font-weight: 700; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-group-sm { flex: 0 0 80px !important; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--gray-200); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; color: var(--gray-900); background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-bright); }
textarea { resize: vertical; min-height: 48px; }

/* ===== Calendar ===== */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; font-size: 1rem; }
.btn-nav {
  background: none; border: 2px solid var(--gray-200); border-radius: 6px;
  width: 34px; height: 34px; font-size: 1.1rem; cursor: pointer; color: var(--gray-700);
  display: flex; align-items: center; justify-content: center;
}
.btn-nav:hover { border-color: var(--green); color: var(--green); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-header { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--gray-400); padding: 4px 0; text-transform: uppercase; }
.cal-day {
  aspect-ratio: 1.4; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.88rem; cursor: default; font-weight: 500; position: relative;
}
.cal-day.empty { visibility: hidden; }
.cal-day.unavailable { color: var(--gray-300); }
.cal-day.available { color: var(--green); background: var(--green-pale); cursor: pointer; font-weight: 600; }
.cal-day.available:hover { background: var(--green-bright); color: var(--white); }
.cal-day.selected { background: var(--green); color: var(--white); box-shadow: 0 2px 6px rgba(20,83,45,.25); }
.cal-day.today::after { content:''; position:absolute; bottom:2px; width:3px; height:3px; border-radius:50%; background:var(--green-bright); }
.selected-date { margin-top: 10px; padding: 10px; background: var(--green-pale); border-radius: 8px; text-align: center; font-size: 0.9rem; color: var(--green); }

/* ===== Pickup ===== */
.pickup-info { background: var(--green-pale); padding: 16px; border-radius: 8px; }
.pickup-info p { margin-bottom: 6px; }

/* ===== Review ===== */
.review-summary { display: grid; gap: 8px; margin-bottom: 16px; }
.review-row { display: flex; justify-content: space-between; align-items: baseline; }
.review-row span { color: var(--gray-500); font-size: 0.9rem; }
.review-row strong { color: var(--gray-900); }

/* ===== Totals ===== */
.order-total-box {
  margin: 16px 0; padding: 16px; background: var(--gray-50); border-radius: 10px;
  border: 1px solid var(--gray-200);
}
.total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.92rem; }
.total-final { border-top: 2px solid var(--gray-200); margin-top: 8px; padding-top: 10px; font-weight: 700; font-size: 1.2rem; color: var(--green); }

.checkout-panel { border: 1px solid var(--gray-200); background: var(--gray-50); border-radius: 10px; padding: 14px; margin: 12px 0; }
.checkout-badge { display: inline-block; background: var(--green-pale); color: var(--green); border-radius: 999px; padding: 3px 10px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.checkout-copy { color: var(--gray-500); font-size: 0.88rem; }

/* ===== Buttons ===== */
.btn-primary {
  width: 100%; padding: 13px; background: var(--amber); color: var(--gray-900);
  border: none; border-radius: 8px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all .15s; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.btn-primary:hover:not(:disabled) { background: var(--amber-dark); box-shadow: 0 4px 12px rgba(245,158,11,.18); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-back {
  background: none; border: none; color: var(--gray-500); font-size: 0.9rem;
  cursor: pointer; padding: 8px 0; font-weight: 500;
}
.btn-back:hover { color: var(--green); }

.btn-outline {
  padding: 8px 14px; border: 1px solid var(--amber); border-radius: 8px;
  background: var(--white); color: var(--amber-dark); font-size: 0.85rem;
  font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-outline:hover { background: var(--amber); color: var(--gray-900); }

.page-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white); border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error { color: var(--red); font-size: 0.85rem; margin: 8px 0; min-height: 20px; }

/* ===== Confirmation ===== */
.check-icon {
  width: 60px; height: 60px; background: var(--green-bright); color: var(--white);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; margin: 0 auto 16px;
}
.conf-note { margin-top: 16px; font-size: 0.88rem; color: var(--gray-500); }
.conf-note a { color: var(--green); }

/* ===== Footer ===== */
footer { margin-top: auto; padding: 16px 0; text-align: center; font-size: 0.78rem; color: var(--gray-400); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .split-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
  .header-inner { padding: 12px 16px; }
  .step-indicator { font-size: 0.75rem; }
  .page-wide { padding: 20px 16px; }
}
@media (max-width: 520px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-wrap: wrap; }
  .form-group-sm { flex: 1 1 60px !important; }
  .step-indicator .step-arrow { display: none; }
}
