/* ================================================================
   CHECKOUT MODAL — Fastrr-Style 3-Step Popup
   Desktop: centered modal (480px)  |  Mobile: full-screen
   ================================================================ */

/* ── Overlay ── */
.cm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 4000;
  opacity: 0;
  transition: opacity .3s ease;
}
.cm-overlay.visible { opacity: 1 }

/* ── Modal Shell ── */
.cm-modal {
  position: fixed;
  z-index: 4001;
  background: #fff;
  display: none;
  flex-direction: column;
  font-family: 'DM Sans', sans-serif;
  overflow: hidden;
  /* Desktop */
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  width: 460px; max-width: 94vw;
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.22);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
}
.cm-modal.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ── Mobile: full-screen ── */
@media (max-width: 600px) {
  .cm-modal {
    top: 0; left: 0; right: 0; bottom: 0;
    transform: translateY(100%);
    width: 100%; max-width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }
  .cm-modal.visible {
    transform: translateY(0);
  }
}

/* ── Header ── */
.cm-header {
  background: #b4021e;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.cm-header-left {
  display: flex; align-items: center; gap: 10px;
}
.cm-brand-logo {
  height: 32px; width: auto;
}
.cm-header-title {
  color: #fff; font-size: 15px; font-weight: 700;
}
.cm-close-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.15);
  cursor: pointer; font-size: 16px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.cm-close-btn:hover { background: rgba(255,255,255,.3) }
.cm-back-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 8px;
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.cm-back-btn:hover { background: rgba(255,255,255,.3) }

/* ── Announcement Bar ── */
.cm-announce {
  background: #b4021e; color: #fff;
  text-align: center; padding: 0 12px 10px;
  font-size: 11px; font-weight: 500;
}
.cm-announce span {
  display: inline-block;
  background: rgba(255,255,255,.12);
  padding: 4px 12px; border-radius: 4px;
}

/* ── Step Progress ── */
.cm-steps-bar {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 16px 8px; gap: 8px; flex-shrink: 0;
  background: #fdfaf5;
}
.cm-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #e0d6c6; background: #fff;
  font-size: 12px; font-weight: 700; color: #aaa;
  display: flex; align-items: center; justify-content: center;
  transition: all .3s ease;
}
.cm-step-dot.active {
  border-color: #b4021e; background: #b4021e; color: #fff;
}
.cm-step-dot.done {
  border-color: #2e7d32; background: #2e7d32; color: #fff;
  cursor: pointer;
}
.cm-step-line {
  flex: 1; height: 2px; background: #e0d6c6;
  max-width: 40px; transition: background .3s ease;
}
.cm-step-line.done { background: #2e7d32 }

/* ── Scrollable Body ── */
.cm-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── Step Panels ── */
.cm-step {
  display: none; padding: 0;
  animation: cmFadeIn .25s ease;
}
.cm-step.active { display: block }
@keyframes cmFadeIn {
  from { opacity: 0; transform: translateX(10px) }
  to   { opacity: 1; transform: translateX(0) }
}

/* ── Collapsible Order Summary ── */
.cm-summary-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer;
  background: #fdfaf5; border: none; width: 100%;
  font-family: inherit; font-size: 14px;
  color: #3a1a00; font-weight: 600;
  border-bottom: 1px solid #f0e8d8;
}
.cm-summary-toggle:hover { background: #f8f3ec }
.cm-summary-right {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; color: #b4021e; font-size: 15px;
}
.cm-summary-arrow {
  font-size: 11px; color: #888;
  transition: transform .25s ease;
}
.cm-summary-arrow.open { transform: rotate(180deg) }
.cm-summary-body {
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
  background: #fff;
}
.cm-summary-body.open { max-height: 500px }
.cm-summary-inner { padding: 10px 16px }

/* ── Summary Items ── */
.cm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid #f8f3ec;
}
.cm-item:last-child { border-bottom: none }
.cm-item-img {
  width: 40px; height: 40px; border-radius: 8px;
  background: #f4ede0; overflow: hidden; flex-shrink: 0;
}
.cm-item-img img { width: 100%; height: 100%; object-fit: cover }
.cm-item-info { flex: 1; min-width: 0 }
.cm-item-name {
  font-size: 12px; font-weight: 600; color: #2a1200;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cm-item-meta { font-size: 11px; color: #888; margin-top: 1px }
.cm-item-price {
  font-size: 13px; font-weight: 700; color: #b4021e;
  white-space: nowrap;
}

/* ── Qty Stepper (inside summary) ── */
.cm-qty-row {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.cm-qty-btn {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1.5px solid #e0d0c0; background: #fff;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #555; font-weight: 600; line-height: 1;
  flex-shrink: 0; transition: border-color .2s;
}
.cm-qty-btn:hover { border-color: #b4021e; color: #b4021e }
.cm-qty-val {
  font-weight: 700; font-size: 13px; min-width: 18px; text-align: center;
}
.cm-remove-btn {
  background: none; border: none; cursor: pointer;
  color: #ddd; font-size: 14px; padding: 2px;
  transition: color .2s; line-height: 1;
}
.cm-remove-btn:hover { color: #b4021e }

.cm-summary-totals { padding-top: 8px; border-top: 1px dashed #e0d6c6 }
.cm-srow {
  display: flex; justify-content: space-between;
  font-size: 12px; color: #555; margin-bottom: 4px;
}
.cm-srow.total {
  font-size: 15px; font-weight: 700; color: #2a1200;
  margin-top: 4px; padding-top: 6px; border-top: 1px solid #f0e8d8;
}

/* ── Coupon Code ── */
.cm-coupon-row {
  display: flex; gap: 8px; padding: 10px 16px;
  background: #fff; border-bottom: 1px solid #f0e8d8;
}
.cm-coupon-input {
  flex: 1; padding: 9px 12px; border: 1.5px solid #e0d6c6;
  border-radius: 8px; font-family: inherit; font-size: 13px;
  color: #2a1200; background: #fdfaf5; outline: none;
  transition: border-color .2s;
}
.cm-coupon-input:focus { border-color: #b4021e }
.cm-coupon-input::placeholder { color: #bbb }
.cm-coupon-btn {
  padding: 9px 16px; background: #2a1200; color: #fff;
  border: none; border-radius: 8px; font-family: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .2s;
}
.cm-coupon-btn:hover { background: #1a0a00 }

/* ── Trust Badges ── */
.cm-trust {
  display: flex; justify-content: center; gap: 16px;
  padding: 10px 16px; flex-wrap: wrap;
}
.cm-trust-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  font-size: 9px; color: #888; font-weight: 500;
  text-align: center;
}
.cm-trust-icon { font-size: 18px }

/* ── Form Styles (Shared) ── */
.cm-form-section { padding: 14px 16px }
.cm-stitle {
  font-family: 'Playfair Display', serif;
  font-size: 16px; color: #3a1a00;
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid #f0e8d8;
}

.cm-field { display: flex; flex-direction: column; margin-bottom: 10px }
.cm-field label {
  font-size: 11px; font-weight: 600; color: #555;
  margin-bottom: 3px; text-transform: uppercase; letter-spacing: .5px;
}
.cm-field label .req { color: #b4021e }

.cm-field input, .cm-field select, .cm-field textarea {
  padding: 10px 12px; border: 1.5px solid #e0d6c6;
  border-radius: 8px; font-family: inherit; font-size: 14px;
  color: #2a1200; background: #fdfaf5;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.cm-field input:focus, .cm-field select:focus, .cm-field textarea:focus {
  border-color: #b4021e;
  box-shadow: 0 0 0 3px rgba(180,2,30,.08);
}
.cm-field input.invalid { border-color: #d32f2f; background: #fff5f5 }
.cm-field .cm-field-error {
  font-size: 10px; color: #d32f2f; margin-top: 2px; display: none;
}

.cm-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.cm-form-row .cm-field { margin-bottom: 0 }

/* Phone input with +91 prefix */
.cm-phone-wrap {
  display: flex; align-items: stretch;
  border: 1.5px solid #e0d6c6; border-radius: 8px;
  background: #fdfaf5; overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.cm-phone-wrap:focus-within {
  border-color: #b4021e;
  box-shadow: 0 0 0 3px rgba(180,2,30,.08);
}
.cm-phone-wrap.invalid { border-color: #d32f2f; background: #fff5f5 }
.cm-phone-prefix {
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px; background: #f8f3ec;
  font-size: 13px; font-weight: 600; color: #555;
  border-right: 1.5px solid #e0d6c6; flex-shrink: 0;
  user-select: none;
}
.cm-phone-prefix img { width: 16px; height: 12px; object-fit: cover; border-radius: 2px }
.cm-phone-wrap input {
  border: none !important; background: transparent !important;
  box-shadow: none !important; flex: 1; padding: 10px 12px;
  font-family: inherit; font-size: 14px; color: #2a1200; outline: none;
}

/* ── Address Type Pills ── */
.cm-addr-type-row {
  display: flex; gap: 8px; margin-top: 6px;
}
.cm-addr-type {
  padding: 7px 16px; border: 1.5px solid #e0d6c6;
  border-radius: 20px; background: #fff;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: #555; cursor: pointer; transition: all .2s;
}
.cm-addr-type.selected {
  border-color: #b4021e; background: #fef0f2; color: #b4021e;
}
.cm-addr-type:hover { border-color: #b4021e }

/* ── Expandable Landmark Toggle ── */
.cm-landmark-toggle { padding: 0 0 4px; margin-top: -4px }
.cm-landmark-add {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: #b4021e; padding: 4px 0;
  transition: color .2s;
}
.cm-landmark-add:hover { color: #8b011a; text-decoration: underline }

/* ── Serviceability Message ── */
.cm-serv-msg {
  font-size: 11px; margin-top: 4px;
  font-weight: 500; display: none;
}

/* ── City Post-Office Dropdown ── */
.cm-city-dropdown {
  margin-top: 4px; padding: 4px 0;
  background: #fdfaf5; border: 1.5px solid #e0d6c6;
  border-radius: 8px; max-height: 140px; overflow-y: auto;
}
.cm-city-opt {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px; border: none; background: none;
  font-family: inherit; font-size: 13px; color: #2a1200;
  cursor: pointer; transition: background .15s;
}
.cm-city-opt:hover { background: #f0e8d8 }

/* ── Upsell Carousel ── */
.cm-upsell {
  padding: 10px 16px 6px;
  border-bottom: 1px solid #f0e8d8;
}
.cm-upsell-title {
  font-size: 13px; font-weight: 700; color: #b4021e;
  margin-bottom: 8px;
}
.cm-upsell-scroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 6px;
}
.cm-upsell-scroll::-webkit-scrollbar { display: none }

.cm-upsell-card {
  flex: 0 0 110px; background: #fdfaf5;
  border-radius: 10px; border: 1px solid #f0e8d8;
  overflow: hidden; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.cm-upsell-card:hover {
  border-color: #b4021e;
  box-shadow: 0 2px 12px rgba(180,2,30,.08);
}
.cm-upsell-card img {
  width: 100%; height: 80px; object-fit: cover;
}
.cm-upsell-card-body { padding: 6px 8px }
.cm-upsell-card-name {
  font-size: 10px; font-weight: 600; color: #2a1200;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cm-upsell-card-price {
  font-size: 11px; font-weight: 700; color: #b4021e;
  margin-top: 2px;
}
.cm-upsell-add {
  display: block; width: 100%;
  padding: 5px; background: #b4021e; color: #fff;
  border: none; font-family: inherit;
  font-size: 10px; font-weight: 700;
  cursor: pointer; transition: background .2s;
}
.cm-upsell-add:hover { background: #8b011a }

/* ── Review Step — Delivery Summary ── */
.cm-review-card {
  background: #fdfaf5; border-radius: 10px;
  border: 1px solid #f0e8d8;
  padding: 12px 14px; margin-bottom: 10px;
}
.cm-review-label {
  font-size: 11px; font-weight: 600; color: #888;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 4px;
}
.cm-review-value {
  font-size: 13px; color: #2a1200; line-height: 1.5;
}
.cm-review-change {
  font-size: 12px; color: #b4021e; font-weight: 600;
  cursor: pointer; background: none; border: none;
  font-family: inherit; float: right; margin-top: -18px;
}
.cm-review-change:hover { text-decoration: underline }

.cm-payment-methods {
  display: flex; gap: 10px; padding: 0 16px 6px;
  flex-wrap: wrap;
}
.cm-pay-method {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1.5px solid #e0d6c6;
  border-radius: 8px; background: #fff;
  font-size: 12px; color: #555; font-weight: 500;
  cursor: default;
}
.cm-pay-method-icon { font-size: 18px }

/* ── Sticky Footer Button ── */
.cm-footer {
  border-top: 1px solid #f0e8d8;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: #fff; flex-shrink: 0;
}
.cm-footer-inner {
  display: flex; flex-direction: column; gap: 8px;
}
.cm-footer-total {
  display: flex; align-items: center; justify-content: space-between;
}
.cm-footer-total small { font-size: 12px; color: #555; font-weight: 500 }
.cm-footer-total strong { font-size: 18px; color: #b4021e; font-weight: 700 }

.cm-btn-primary {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; width: 100%;
  padding: 14px 20px; background: #b4021e; color: #fff;
  border-radius: 10px; font-weight: 700; font-size: 15px;
  border: none; cursor: pointer;
  transition: background .2s, transform .1s;
  font-family: inherit; letter-spacing: .3px;
}
.cm-btn-primary:hover { background: #8b011a }
.cm-btn-primary:active { transform: scale(.98) }
.cm-btn-primary:disabled { opacity: .55; cursor: not-allowed }

/* ── Exit Confirmation Dialog ── */
.cm-exit-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 4010;
  justify-content: center; align-items: center;
}
.cm-exit-overlay.visible { display: flex }

.cm-exit-dialog {
  background: #fff; border-radius: 14px;
  width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  overflow: hidden;
  animation: cmSlideUp .25s ease;
}
@keyframes cmSlideUp {
  from { transform: translateY(20px); opacity: 0 }
  to   { transform: translateY(0);    opacity: 1 }
}
.cm-exit-header {
  text-align: center; padding: 20px 20px 12px;
}
.cm-exit-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; color: #2a1200; margin: 0 0 8px;
}
.cm-exit-warning {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  background: #fff3e0; color: #e65100;
  font-size: 12px; font-weight: 600;
}
.cm-exit-actions { padding: 16px 20px; }
.cm-exit-btn {
  display: block; width: 100%;
  padding: 14px; border-radius: 8px;
  font-family: inherit; font-size: 14px;
  font-weight: 700; cursor: pointer;
  text-align: center; border: none;
  transition: background .2s;
  margin-bottom: 10px;
}
.cm-exit-btn:last-child { margin-bottom: 0 }
.cm-exit-btn.secondary {
  background: #fff; color: #555;
  border: 1.5px solid #e0d6c6;
}
.cm-exit-btn.secondary:hover { background: #f8f3ec }
.cm-exit-btn.primary {
  background: #2e7d32; color: #fff;
}
.cm-exit-btn.primary:hover { background: #1b5e20 }

/* ── Error Banner ── */
.cm-error-banner {
  display: none; background: #ffebee; color: #c62828;
  padding: 8px 16px; font-size: 12px;
  border-bottom: 1px solid #ef9a9a;
}

/* ── Loading Spinner ── */
.cm-spinner-wrap {
  display: none; text-align: center; padding: 40px 16px;
}
.cm-spinner {
  width: 36px; height: 36px; margin: 0 auto;
  border: 3px solid #f0e8d8; border-top-color: #b4021e;
  border-radius: 50%; animation: cmSpin .8s linear infinite;
}
@keyframes cmSpin { to { transform: rotate(360deg) } }
.cm-spinner-text {
  font-size: 13px; color: #555; margin-top: 10px;
}

/* ── T&C Footer Link ── */
.cm-tc-footer {
  text-align: center; font-size: 10px; color: #aaa;
  padding: 4px 16px 8px;
}
.cm-tc-footer a { color: #888; text-decoration: none }
.cm-tc-footer a:hover { text-decoration: underline }

/* ── Toggle Switch (iOS-style) ── */
.cm-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.cm-toggle-switch input {
  opacity: 0; width: 0; height: 0;
  position: absolute;
}
.cm-toggle-slider {
  position: absolute; inset: 0;
  background: #ccc; border-radius: 24px;
  transition: background .3s ease;
}
.cm-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.cm-toggle-switch input:checked + .cm-toggle-slider {
  background: #1565c0;
}
.cm-toggle-switch input:checked + .cm-toggle-slider::before {
  transform: translateX(20px);
}
