/* Buff Customer Website - Brand Styles */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface2: #F5F6FA;
  --surface3: #EBEEF7;
  --border: #E2E5EE;
  --border-light: #EEF0F6;
  --espresso: #0A0E2A;
  --dark-roast: #1A1F3D;
  --medium: #2D4DE0;
  --crema: #FFF8E1;
  --caramel: #2D4DE0;
  --gold: #F5C548;
  --text: #0A0E2A;
  --text2: #4A5170;
  --text3: #6B7290;
  --text4: #A0A6BC;
  --green: #3D7A4A;
  --danger: #B84040;
  --dot-hot: #E0703D;
  --dot-cold: #2D4DE0;
  --dot-blended: #8B5AD4;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Archivo Black', 'Inter', Georgia, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 50px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

/* --- Header --- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border-light);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  /* Source PNG is yellow on transparent — tint to brand blue on the white header */
  filter: brightness(0) saturate(100%) invert(20%) sepia(89%) saturate(2680%) hue-rotate(228deg) brightness(94%) contrast(96%);
}
.brand-name {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--caramel);
  letter-spacing: -0.5px;
}
.brand-tag {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.cart-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--espresso);
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.cart-btn:hover { background: var(--surface2); }

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  background: var(--caramel);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* --- Main Content --- */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* --- Category Tabs --- */

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.cat-pill {
  flex-shrink: 0;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(0,0,0,0.1);
  background: var(--surface);
  color: var(--text4);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s;
}
.cat-pill.active {
  background: var(--espresso);
  border-color: var(--espresso);
  color: white;
}
.cat-pill:not(.active):hover {
  border-color: var(--text4);
  color: var(--text2);
}

/* --- Product Grid --- */

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

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

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(28,20,16,0.06);
  border-color: var(--border);
}

.product-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-img-wrap img {
  width: 75%;
  height: 75%;
  object-fit: contain;
}

.temp-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.temp-hot { background: var(--dot-hot); }
.temp-cold { background: var(--dot-cold); }
.temp-blended { background: var(--dot-blended); }

.product-info {
  padding: 12px 14px 14px;
}
.product-name {
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--espresso);
  line-height: 1.3;
}
.product-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--caramel);
  margin-top: 4px;
}

/* --- Customize Modal --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.modal-overlay.open { pointer-events: auto; opacity: 1; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal-sheet {
    border-radius: var(--radius);
    max-height: 85vh;
    transform: translateY(20px) scale(0.97);
  }
  .modal-overlay.open .modal-sheet { transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 0;
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--espresso);
}
.modal-desc {
  font-size: 13px;
  color: var(--text3);
  margin-top: 4px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text3);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 24px; }

/* Option Groups */

.option-group { margin-bottom: 20px; }
.option-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}

.option-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.option-btn {
  flex: 1;
  min-width: 80px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: var(--font-body);
}
.option-btn.small { min-width: 64px; flex: 0 1 auto; padding: 10px 14px; }
.option-btn.selected {
  border-color: var(--espresso);
  background: var(--espresso);
  color: white;
}
.option-btn:not(.selected):hover { border-color: var(--text4); }

.option-btn-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.option-btn.selected .option-btn-label { color: white; }

.option-btn-sub {
  display: block;
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}
.option-btn.selected .option-btn-sub { color: rgba(255,255,255,0.7); }

/* Quantity */

.qty-row {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.qty-row.small { gap: 10px; padding: 2px 6px; }

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
  font-family: var(--font-body);
}
.qty-row.small .qty-btn { width: 28px; height: 28px; font-size: 14px; }
.qty-btn:hover { background: var(--surface3); }

.qty-val {
  font-size: 15px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}
.qty-row.small .qty-val { font-size: 13px; }

/* --- Buttons --- */

.btn-primary {
  background: var(--espresso);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: 0.3px;
}
.btn-primary:hover { background: var(--dark-roast); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-full { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 15px; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}
.btn-back:hover { color: var(--text); }

.btn-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-remove:hover { text-decoration: underline; }

/* --- Cart Panel --- */

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 380px;
  height: 100dvh;
  background: var(--surface);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}
.cart-panel.open { transform: translateX(0); }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1.5px solid var(--border-light);
}
.cart-title {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--espresso);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.cart-empty p:first-child { font-size: 15px; font-weight: 600; }
.cart-empty-sub { font-size: 13px; margin-top: 6px; }

.cart-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}
.cart-item:last-child { border-bottom: none; }

.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--caramel);
  flex-shrink: 0;
  margin-left: 12px;
}
.cart-item-addons {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}
.cart-item-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.cart-footer {
  border-top: 1.5px solid var(--border-light);
  padding: 16px 24px 24px;
}

.cart-totals { margin-bottom: 16px; }
.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text2);
  padding: 4px 0;
}
.total-row.total-final {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border-light);
}

/* --- Checkout --- */

.checkout-container {
  max-width: 560px;
  margin: 0 auto;
}

.checkout-header { margin-bottom: 28px; }

.checkout-title {
  font-family: var(--font-heading);
  font-size: 28px;
  color: var(--espresso);
  margin-top: 16px;
}

.checkout-section { margin-bottom: 32px; }

.section-title {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--espresso);
  margin-bottom: 14px;
}

.form-group { margin-bottom: 12px; }
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s;
  outline: none;
}
.form-input::placeholder { color: var(--text4); }
.form-input:focus { border-color: var(--caramel); }

.pickup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pickup-btn {
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
}
.pickup-btn.selected {
  background: var(--espresso);
  border-color: var(--espresso);
  color: white;
}
.pickup-btn:not(.selected):hover { border-color: var(--text4); }

.custom-time-wrap {
  margin-top: 12px;
}
.time-input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  width: 100%;
}
.time-input:focus { border-color: var(--caramel); }

.checkout-items {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 4px 16px;
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.checkout-item:last-child { border-bottom: none; }

.checkout-item-left { display: flex; gap: 10px; align-items: flex-start; }
.checkout-item-qty {
  font-size: 13px;
  font-weight: 700;
  color: var(--caramel);
  flex-shrink: 0;
}
.checkout-item-name { font-size: 13px; font-weight: 600; }
.checkout-item-addons { font-size: 11px; color: var(--text3); margin-top: 2px; }
.checkout-item-price { font-size: 13px; font-weight: 700; color: var(--text); flex-shrink: 0; }

.checkout-totals {
  margin-top: 16px;
}

.checkout-errors {
  background: rgba(184,64,64,0.06);
  border: 1px solid rgba(184,64,64,0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.checkout-errors p {
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 4px;
}
.checkout-errors p:last-child { margin-bottom: 0; }

.checkout-note {
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  margin-top: 12px;
}

/* --- Confirmation --- */

.confirm-container {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  padding-top: 40px;
}

.confirm-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(61,122,74,0.1);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.confirm-title {
  font-family: var(--font-heading);
  font-size: 28px;
  color: var(--espresso);
}

.confirm-order-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text3);
  margin-top: 8px;
}

.confirm-pickup {
  background: var(--crema);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}
.confirm-pickup-label { font-size: 12px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.confirm-pickup-time {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--espresso);
  margin-top: 4px;
}
.confirm-pickup-note { font-size: 13px; color: var(--text2); margin-top: 6px; }

.confirm-summary {
  text-align: left;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin-bottom: 28px;
}

.confirm-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.confirm-item:last-child { border-bottom: none; }

.confirm-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 700;
  border-top: 1px solid var(--border-light);
}

/* --- Toast --- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--espresso);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Responsive --- */

@media (max-width: 480px) {
  .header-inner { padding: 12px 16px; }
  .brand-tag { display: none; }
  .main-content { padding: 16px 16px 80px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-info { padding: 10px 12px 12px; }
  .product-name { font-size: 13px; }
  .modal-sheet { max-height: 92dvh; }
  .checkout-title { font-size: 24px; }
}

/* ═══════════════════════════════════════════
   STORE SELECTION MODAL
   ═══════════════════════════════════════════ */

.store-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.store-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.store-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 20, 16, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.store-modal-card {
  position: relative;
  width: 92%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 24px;
  padding: 40px 28px 32px;
  text-align: center;
  box-shadow:
    0 24px 80px rgba(28, 20, 16, 0.2),
    0 8px 24px rgba(28, 20, 16, 0.1);
  transform: scale(0.92) translateY(20px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.store-modal.open .store-modal-card {
  transform: scale(1) translateY(0);
}

.store-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--crema);
  color: var(--caramel);
  margin-bottom: 20px;
}

.store-modal-title {
  font-family: var(--font-heading);
  font-size: 24px;
  color: var(--espresso);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.store-modal-subtitle {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text3);
  margin-bottom: 28px;
  font-weight: 500;
}

.store-modal-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border-light);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  font-family: var(--font-body);
}

.store-option:hover {
  border-color: var(--caramel);
  background: var(--crema);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(184, 149, 106, 0.15);
}

.store-option:active {
  transform: scale(0.98);
}

.store-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--crema);
  color: var(--caramel);
  flex-shrink: 0;
}

.store-option:hover .store-option-icon {
  background: rgba(184, 149, 106, 0.2);
}

.store-option-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.store-option-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--espresso);
}

.store-option-tag {
  font-size: 11px;
  color: var(--text4);
  font-weight: 500;
  margin-top: 1px;
}

.store-option-arrow {
  color: var(--text4);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.store-option:hover .store-option-arrow {
  color: var(--caramel);
  transform: translateX(3px);
}

/* Header branch label + change button */

.brand-dot {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--text4);
  margin: 0 2px;
}

.brand-branch {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--caramel);
  letter-spacing: -0.3px;
}

.change-store-btn {
  margin-left: 10px;
  padding: 3px 10px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.change-store-btn:hover {
  color: var(--caramel);
  border-color: var(--caramel);
  background: var(--crema);
}
