/* ============================================================
   MOLEDET BAKERY — Cart & Checkout Styles
   ============================================================ */

/* ─── QTY SELECTOR ────────────────────────────────────────── */
.qty-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--sage-light);
  background: var(--bg);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background 180ms, border-color 180ms, color 180ms;
  user-select: none;
}

.qty-btn--plus {
  border-color: var(--gold);
  color: var(--gold);
}

.qty-btn--plus:hover {
  background: var(--gold-light);
  border-color: var(--gold-dark);
}

.qty-btn--minus:hover:not(:disabled) {
  background: var(--sage-light);
  border-color: var(--sage);
}

.qty-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.qty-val {
  font-size: 18px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  color: var(--text);
}

/* ─── PRODUCT CARD — active (has items in cart) ───────────── */
.product-card--active {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px rgba(104,122,99,.30), var(--shadow-sm) !important;
}

/* ─── CART BAR (fixed bottom) ─────────────────────────────── */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--text);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transform: translateY(110%);
  transition: transform 320ms cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -4px 28px rgba(30,26,20,.22);
  safe-area-inset-bottom: env(safe-area-inset-bottom);
}

.cart-bar--on {
  transform: translateY(0);
}

.cart-bar__info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-bar__count {
  font-size: 14px;
  color: rgba(255,255,255,.6);
}

.cart-bar__total {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -.01em;
}

.cart-bar__open {
  padding: 12px 28px;
  font-size: 15px;
  white-space: nowrap;
}

/* ─── CHECKOUT BACKDROP ───────────────────────────────────── */
.co-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(30,26,20,.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 300ms ease;
}

.co-backdrop--on { opacity: 1; }

/* ─── CHECKOUT MODAL (side panel) ─────────────────────────── */
.co-modal {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 900;
  width: min(520px, 100vw);
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
}

.co-modal--open { transform: translateX(0); }

.co-modal__header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--sage-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.co-modal__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.co-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 180ms;
  flex-shrink: 0;
}

.co-close-btn:hover { background: var(--sage-light); }

.co-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1;
}

/* ─── SECTION ─────────────────────────────────────────────── */
.co-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.co-section__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--sage-dark);
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sage-light);
}

/* ─── ITEMS LIST ──────────────────────────────────────────── */
.co-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.co-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(161,173,157,.12);
}

.co-item__img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  order: -1;
}

.co-item__name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  min-width: 0;
}

.co-item__qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.co-qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--sage-light);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background 150ms, border-color 150ms;
  padding: 0;
}
.co-qty-btn--plus { border-color: var(--gold); color: var(--gold); }
.co-qty-btn--plus:hover { background: var(--gold-light); }
.co-qty-btn--minus:hover { background: var(--sage-pale); }

.co-item__qty-val {
  font-size: 14px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  color: var(--text);
}

.co-item__price {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
  min-width: 48px;
  text-align: left;
}

/* ─── DELIVERY OPTIONS ────────────────────────────────────── */
.co-delivery-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.co-radio-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 2px solid rgba(161,173,157,.18);
  cursor: pointer;
  transition: border-color 200ms, background 200ms;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.co-radio-label:has(input:checked) {
  border-color: var(--gold);
  background: var(--gold-light);
}

.co-radio-label input[type="radio"] {
  accent-color: var(--gold);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.co-addr-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--sage-light);
}

.co-addr-row {
  display: flex;
  gap: 8px;
}

.co-addr-input { flex: 1; }

.co-addr-feedback {
  font-size: 13px;
  line-height: 1.55;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  display: none;
  white-space: pre-line;
}

.co-addr-feedback--loading,
.co-addr-feedback--success,
.co-addr-feedback--error { display: block; }

.co-addr-feedback--loading { background: var(--sage-pale);   color: var(--sage-dark); }
.co-addr-feedback--success { background: #f0fdf4;            color: #166534; }
.co-addr-feedback--error   { background: #fef2f2;            color: #991b1b; }

/* ─── DATETIME ────────────────────────────────────────────── */
.co-datetime-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-card);
  border: 2px solid rgba(161,173,157,.2);
  border-radius: var(--radius-sm);
  direction: ltr;
  text-align: right;
  transition: border-color 200ms;
}

.co-datetime-input:focus {
  border-color: var(--sage);
  outline: none;
  box-shadow: 0 0 0 4px rgba(161,173,157,.12);
}

.co-hint {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.5;
}

.co-field-err {
  font-size: 12px;
  color: #dc2626;
  margin-top: 2px;
  display: none;
}

/* ─── CONTACT FIELDS ──────────────────────────────────────── */
.co-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ─── TOTALS ──────────────────────────────────────────────── */
.co-totals {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(161,173,157,.14);
  overflow: hidden;
}

.co-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--sage-light);
}

.co-totals__row:last-child {
  border-bottom: none;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  background: var(--gold-light);
}

.co-totals__row span:last-child { color: var(--gold); font-weight: 700; }
.co-totals__row:last-child span:last-child { font-size: 22px; }

/* ─── CANCELLATION POLICY ─────────────────────────────────── */
.co-policy {
  background: var(--sage-pale);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

.co-policy__title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 13px;
}

/* ─── SUBMIT ──────────────────────────────────────────────── */
.co-submit { padding: 17px; font-size: 17px; }

/* ─── SUCCESS STATE ───────────────────────────────────────── */
.co-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 52px 28px;
  gap: 14px;
}

.co-success__icon {
  width: 72px;
  height: 72px;
  background: #f0fdf4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #16a34a;
}

.co-success__title { font-size: 24px; font-weight: 900; color: var(--text); }
.co-success__detail { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.co-success__total { font-size: 18px; font-weight: 700; color: var(--gold); }
.co-success__note { font-size: 13px; color: var(--text-light); max-width: 320px; line-height: 1.6; }

/* ─── DATE PICKER ─────────────────────────────────────────── */
.date-picker {
  background: var(--bg-card);
  border: 1.5px solid var(--sage-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  user-select: none;
}

.date-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--sage-pale);
  border-bottom: 1px solid var(--sage-light);
}

.date-picker__nav {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms;
  flex-shrink: 0;
}
.date-picker__nav:hover:not(:disabled) { background: var(--sage-light); }
.date-picker__nav:disabled { opacity: .3; cursor: not-allowed; }

.date-picker__month {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  flex: 1;
}

.date-picker__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 10px 4px;
}
.date-picker__weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  padding: 2px 0;
}

.date-picker__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 4px 10px 12px;
}

.dp-empty { /* blank cell */ }

.dp-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 140ms, color 140ms;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.dp-day:hover:not(:disabled) {
  background: var(--sage-pale);
  color: var(--gold-dark);
}
.dp-day--off {
  color: #CBD5CF;
  cursor: not-allowed;
  font-weight: 400;
}
.dp-day--sel {
  background: var(--gold) !important;
  color: #fff !important;
  font-weight: 700;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .co-modal { width: 100vw; }
  .co-contact-grid { grid-template-columns: 1fr; }
  .co-addr-row { flex-direction: column; }
  .cart-bar { padding: 12px 16px; }
}
