/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary:    #2563eb;
  --primary-dk: #1d4ed8;
  --success:    #16a34a;
  --danger:     #dc2626;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-900:   #0f172a;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.1);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.1);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.15);
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
input, select, textarea, button { font: inherit; }

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ───────────────────────────────────────────────── */
.store-header { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.store-header-inner { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1.25rem; max-width: 1100px; margin: 0 auto; }
.store-brand { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); }
.store-brand:hover { text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.cart-btn { position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; background: var(--primary); color: #fff; border-radius: var(--radius); font-weight: 500; font-size: .875rem; }
.cart-btn:hover { background: var(--primary-dk); text-decoration: none; color: #fff; }
.cart-badge { background: #fff; color: var(--primary); border-radius: 999px; font-size: .7rem; font-weight: 700; padding: .1rem .4rem; min-width: 1.25rem; text-align: center; }

/* ── Hero / Banner ────────────────────────────────────────── */
.fundraiser-banner { width: 100%; max-height: 340px; object-fit: cover; border-radius: 0; }
.fundraiser-info { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 1.5rem 1.25rem; }
.fundraiser-info-inner { max-width: 1100px; margin: 0 auto; }
.fundraiser-info h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.fundraiser-info p { color: var(--gray-600); max-width: 700px; }
.pickup-details { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.pickup-detail { font-size: .875rem; color: var(--gray-600); display: flex; align-items: center; gap: .35rem; }
.pickup-detail strong { color: var(--gray-900); }

/* ── Category tabs ────────────────────────────────────────── */
.category-tabs { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 57px; z-index: 90; }
.category-tabs-inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.category-tabs-inner::-webkit-scrollbar { display: none; }
.cat-tab { padding: .85rem 1.25rem; font-size: .875rem; font-weight: 500; color: var(--gray-600); border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; transition: color .15s, border-color .15s; }
.cat-tab:hover { color: var(--primary); text-decoration: none; }
.cat-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Product grid ─────────────────────────────────────────── */
.products-main { padding: 2rem 0; }
.category-section { margin-bottom: 2.5rem; }
.category-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--gray-200); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }

.product-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s; }
.product-card:hover { box-shadow: var(--shadow-md); }
.product-img { width: 100%; height: 180px; object-fit: cover; background: var(--gray-100); }
.product-img-placeholder { width: 100%; height: 180px; background: var(--gray-100); display: flex; align-items: center; justify-content: center; color: var(--gray-400); font-size: 3rem; }
.product-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.product-name { font-weight: 600; font-size: .95rem; margin-bottom: .25rem; }
.product-desc { font-size: .82rem; color: var(--gray-600); flex: 1; margin-bottom: .75rem; line-height: 1.45; }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.product-price { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.product-price .modifier { font-size: .75rem; color: var(--gray-600); font-weight: 400; }
.sold-out { font-size: .78rem; color: var(--danger); font-weight: 600; }
.low-stock { font-size: .78rem; color: var(--warning); font-weight: 600; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s; text-decoration: none; }
.btn:hover { opacity: .9; text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-outline  { background: #fff; border: 1px solid var(--gray-200); color: var(--gray-700); }
.btn-sm       { padding: .35rem .8rem; font-size: .8rem; }
.btn-lg       { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-block    { width: 100%; justify-content: center; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: flex-end; justify-content: center; padding: 0; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: #fff; border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; padding: 1.5rem; transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1); }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: var(--gray-100); border: none; border-radius: 50%; width: 2rem; height: 2rem; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { background: var(--gray-200); }
.option-group { margin-bottom: 1.25rem; }
.option-group-label { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
.option-group-label .required-mark { color: var(--danger); }
.option-group-hint { font-size: .78rem; color: var(--gray-600); margin-bottom: .5rem; }
.option-choices { display: flex; flex-direction: column; gap: .4rem; }
.option-choice { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border: 1.5px solid var(--gray-200); border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.option-choice:hover { border-color: var(--primary); background: #eff6ff; }
.option-choice input[type=radio]:checked + span,
.option-choice input[type=checkbox]:checked + span { font-weight: 600; }
.option-choice input[type=radio], .option-choice input[type=checkbox] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--primary); }
.option-choice:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.choice-price { margin-left: auto; font-size: .8rem; color: var(--success); font-weight: 600; }
.qty-row { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; }
.qty-row label { font-weight: 600; }
.qty-control { display: flex; align-items: center; gap: .5rem; }
.qty-btn { width: 2rem; height: 2rem; border: 1px solid var(--gray-200); border-radius: 50%; background: #fff; cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { background: var(--gray-100); }
.qty-input { width: 3rem; text-align: center; border: 1px solid var(--gray-200); border-radius: 6px; padding: .35rem .25rem; }
.modal-total { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-error { color: var(--danger); font-size: .875rem; margin-bottom: .75rem; display: none; }
.modal-error.show { display: block; }

/* ── Cart page ────────────────────────────────────────────── */
.cart-wrap { max-width: 800px; margin: 2rem auto; padding: 0 1.25rem; }
.cart-wrap h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
.cart-item { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: .75rem; display: flex; gap: 1rem; align-items: flex-start; }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; margin-bottom: .25rem; }
.cart-item-options { font-size: .8rem; color: var(--gray-600); line-height: 1.6; }
.cart-item-price { font-weight: 700; white-space: nowrap; }
.cart-qty { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.cart-qty input[type=number] { width: 3.5rem; border: 1px solid var(--gray-200); border-radius: 6px; padding: .3rem .4rem; text-align: center; }
.cart-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }
.cart-total-bar { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-top: 1rem; }
.cart-total-line { display: flex; justify-content: space-between; font-size: .875rem; margin-bottom: .35rem; color: var(--gray-600); }
.cart-total-line.total { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); border-top: 1px solid var(--gray-200); padding-top: .5rem; margin-top: .35rem; }

/* ── Checkout ─────────────────────────────────────────────── */
.checkout-wrap { max-width: 700px; margin: 2rem auto; padding: 0 1.25rem 3rem; }
.checkout-wrap h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
.checkout-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; margin-bottom: 1.25rem; }
.checkout-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; padding-bottom: .5rem; border-bottom: 1px solid var(--gray-200); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group-co { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-group-co label { font-size: .875rem; font-weight: 500; }
.form-group-co .form-control { border: 1px solid var(--gray-200); border-radius: 8px; padding: .55rem .85rem; font-size: .9rem; width: 100%; }
.form-group-co .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.order-summary-line { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--gray-100); font-size: .875rem; }
.order-summary-line:last-child { border-bottom: none; }
.order-summary-line .name { color: var(--gray-700); }
.order-summary-line .opts { font-size: .75rem; color: var(--gray-500); }
.order-total-line { display: flex; justify-content: space-between; padding: .75rem 0 0; font-size: 1.1rem; font-weight: 700; }
.payment-sim { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 1rem; font-size: .875rem; color: #1d4ed8; margin-bottom: 1rem; }

/* ── Confirmation ─────────────────────────────────────────── */
.confirm-wrap { max-width: 600px; margin: 2rem auto; padding: 0 1.25rem 3rem; text-align: center; }
.confirm-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.confirm-wrap h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .5rem; }
.confirm-wrap .subtitle { color: var(--gray-600); margin-bottom: 2rem; }
.confirm-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1rem; text-align: left; }
.confirm-order-num { font-size: 1.4rem; font-weight: 800; color: var(--primary); letter-spacing: .05em; }
.confirm-detail { font-size: .875rem; color: var(--gray-600); margin-top: .25rem; }

/* ── Store home ───────────────────────────────────────────── */
.home-hero { background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%); color: #fff; padding: 3.5rem 1.25rem; text-align: center; }
.home-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; }
.home-hero p { font-size: 1.1rem; opacity: .85; }
.fundraiser-cards { max-width: 1100px; margin: 2.5rem auto; padding: 0 1.25rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.fundraiser-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.fundraiser-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.fundraiser-card-img { width: 100%; height: 200px; object-fit: cover; background: var(--gray-200); }
.fundraiser-card-img-placeholder { height: 200px; background: linear-gradient(135deg, #dbeafe, #eff6ff); display: flex; align-items: center; justify-content: center; font-size: 4rem; }
.fundraiser-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.fundraiser-card-body h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; color: var(--gray-900); }
.fundraiser-card-body p { font-size: .85rem; color: var(--gray-600); flex: 1; margin-bottom: 1rem; }
.fundraiser-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--gray-500); border-top: 1px solid var(--gray-200); padding-top: .75rem; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: .85rem 1.1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .875rem; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* ── Footer ───────────────────────────────────────────────── */
.store-footer { border-top: 1px solid var(--gray-200); padding: 2rem 1.25rem; text-align: center; font-size: .8rem; color: var(--gray-400); margin-top: 3rem; }

/* ── Pickup screen ────────────────────────────────────────── */
.pickup-layout { min-height: 100vh; background: var(--gray-100); }
.pickup-header { background: var(--gray-900); color: #fff; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.pickup-header h1 { font-size: 1.2rem; font-weight: 700; }
.pickup-content { max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem; }
.pickup-search { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.pickup-search h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.pickup-search-row { display: flex; gap: .75rem; }
.pickup-search-row input { flex: 1; border: 2px solid var(--gray-200); border-radius: 8px; padding: .65rem 1rem; font-size: 1rem; }
.pickup-search-row input:focus { outline: none; border-color: var(--primary); }
.pickup-search-row button { padding: .65rem 1.5rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.pickup-result { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pickup-result-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.pickup-order-num { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.pickup-customer { font-size: 1rem; font-weight: 600; }
.pickup-customer-meta { font-size: .85rem; color: var(--gray-600); }
.pickup-items { padding: 1.25rem 1.5rem; }
.pickup-item { padding: .75rem 0; border-bottom: 1px solid var(--gray-100); }
.pickup-item:last-child { border-bottom: none; }
.pickup-item-name { font-weight: 600; font-size: 1rem; }
.pickup-item-qty { font-size: .875rem; color: var(--gray-600); }
.pickup-item-opts { font-size: .875rem; color: var(--gray-600); margin-top: .2rem; }
.pickup-btn-wrap { padding: 1.25rem 1.5rem; border-top: 1px solid var(--gray-200); }
.pickup-btn { width: 100%; padding: 1.1rem; font-size: 1.1rem; font-weight: 700; border: none; border-radius: 10px; cursor: pointer; }
.pickup-btn.mark  { background: var(--success); color: #fff; }
.pickup-btn.unmark { background: var(--gray-400); color: #fff; }
.pickup-already { background: #fef3c7; border: 2px solid #fde68a; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; font-weight: 600; color: #b45309; font-size: 1rem; }
.pickup-badge-picked { background: #dcfce7; color: #15803d; padding: .3rem .75rem; border-radius: 999px; font-weight: 700; font-size: .875rem; }
.pickup-badge-pending { background: #fef3c7; color: #b45309; padding: .3rem .75rem; border-radius: 999px; font-weight: 700; font-size: .875rem; }
.pickup-results-list { display: flex; flex-direction: column; gap: .5rem; }
.pickup-result-row { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: .85rem 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.pickup-result-row:hover { background: var(--gray-50); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
  .home-hero h1 { font-size: 1.5rem; }
  .form-row { grid-template-columns: 1fr; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; }
  .cart-item { flex-direction: column; }
  .pickup-search-row { flex-direction: column; }
  .pickup-result-header { flex-direction: column; }
}
@media (max-width: 400px) {
  .product-grid { grid-template-columns: 1fr; }
}
