/* ============================================================================
 * CRAZYSTORE CHECKOUT — Webyansh-inspired layout (v1.0.3)
 * Two columns: form (left) + sticky order summary (right).
 * ============================================================================ */

/* === Custom Checkout Fullscreen Cleanup === */
.custom-checkout-page #page,
.custom-checkout-page header,
.custom-checkout-page footer,
.custom-checkout-page .site-header,
.custom-checkout-page .site-footer,
.custom-checkout-page .widget-area,
.custom-checkout-page .sidebar {
  display: none !important;
}

body.custom-checkout-page {
  background: #f5f5f5;
  margin: 0;
  padding: 0;
}

#custom-checkout-wrapper-machi {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#custom-checkout-wrapper-machi * {
  font-family: "Inter", sans-serif !important;
  box-sizing: border-box;
}

/* === LOGO === */
.machi_checkout-logo {
  text-align: center;
  padding: 24px 0 8px;
}
.machi_checkout-logo img {
  height: 56px;
  max-width: 180px;
  width: auto;
}

/* === MAIN GRID === */
.container-checkout {
  background: #fff;
  color: #333;
  line-height: 1.55;
  max-width: 1280px;
  margin: 16px auto;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.machi_left-section {
  padding: 40px 44px;
  background: #fff;
  border-right: 1px solid #eee;
}

.machi_right-section {
  padding: 32px 32px;
  background: #fafafa;
}

/* === BREADCRUMB STEPPER === */
.machi_checkout-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 24px;
  color: #999;
  flex-wrap: wrap;
}
.machi_step {
  color: #999;
  text-decoration: none;
  font-weight: 500;
}
.machi_step:hover { color: #ff0000; }
.machi_step-current {
  color: #111;
  font-weight: 700;
}
.machi_step-sep { color: #ccc; font-size: 16px; }

/* === TYPOGRAPHY === */
.machi_section-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #111;
}
.title-crazy { color: #000; font-size: 24px; margin-bottom: 8px; }
.machi_section-subtitle {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
}
.subtitle-crazy { font-weight: 600; }
.machi_section-required-fields {
  font-size: 12px;
  color: #888;
  margin-top: 12px;
}

.machi_block {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid #eee;
}
.machi_block:first-of-type {
  margin-top: 24px;
  padding-top: 0;
  border-top: none;
}

/* === FORMS === */
.machi_form-group { margin-bottom: 16px; }
.machi_form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #333;
}
.machi_form-input,
#departamento {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.machi_form-input:focus,
#departamento:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
#departamento {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 38px;
}
.machi_form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.machi_form-row-2 { grid-template-columns: 1fr 1fr; }

.invalid-input {
  border: 1px solid rgb(253, 74, 74) !important;
}
.machi_error {
  color: #e11;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

/* === SHIPPING METHOD CARDS === */
.machi_shipping-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.machi_shipping-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
}
.machi_shipping-card:hover { border-color: #bbb; }
.machi_shipping-card input[type="radio"] {
  accent-color: #ff0000;
  width: 16px;
  height: 16px;
  margin: 0;
}
.machi_shipping-card-selected {
  border-color: #ff0000;
  background: #fff7f7;
}
.machi_shipping-card-body { flex: 1; min-width: 0; }
.machi_shipping-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}
.machi_shipping-card-sub {
  font-size: 12px;
  color: #777;
  margin-top: 2px;
}
.machi_shipping-card-price {
  font-size: 14px;
  font-weight: 600;
  color: #16a34a;
  white-space: nowrap;
}
.machi_shipping-note {
  font-size: 12px;
  color: #888;
  margin-bottom: 18px;
}

/* === SHIPPING FORM TOGGLE === */
.machi_form-toggle {
  margin-top: 8px;
}
.machi_form-toggle[hidden] { display: none; }

/* Delivery promise pill (dynamic message based on departamento) */
.machi_delivery-promise {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f9f1;
  border: 1px solid #cde9cd;
  color: #225b22;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 4px;
}
.machi_delivery-promise[hidden] { display: none; }
.machi_delivery-promise-icon { font-size: 16px; }

/* === SUCURSAL (branch picker) === */
.machi_form-group-store { margin-bottom: 8px; }
.machi_radio-group-store.vertical { display: flex; flex-direction: column; }
.machi_store-list { margin-top: 8px; }
.machi_radio-option-store {
  background: #fafafa;
  padding: 14px;
  border-radius: 8px;
  border: 2px solid #e5e5e5;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0;
  transition: border-color 0.15s;
}
.machi_radio-option-store:hover { border-color: #bbb; }
.machi_radio-option-store.selected,
.machi_radio-option-store:has(input:checked) {
  border-color: #ff0000;
  background: #fff7f7;
}
.machi_radio-option-store input[type="radio"] {
  margin-top: 4px;
  flex-shrink: 0;
  accent-color: #ff0000;
}
.machi_store-info-wrapper { flex: 1; min-width: 0; }
.machi_store-name { font-weight: 700; margin-bottom: 6px; color: #222; }
.machi_store-details { font-size: 13px; color: #555; line-height: 1.45; }
.machi_store-schedule { display: block; margin-top: 4px; font-size: 12px; color: #777; }

/* === PAYMENT METHODS === */
.machi_payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.machi_payment-method {
  border: 2px solid #e5e5e5;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
}
.machi_payment-method:hover { border-color: #ff0000; }
.machi_payment-method.selected { border-color: #ff0000; background: #fff7f7; }
.machi_payment-method.locked { pointer-events: none; opacity: 0.5; cursor: not-allowed; }
.machi_payment-icon img { height: 32px; width: auto; }
.machi_payment-text { font-size: 12px; font-weight: 600; line-height: 1.2; color: #333; }

/* ============================================================================
 * RIGHT COLUMN — STICKY ORDER SUMMARY
 * ============================================================================ */

.machi_summary-sticky {
  position: sticky;
  top: 16px;
}

.machi_summary-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  color: #111;
}

/* Compact product items (in summary) */
.machi_summary-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.machi_product-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
}
.machi_product-image {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #f5f5f5;
  flex-shrink: 0;
  overflow: hidden;
}
.machi_product-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}
.machi_product-qty-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ff0000;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.machi_product-info { flex: 1; min-width: 0; }
.machi_product-info h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #222;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.machi_product-pricing { margin-bottom: 4px; }
.machi_product-price-line {
  font-size: 13px;
  font-weight: 600;
  color: #111;
}
.machi_product-toggle-details {
  background: none;
  border: none;
  color: #666;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 0;
  margin: 0;
}
.machi_product-toggle-details:hover { color: #ff0000; }
.machi_product-attributes {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #eee;
}
.machi_product-attributes p {
  font-size: 12px;
  color: #555;
  margin: 2px 0;
  line-height: 1.3;
}
.machi_product-detail-title {
  font-weight: 600;
  color: #333;
}

/* Totals */
.machi_summary-totals {
  border-top: 1px solid #eee;
  padding-top: 12px;
  margin-bottom: 16px;
}
.machi_summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #444;
  margin-bottom: 8px;
}
.machi_summary-row span:last-child { font-weight: 600; color: #111; }

/* Payment cards (USD / USDT) */
.machi_payment-cards-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}
.machi_payment-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a0a0a 100%);
  color: #fff;
  border-radius: 12px;
  padding: 14px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  min-height: 130px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 2px solid transparent;
}
.machi_payment-card.selected {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25), 0 4px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}
.machi_payment-card.unselected { opacity: 0.4; filter: grayscale(40%); transform: scale(0.97); }
.machi_payment-card.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; filter: grayscale(100%); }
.machi_payment-card.disabled::after {
  content: 'No disponible';
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.7); color: #fff;
  padding: 6px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  white-space: nowrap; z-index: 10;
}
.machi_payment-card-usd { background: linear-gradient(135deg, #1a1a1a 0%, #14532d 100%); border-color: rgba(34,197,94,0.35); }
.machi_payment-card-usd.selected { background: linear-gradient(135deg, #14532d 0%, #16a34a 100%); border-color: #22c55e; }
.machi_payment-card-usdt { background: linear-gradient(135deg, #1a1a1a 0%, #1e3a5f 100%); border-color: rgba(59,130,246,0.35); }
.machi_payment-card-usdt.selected { background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); border-color: #3b82f6; }
.machi_payment-card-header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.machi_payment-card-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.machi_payment-card-titles { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.machi_payment-card-title { font-size: 13px; font-weight: 600; line-height: 1.2; }
.machi_payment-card-subtitle { font-size: 11px; opacity: 0.85; }
.machi_payment-card-amount { display: flex; align-items: baseline; gap: 5px; margin-bottom: 6px; }
.machi_payment-amount-value { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.machi_payment-amount-currency { font-size: 12px; font-weight: 600; opacity: 0.95; }
.machi_payment-card-equivalent { font-size: 13px; opacity: 0.85; line-height: 1.2; }
.machi_payment-card-badge {
  position: absolute; top: 8px; right: 10px;
  background: rgba(255,255,255,0.22); color: #fff;
  padding: 2px 7px; border-radius: 12px;
  font-size: 9px; font-weight: 500;
  backdrop-filter: blur(10px);
}

/* === PAY BUTTON === */
.machi_pay-button {
  width: 100%;
  background: #111;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
  min-height: 50px;
}
.machi_pay-button:hover { background: #000; }
.machi_pay-button:active { transform: translateY(1px); }
.machi_pay-button:disabled,
.machi_pay-button.disabled-button {
  background: #555 !important;
  cursor: not-allowed;
  opacity: 0.55;
}
.machi_pay-button .check-glyph { color: #fff; font-weight: 700; margin-left: 0.25rem; }

/* === SECURITY NOTE === */
.machi_security-note {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.machi_security-note-text { font-weight: 600; color: #333; }

/* === SUMMARY PRODUCT CARD (mockup 1) === */
.machi_product-meta {
  font-size: 12px;
  color: #666;
  margin: 2px 0 8px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.machi_product-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.machi_product-qty {
  font-size: 12px;
  color: #555;
}
.machi_product-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.machi_product-price-usd {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  line-height: 1.15;
}
.machi_product-price-bs {
  font-size: 12px;
  font-weight: 500;
  color: #666;
  line-height: 1.15;
}

/* === RADIO ROW (Cochabamba / Santa Cruz, etc.) === */
.machi_radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.machi_radio-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s;
}
.machi_radio-option:has(input:checked) {
  border-color: #ff0000;
  background: #fff7f7;
}
.machi_radio-option input[type="radio"] { accent-color: #ff0000; }

/* === LOADING SPINNER (cart fetch) === */
.cs-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; color: #666; min-height: 80px;
}
.cs-spinner {
  width: 18px; height: 18px;
  border: 2px solid #f3f3f3; border-top: 2px solid #333;
  border-radius: 50%; animation: cs-spin 1s linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }

/* ============================================================================
 * MODAL (unchanged behavior, lightly cleaned)
 * ============================================================================ */
.machi_modal {
  position: fixed; z-index: 1000;
  left: 0; top: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex; justify-content: center; align-items: center;
  padding: 20px; box-sizing: border-box;
}
.machi_modal.hidden { display: none; }
.machi_modal.fade-in { animation: fadeIn 0.4s ease-out forwards; }
.machi_modal.fade-out { animation: fadeOut 0.4s ease-out forwards; }
.machi_modal_content {
  background: #fff; padding: 28px; border-radius: 14px;
  max-width: 420px; width: 100%; text-align: center;
  position: relative; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.6s ease-out;
}
.machi_modal_close { position: absolute; top: 10px; right: 15px; cursor: pointer; font-size: 24px; }
#modalPaymentTitle { font-size: 22px; margin-bottom: 18px; color: #222; font-weight: 700; }
#modalTotalAmount { display: flex; flex-direction: column; gap: 14px; justify-content: center; align-items: center; }
#modalPaymentImage { border: 1px solid #bbb; border-radius: 10px; max-width: 100%; height: auto; }
#machi-modal_payment-container { background: #222; border-radius: 10px; padding: 18px; margin: 14px 0; }

.custom-file-upload {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; margin-top: 12px;
}
.upload-label {
  background: #007bff; color: #fff;
  padding: 8px 16px; border-radius: 6px;
  cursor: pointer; font-weight: 700;
  transition: background 0.2s;
}
.upload-label:hover { background: #0056b3; }
#file-name { color: #444; font-style: italic; }

.instructions {
  background: #f8f9ff; border: 1px solid #e3e8ff;
  border-radius: 10px; padding: 14px; margin: 18px 0; text-align: left;
}
.instructions-title { text-align: center; margin-bottom: 10px; font-weight: 700; }
.instructions-list { margin: 0; padding-left: 20px; }
.instructions-list li { margin-bottom: 8px; line-height: 1.4; }

.timer-section {
  background: #fff3cd; border: 1px solid #ffeaa7;
  border-radius: 8px; padding: 12px; margin-bottom: 18px; text-align: center;
}
.timer-text { font-size: 13px; color: #856404; margin-bottom: 4px; }
.timer-value { font-size: 18px; font-weight: 700; color: #856404; font-family: "Courier New", monospace; }

.owner_payment-method { font-size: 15px; font-weight: 600; margin: 14px 0; }
.security-section {
  background: #f8f9ff; border: 1px solid #e3e8ff;
  border-radius: 10px; padding: 10px; margin: 14px 0 20px; font-size: 13px;
}

.action-buttons { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-bottom: 12px; }
#cancelBtnInModal {
  background: #f8f9fa; color: #666; border: 2px solid #e9ecef;
  padding: 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
#cancelBtnInModal:hover { background: #e9ecef; color: #333; }
.confirm-button {
  background: #ff0000; color: #fff; border: none;
  padding: 12px; border-radius: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.2s;
}
.confirm-button:hover { background: #e60000; }
.confirm-button:disabled { background: #ccc; cursor: not-allowed; }

.support-section { text-align: center; }
.support-text { font-size: 12px; color: #666; margin-bottom: 4px; }
.support-link { color: #ff0000; text-decoration: none; font-weight: 600; font-size: 12px; }
.support-link:hover { text-decoration: underline; }

.modal-usdt-amount { color: #fff; font-weight: 700; font-size: 28px; }
.modal-usdt-currency { color: #fff; font-weight: 600; font-size: 20px; }
.modal-bs-amount { color: #fff; font-weight: 700; font-size: 24px; }
.modal-bs-currency { color: #fff; font-weight: 600; font-size: 18px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================================
 * RESPONSIVE
 * ============================================================================ */

@media (max-width: 1024px) {
  .machi_left-section { padding: 32px 28px; }
  .machi_right-section { padding: 28px 24px; }
}

@media (max-width: 860px) {
  .container-checkout {
    grid-template-columns: 1fr;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .machi_left-section { border-right: none; border-bottom: 1px solid #eee; padding: 24px 18px; }
  .machi_right-section { padding: 24px 18px; }
  .machi_summary-sticky { position: static; }
  .machi_form-row-2 { grid-template-columns: 1fr; }
  .machi_shipping-options { grid-template-columns: 1fr; }
  .machi_payment-methods { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 480px) {
  .machi_checkout-logo img { height: 44px; }
  .title-crazy { font-size: 20px; }
  .machi_section-title { font-size: 16px; }
  .machi_payment-methods { grid-template-columns: 1fr 1fr; }
  .machi_payment-method { min-height: 70px; padding: 10px 8px; }
  .machi_payment-icon img { height: 26px; }
  .machi_payment-text { font-size: 11px; }
  .machi_payment-amount-value { font-size: 24px; }
  .machi_pay-button { padding: 13px; font-size: 14px; }
  .machi_modal { padding: 12px; }
  .machi_modal_content { padding: 22px 16px; }
  #modalPaymentTitle { font-size: 18px; }
  .action-buttons { grid-template-columns: 1fr; }
}

/* === Touch targets === */
@media (pointer: coarse) {
  .machi_shipping-card,
  .machi_payment-method,
  .machi_radio-option-store,
  .machi_form-input,
  #departamento { min-height: 44px; }
  .machi_pay-button, .confirm-button, #cancelBtnInModal { min-height: 48px; }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  .machi_payment-card,
  .machi_pay-button,
  .machi_shipping-card,
  .machi_payment-method { transition: none; }
  .machi_modal.fade-in, .machi_modal.fade-out, .machi_modal_content { animation: none; }
}

/* === Print === */
@media print {
  .machi_modal, .machi_pay-button, .machi_checkout-steps { display: none !important; }
  .container-checkout { grid-template-columns: 1fr; box-shadow: none; }
}
