/* ── Root ── */
:root {
  --green-900: #1b4332;
  --green-700: #2d6a4f;
  --green-500: #40916c;
  --green-300: #74c69d;
  --green-100: #d8f3dc;
  --orange:    #e76f51;
  --yellow:    #f4a261;
  --white:     #ffffff;
  --grey-50:   #f9fafb;
  --grey-100:  #f3f4f6;
  --grey-200:  #e5e7eb;
  --grey-400:  #9ca3af;
  --grey-700:  #374151;
  --grey-900:  #111827;
  --radius:    10px;
  --shadow:    0 2px 8px rgba(0,0,0,.12);
  --transition: .2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ── */
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: 1.1rem; }

/* ── Layout ── */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main-content { flex: 1; padding: 20px 0 40px; }

/* ── Header ── */
.site-header {
  background: var(--green-700);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.logo-img {
  height: 44px;
  width: auto;
  display: block;
}
@media (min-width: 768px) {
  .logo-img {
    height: auto !important;
    width: 320px !important;
  }
  .header-inner { padding: 6px 24px; }
}
.header-nav { display: flex; align-items: center; gap: 12px; }

.window-badge {
  font-size: .78rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.window-badge.open  { background: rgba(255,255,255,.15); color: #b7e4c7; }
.window-badge.closed { background: rgba(255,100,100,.2); color: #fca5a5; }

.nav-link {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.nav-link:hover { color: var(--white); border-bottom-color: var(--green-300); }

.cart-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-500);
  color: var(--white);
  border: none;
  border-radius: 24px;
  padding: 8px 16px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.cart-btn:hover { background: var(--green-900); text-decoration: none; color: var(--white); }
.cart-count {
  background: var(--orange);
  color: var(--white);
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

/* ── Hero banner ── */
.hero-tagline-bar {
  background: var(--green-900);
  color: var(--green-200, #b7e4c7);
  text-align: center;
  padding: 8px 16px;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ── Delivery perks banner ── */
.delivery-perks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  background: var(--green-100);
  border: 1px solid var(--green-300);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: .88rem;
  color: var(--green-900);
  max-width: 1100px;
  margin: 12px auto 0;
}
.perks-divider { color: var(--green-400); }

/* ── Window notice ── */
.window-notice {
  max-width: 1100px;
  margin: 16px auto;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
}
.window-notice.open   { background: #d1fae5; border-left: 4px solid var(--green-500); color: var(--green-900); }
.window-notice.closed { background: #fee2e2; border-left: 4px solid var(--orange); color: #7f1d1d; }

/* ── Product grid ── */
.product-section { padding: 0 16px; }
.product-section h2 { margin: 24px 0 12px; color: var(--green-900); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}

@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.product-card.unavailable { opacity: .5; pointer-events: none; }

.product-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--green-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.product-img-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--green-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.placeholder-icon { font-size: 2rem; opacity: .5; }
.placeholder-text {
  font-size: .7rem;
  color: var(--green-700);
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .7;
}

.product-info { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-name { font-weight: 600; font-size: .95rem; color: var(--grey-900); }
.product-description { font-size: .8rem; color: var(--grey-400); line-height: 1.4; }

.packet-select {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid var(--grey-200);
  border-radius: 6px;
  font-size: .85rem;
  background: var(--white);
  color: var(--grey-700);
  cursor: pointer;
}
.packet-select:focus { outline: none; border-color: var(--green-500); }

.qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--grey-200);
  background: var(--grey-100);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.qty-btn:hover { background: var(--green-100); border-color: var(--green-300); }
.qty-input {
  width: 44px;
  text-align: center;
  border: 1.5px solid var(--grey-200);
  border-radius: 6px;
  padding: 4px;
  font-size: .9rem;
}
.qty-input:focus { outline: none; border-color: var(--green-500); }

.add-btn {
  margin-top: auto;
  width: 100%;
  padding: 9px;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.add-btn:hover { background: var(--green-900); }
.add-btn:active { transform: scale(.97); }

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--green-700);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: .9rem;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 280px;
}
.toast.error { background: #dc2626; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Cart / Checkout ── */
.page-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}
.page-title {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--green-900);
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-100);
}

.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.cart-table th {
  text-align: left;
  padding: 8px 6px;
  font-size: .82rem;
  color: var(--grey-400);
  border-bottom: 2px solid var(--grey-200);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cart-table td { padding: 10px 6px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; }
.cart-table .item-name { font-weight: 600; font-size: .92rem; }
.cart-table .item-size { font-size: .8rem; color: var(--grey-400); }
.cart-table .item-price { white-space: nowrap; font-weight: 600; color: var(--green-700); }

.remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-400);
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition);
}
.remove-btn:hover { color: #dc2626; }

.cart-summary {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-top: 8px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: .95rem;
}
.summary-row.total {
  font-size: 1.1rem;
  font-weight: 700;
  border-top: 2px solid var(--grey-200);
  margin-top: 6px;
  padding-top: 10px;
  color: var(--green-900);
}

/* ── Forms ── */
.form-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 20px;
}
.form-section h2 { margin-bottom: 16px; color: var(--green-900); }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 5px;
  color: var(--grey-700);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--grey-200);
  border-radius: 7px;
  font-size: .95rem;
  background: var(--white);
  color: var(--grey-900);
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--green-500); }
.form-control.error { border-color: #dc2626; }

.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--grey-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  flex: 1;
  min-width: 130px;
  transition: border-color var(--transition), background var(--transition);
}
.radio-option:has(input:checked) {
  border-color: var(--green-500);
  background: var(--green-100);
  color: var(--green-900);
}
.radio-option input { accent-color: var(--green-500); }

.delivery-fee-box {
  padding: 10px 14px;
  background: var(--green-100);
  border-radius: 7px;
  font-size: .9rem;
  color: var(--green-900);
  margin-top: 8px;
  display: none;
}
.delivery-fee-box.visible { display: block; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition);
  margin-top: 16px;
}
.btn-primary:hover { background: var(--green-900); color: var(--white); text-decoration: none; }
.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: var(--grey-100);
  color: var(--grey-700);
  border: 1.5px solid var(--grey-200);
  border-radius: 8px;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--grey-200); text-decoration: none; color: var(--grey-900); }

/* ── Confirmation page ── */
.confirmation-box {
  text-align: center;
  padding: 40px 20px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 560px;
  margin: 20px auto;
}
.confirmation-box .check-icon { font-size: 4rem; margin-bottom: 12px; }
.confirmation-box h1 { color: var(--green-700); margin-bottom: 8px; }
.confirmation-ref {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-900);
  background: var(--green-100);
  padding: 8px 20px;
  border-radius: 6px;
  display: inline-block;
  margin: 12px 0;
  letter-spacing: .05em;
}
.order-detail-table { width: 100%; border-collapse: collapse; text-align: left; margin: 16px 0; }
.order-detail-table th { background: var(--grey-100); padding: 8px 10px; font-size: .82rem; text-transform: uppercase; color: var(--grey-400); }
.order-detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--grey-200); font-size: .9rem; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error   { background: #fee2e2; color: #7f1d1d; }
.alert-info    { background: #dbeafe; color: #1e3a5f; }
.alert-warning { background: #fef3c7; color: #78350f; }

/* ── Footer ── */
.site-footer {
  background: var(--green-900);
  color: var(--green-300);
  text-align: center;
  padding: 20px 16px;
  font-size: .85rem;
  margin-top: auto;
}
.site-footer a { color: var(--green-300); }

/* ── Admin ── */
.admin-body { background: #f0f4f0; }

.admin-header {
  background: var(--green-900);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.admin-nav { display: flex; align-items: center; gap: 8px; }
.nav-toggle {
  background: rgba(255,255,255,.1);
  border: none;
  color: var(--white);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  display: block;
}
@media (min-width: 900px) { .nav-toggle { display: none; } }

.nav-list {
  display: none;
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  background: var(--green-900);
  list-style: none;
  flex-direction: column;
  padding: 8px 0;
  box-shadow: 0 8px 16px rgba(0,0,0,.3);
  z-index: 200;
}
.nav-list.open { display: flex; }
@media (min-width: 900px) {
  .nav-list {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: none;
    box-shadow: none;
    padding: 0;
    gap: 4px;
  }
}
.nav-list a {
  display: block;
  padding: 10px 20px;
  color: var(--green-300);
  font-size: .88rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.nav-list a:hover, .nav-list a.active {
  background: rgba(255,255,255,.12);
  color: var(--white);
  text-decoration: none;
}

.admin-main { padding: 20px 16px 40px; max-width: 1200px; margin: 0 auto; }
.admin-footer { background: var(--green-900); color: var(--green-300); text-align: center; padding: 12px; font-size: .8rem; }

.admin-title {
  font-size: 1.5rem;
  color: var(--green-900);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--green-100);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--green-700); }
.stat-card .stat-label { font-size: .78rem; color: var(--grey-400); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--green-900); margin-bottom: 14px; }

/* Admin tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  overflow-x: auto;
  display: block;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--grey-100);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grey-700);
  white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; }
.data-table tr:hover td { background: var(--grey-50); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #7f1d1d; }
.badge-grey   { background: var(--grey-100); color: var(--grey-700); }
.badge-yellow { background: #fef3c7; color: #78350f; }
.badge-blue   { background: #dbeafe; color: #1e3a5f; }

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .8rem;
  border: 1.5px solid var(--grey-200);
  background: var(--white);
  cursor: pointer;
  text-decoration: none;
  color: var(--grey-700);
  display: inline-block;
  transition: background var(--transition);
}
.btn-sm:hover { background: var(--grey-100); text-decoration: none; color: var(--grey-900); }
.btn-sm.danger { border-color: #fca5a5; color: #dc2626; }
.btn-sm.danger:hover { background: #fee2e2; }
.btn-sm.success { border-color: var(--green-300); color: var(--green-700); }
.btn-sm.success:hover { background: var(--green-100); }

.btn-admin-primary {
  display: inline-block;
  padding: 10px 20px;
  background: var(--green-700);
  color: var(--white);
  border: none;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.btn-admin-primary:hover { background: var(--green-900); color: var(--white); text-decoration: none; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--grey-200);
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--white);
  border-radius: 50%;
  left: 3px;
  top: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle input:checked + .toggle-slider { background: var(--green-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Products accordion */
.packet-list { margin-top: 8px; }
.packet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--grey-100);
  flex-wrap: wrap;
}
.packet-row:last-child { border-bottom: none; }
.packet-input { width: 90px; padding: 5px 8px; border: 1.5px solid var(--grey-200); border-radius: 6px; font-size: .85rem; }
.packet-input:focus { outline: none; border-color: var(--green-500); }

/* Driver route */
.route-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.step-number {
  width: 32px;
  height: 32px;
  background: var(--green-700);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}
.step-info { flex: 1; }
.step-name { font-weight: 600; font-size: .95rem; }
.step-address { font-size: .82rem; color: var(--grey-400); margin: 2px 0; }
.step-meta { font-size: .78rem; color: var(--grey-400); }
.step-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-maps {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #1a73e8;
  color: var(--white);
  border-radius: 6px;
  font-size: .8rem;
  text-decoration: none;
}
.btn-maps:hover { background: #1557b0; color: var(--white); text-decoration: none; }

/* Order window info */
.window-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--green-500);
}
.window-card.inactive { border-left-color: var(--grey-400); opacity: .8; }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900), var(--green-500));
  padding: 20px;
}
.login-card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-icon { font-size: 2.5rem; display: block; }
.login-logo h1 { font-size: 1.4rem; color: var(--green-900); margin-top: 6px; }

/* Misc */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--grey-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }
