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

:root {
  --primary: #1a4d9e;
  --primary-dark: #0d2d5e;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --text: #1a1a1a;
  --text-light: #666;
  --bg: #f5f5f5;
  --bg-2: #e8e8e8;
  --white: #ffffff;
  --border: #d0d0d0;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shop-header {
  background: var(--primary);
  color: var(--white);
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.shop-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.shop-subtitle {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

.shop-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px;
}

.pickup-note {
  font-size: 13px;
  color: var(--text-light);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.pickup-banner {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-dark);
  background: #fff4d6;
  border: 1px solid var(--warning);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  text-align: center;
}

.view {
  display: block;
}

.loading-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
  gap: 12px;
  text-align: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Catalog */
.catalog {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.style-group {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.style-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.style-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-media .placeholder {
  font-size: 40px;
  font-weight: 800;
  color: var(--border);
}

.style-body {
  padding: 14px 14px 16px;
}

.style-name {
  font-size: 17px;
  font-weight: 700;
}

.style-color {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.style-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.variant-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.variant-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--bg-2);
  border: 2px dashed var(--border);
  border-radius: 10px;
}

.tap-to-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.tap-to-pay-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.reader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
}

.reader-bar button {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.variant-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}

.variant-btn:active {
  transform: scale(0.97);
}

.variant-size {
  font-weight: 700;
  font-size: 14px;
}

.variant-price {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
}

.variant-btn.sold-out {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.variant-sold-out-label {
  font-size: 10px;
  color: var(--error);
  font-weight: 700;
  text-transform: uppercase;
}

.variant-low-stock {
  font-size: 10px;
  color: var(--warning);
  font-weight: 700;
}

/* Checkout bottom sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.sheet {
  background: var(--white);
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px 24px;
  max-height: 88vh;
  overflow-y: auto;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 6px auto 14px;
}

.checkout-summary {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
}

.checkout-summary strong {
  font-size: 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin: 12px 0 4px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
}

.field-input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-radius: 8px;
  font-size: 13px;
}

/* Buttons */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-block {
  width: 100%;
  margin-top: 10px;
}

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

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

.btn-secondary {
  background: var(--bg-2);
  color: var(--text);
}

.btn-text {
  background: none;
  color: var(--text-light);
  font-weight: 500;
}

/* Status views (waiting / success / expired) */
.status-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  max-width: 440px;
  margin: 40px auto 0;
}

.status-card h2 {
  font-size: 20px;
  margin: 12px 0 8px;
}

.status-message {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.5;
  margin-top: 6px;
}

.status-reassurance {
  font-size: 12px;
  color: var(--warning);
  margin-top: 10px;
}

.success-big {
  color: var(--success);
  font-size: 56px;
  animation: scaleIn 0.4s ease-out;
}

.error-big {
  color: var(--error);
  font-size: 48px;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.92);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  max-width: 90%;
  text-align: center;
  z-index: 2000;
}

@media (min-width: 600px) {
  .catalog {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .shop-main {
    max-width: 1080px;
  }

  /* Centered modal instead of a bottom sheet once there's room for it. */
  .sheet-overlay {
    align-items: center;
    padding: 24px;
  }

  .sheet {
    border-radius: 20px;
    max-width: 440px;
    max-height: 85vh;
  }

  .sheet-handle {
    display: none;
  }
}

@media (min-width: 900px) {
  .shop-main {
    max-width: 1280px;
  }

  .catalog {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tax-caption {
  display: block;
  font-size: 10px;
  color: var(--text-light, #888);
  font-weight: 500;
  margin-top: 1px;
}

/* Cart */
.qty-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.qty-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.qty-value {
  min-width: 16px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 900;
  font-size: 14px;
  font-weight: 600;
}

.cart-bar .btn {
  padding: 10px 20px;
  font-size: 14px;
}

.cart-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 4px;
}

.clear-cart-btn {
  background: none;
  border: none;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}

.cart-lines {
  margin-bottom: 4px;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.cart-line:last-child {
  border-bottom: none;
}

.cart-line-label {
  flex: 1;
  min-width: 0;
}

.cart-line-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cart-line-price {
  font-weight: 700;
  min-width: 52px;
  text-align: right;
}

.cart-line-remove {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}

.cart-line-remove:active {
  color: var(--error);
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding: 2px 0;
}

.totals-row-final {
  font-size: 16px;
  font-weight: 800;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}

/* Donations */
.donation-section {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.donation-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.donation-optional {
  font-weight: 500;
  color: var(--text-light);
}

.donation-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.donation-pill {
  flex: 1;
  min-width: 64px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.donation-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.donation-custom-input {
  margin-top: 10px;
}

.donation-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}

.donation-remove {
  background: none;
  border: none;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Success screen */
.success-ref {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.success-items {
  text-align: left;
  margin: 14px 0 6px;
  font-size: 14px;
}

.success-item-row {
  padding: 3px 0;
}

.success-totals {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  text-align: left;
}
