/* ============================================================
   MeBiz Storefront — Checkout STANDALONE brandeable
   Réplica fiel del checkout de ticketmax.org (/pagos/), pero:
   - sin WordPress/WooCommerce (habla con mebiz-store/v1/checkout)
   - brandeable por sitio: el acento morado de TicketMax se movió a
     variables CSS (--brand / --brand-2 / --brand-rgb / --brand-tint).
     Cada marca solo redefine esas variables en :root (o inline).
   Base: ticketmax/assets/css/standalone-checkout.css (identidad
   visual idéntica: topbar+progreso, wizard 2 pasos, sidebar resumen,
   cupón, términos, trust, overlay de procesando).
   ============================================================ */

:root{
    --brand:#7B3FF2;              /* acento principal (TicketMax morado por defecto) */
    --brand-2:#8A55FF;           /* acento claro para gradientes */
    --brand-rgb:123,63,242;      /* mismo acento en RGB para rgba() */
    --brand-tint:#f7f2ff;        /* fondo tinte muy claro (gateway seleccionado) */
    --brand-tint-2:#e8e0f7;      /* tinte medio (íconos/placeholder) */
    --ink:#373535;
    --bg:#F6F7FA;
    --line:#E7E9EF;
    --muted:#6B7280;
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.tm-checkout-body{
    min-height:100vh;display:flex;flex-direction:column;margin:0;
    font-family:'Lato',-apple-system,BlinkMacSystemFont,'Segoe UI',Lato,sans-serif;
    font-size:14px;line-height:1.5;color:var(--ink);background:var(--bg);
    -webkit-font-smoothing:antialiased;
}
img{max-width:100%;height:auto;display:block}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}

/* Topbar */
.tm-checkout-topbar{
    background:#fff;border-bottom:1px solid var(--line);padding:16px 20px;
    display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px;
    position:sticky;top:0;z-index:999;
}
.tm-checkout-topbar .tm-checkout-progress{justify-self:center}
@media (max-width:520px){
    .tm-checkout-topbar{grid-template-columns:auto 1fr}
    .tm-checkout-topbar .tm-checkout-progress{justify-self:end}
}
.tm-checkout-logo-link{display:block;line-height:0}
.tm-checkout-logo{height:clamp(26px,4vw,36px);width:auto}
.tm-checkout-logo-text{font-family:'Lato',-apple-system,sans-serif;font-weight:800;font-size:20px;color:var(--ink);letter-spacing:-.02em}
.tm-checkout-progress{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted);font-weight:500}
.tm-checkout-progress-step{display:flex;align-items:center;gap:8px}
.tm-checkout-progress-dot{
    display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;
    border-radius:50%;background:var(--line);color:var(--muted);font-weight:600;font-size:12px;
    transition:background-color .2s ease,color .2s ease;
}
.tm-checkout-progress-step--active .tm-checkout-progress-dot,
.tm-checkout-progress-step--done .tm-checkout-progress-dot{
    background:linear-gradient(135deg,var(--brand-2),var(--brand));color:#fff;
}
.tm-checkout-progress-step--active .tm-checkout-progress-label{color:var(--ink)}
.tm-checkout-progress-line{width:32px;height:2px;background:var(--line)}

/* Main layout */
.tm-checkout-main{flex:1;width:100%;max-width:1400px;margin:0 auto;padding:clamp(16px,3vw,32px)}
.tm-checkout-layout{
    display:grid;grid-template-columns:1fr clamp(320px,35vw,480px);
    gap:clamp(20px,3vw,32px);align-items:start;
}
@media (max-width:899px){
    .tm-checkout-layout{grid-template-columns:1fr}
    .tm-checkout-col-sidebar{order:-1}
}

/* Steps */
.tm-checkout-step{
    background:#fff;border:1px solid var(--line);border-radius:14px;
    padding:clamp(18px,3vw,28px);box-shadow:0 1px 3px rgba(0,0,0,.04);margin-bottom:16px;
}
.tm-checkout-step[hidden]{display:none}
.tm-checkout-step--active{animation:tmStepIn .32s cubic-bezier(0.23,1,0.32,1) both}
@keyframes tmStepIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@media (prefers-reduced-motion:reduce){.tm-checkout-step--active{animation:none}}
.tm-checkout-step-title{margin:0 0 20px;font-size:18px;font-weight:700;color:var(--ink);letter-spacing:-.01em;
    font-family:'Lato',-apple-system,BlinkMacSystemFont,'Segoe UI',Lato,sans-serif;}
.tm-checkout-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px}
.tm-checkout-field{display:flex;flex-direction:column;gap:6px}
.tm-checkout-field--half{grid-column:span 1}
.tm-checkout-field:not(.tm-checkout-field--half){grid-column:1/-1}
@media (max-width:520px){
    .tm-checkout-field-grid{grid-template-columns:1fr}
    .tm-checkout-field--half{grid-column:1/-1}
}
.tm-checkout-field label{font-size:13px;font-weight:600;color:#374151}
.tm-checkout-field input,.tm-checkout-field select{
    width:100%;padding:11px 14px;border:1px solid #d0d5dd;border-radius:10px;background:#fff;
    font-family:inherit;font-size:14px;color:var(--ink);transition:border-color .15s,box-shadow .15s;
}
.tm-checkout-field input:focus,.tm-checkout-field select:focus{
    outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(var(--brand-rgb),.1);
}
.tm-checkout-field input[aria-invalid="true"]{border-color:#e85347;background:#fff5f5}
.tm-checkout-field-error{
    display:flex;align-items:center;gap:6px;font-size:13px;color:#DC2626;font-weight:500;margin-top:5px;line-height:1.4;
}
.tm-checkout-field-error[hidden]{display:none}
.tm-checkout-req{color:#e85347}

.tm-checkout-step-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:24px;flex-wrap:wrap}
.tm-checkout-step-actions .tm-checkout-btn--secondary{margin-right:auto}
@media (max-width:560px){
    .tm-checkout-step-actions{flex-wrap:nowrap;gap:10px;align-items:stretch}
    .tm-checkout-step-actions .tm-checkout-btn{flex:1 1 0;min-width:0;justify-content:center;text-align:center;padding:12px 10px}
    .tm-checkout-step-actions .tm-checkout-btn--secondary{margin-right:0}
}

/* Buttons */
.tm-checkout-btn{
    appearance:none;border:none;cursor:pointer;font-family:inherit;font-size:14px;font-weight:600;
    padding:12px 20px;border-radius:10px;transition:transform .1s,box-shadow .15s,opacity .15s;
    display:inline-flex;align-items:center;gap:8px;text-decoration:none;
}
.tm-checkout-btn:hover{transform:translateY(-1px)}
.tm-checkout-btn:active{transform:translateY(0)}
.tm-checkout-btn:disabled{opacity:.6;cursor:not-allowed;transform:none}
.tm-checkout-btn[hidden]{display:none}
.tm-checkout-btn--primary{
    background:linear-gradient(135deg,var(--brand-2),var(--brand));color:#fff;box-shadow:0 2px 8px rgba(var(--brand-rgb),.25);
}
.tm-checkout-btn--primary:hover{box-shadow:0 4px 14px rgba(var(--brand-rgb),.35)}
.tm-checkout-btn--secondary{background:#fff;color:#374151;border:1px solid #d0d5dd}
.tm-checkout-btn--secondary:hover{background:var(--bg)}
.tm-checkout-submit{min-width:180px;justify-content:center;font-size:15px;padding:14px 24px}
.tm-checkout-submit-spinner{
    width:16px;height:16px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;
    animation:tm-spin .6s linear infinite;
}
.tm-checkout-submit-spinner[hidden]{display:none}
@keyframes tm-spin{to{transform:rotate(360deg)}}

/* Gateways */
.tm-checkout-gateways{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.tm-checkout-gateway-label{
    display:grid;grid-template-columns:1fr;grid-template-rows:auto auto;gap:4px 12px;
    padding:14px 16px;border:1px solid #d0d5dd;border-radius:10px;background:#fff;cursor:pointer;
    transition:border-color .15s,background .15s;
}
.tm-checkout-gateway-label:has(input[name="payment_method"]:checked){
    border-color:var(--brand);background:var(--brand-tint);box-shadow:0 0 0 3px rgba(var(--brand-rgb),.08);
}
.tm-checkout-gateway-label input{
    position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
.tm-checkout-gateway-label:has(input:focus-visible){outline:2px solid var(--brand);outline-offset:2px}
.tm-checkout-gateway-title{font-weight:600;color:var(--ink);display:flex;align-items:center;gap:8px}
.tm-checkout-gateway-desc{font-size:12px;color:var(--muted)}
.tm-checkout-gateway-empty{padding:16px;background:#fff5f5;border:1px solid #fecaca;border-radius:8px;color:#991b1b}

/* Terms */
.tm-checkout-terms{margin:18px 0 0;padding:14px;background:var(--bg);border-radius:10px}
.tm-checkout-terms label{display:flex;align-items:flex-start;gap:10px;font-size:13px;color:#374151;cursor:pointer}
.tm-checkout-terms input{width:18px;height:18px;accent-color:var(--brand);margin-top:1px;flex-shrink:0}

/* Trust */
.tm-checkout-trust{margin:16px 0 0;text-align:center}
.tm-checkout-trust-secure{display:flex;align-items:center;justify-content:center;gap:6px;margin:0;font-size:13px;font-weight:600;color:#1a7f37}
.tm-checkout-trust-secure svg{flex-shrink:0}
.tm-checkout-trust-methods{margin:5px 0 0;font-size:12px;color:#595959}

/* Errors */
.tm-checkout-errors{margin:16px 0 0;padding:12px 16px;background:#fff5f5;border:1px solid #fecaca;border-radius:8px;color:#991b1b;font-size:13px}
.tm-checkout-errors[hidden]{display:none}

/* Summary sidebar */
.tm-checkout-summary{
    position:sticky;top:100px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.04);
}
@media (max-width:899px){.tm-checkout-summary{position:static}}
.tm-checkout-summary-title{margin:0 0 16px;font-size:15px;font-weight:700;color:var(--ink);text-transform:uppercase;letter-spacing:.04em}
.tm-checkout-items{list-style:none;margin:0 0 18px;padding:0 0 16px;border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:12px}
.tm-checkout-item{display:grid;grid-template-columns:56px 1fr auto;gap:12px;align-items:flex-start}
.tm-checkout-item-img{width:56px;height:56px;border-radius:8px;object-fit:cover;background:var(--bg)}
.tm-checkout-item-img--placeholder{background:linear-gradient(135deg,var(--brand-tint-2),var(--brand-tint))}
.tm-checkout-item-body{min-width:0}
.tm-checkout-item-name{font-size:13px;line-height:1.35;font-weight:600;color:var(--ink);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.tm-checkout-item-variation{font-size:12px;line-height:1.3;color:var(--brand);margin-top:3px;font-weight:600}
.tm-checkout-item-label{color:#9CA3AF;font-weight:500;margin-right:2px}
.tm-checkout-item-qty{font-size:12px;color:var(--muted);margin-top:2px}
.tm-checkout-item-price{font-size:13px;font-weight:600;color:var(--ink);white-space:nowrap;
    font-family:'Lato',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;}

.tm-checkout-totals{margin:0;display:flex;flex-direction:column;gap:8px}
.tm-checkout-totals-row{display:flex;justify-content:space-between;align-items:baseline}
.tm-checkout-totals-row[hidden]{display:none}
.tm-checkout-totals-row dt{margin:0;color:var(--muted);font-size:13px}
.tm-checkout-totals-row dd{margin:0;color:var(--ink);font-size:13px}
.tm-checkout-totals-row--discount dt,.tm-checkout-totals-row--discount dd{color:#16a34a;font-weight:600}
.tm-checkout-totals-row--total{padding-top:10px;margin-top:4px;border-top:1px dashed var(--line)}
.tm-checkout-totals-row--total dt,.tm-checkout-totals-row--total dd{font-size:16px;font-weight:700;color:var(--brand)}
.tm-checkout-totals-row--total dd{font-family:'Lato',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}

/* Cupones */
.tm-checkout-coupon{margin:0 0 16px;padding:0 0 16px;border-bottom:1px dashed var(--line)}
.tm-coupon-toggle{display:flex;align-items:center;gap:10px;width:100%;padding:4px 0;border:none;background:transparent;color:var(--muted);font-size:13px;font-weight:600;text-align:left;cursor:pointer;transition:color .15s}
.tm-coupon-toggle:hover{color:var(--brand)}
.tm-coupon-toggle-label{flex:1;min-width:0}
.tm-coupon-toggle-chevron{transition:transform .2s ease;flex-shrink:0}
.tm-coupon-toggle[aria-expanded="true"] .tm-coupon-toggle-chevron{transform:rotate(180deg)}
.tm-coupon-toggle[aria-expanded="true"]{color:var(--ink)}
.tm-coupon-panel{margin-top:12px}
.tm-coupon-panel[hidden]{display:none}
.tm-coupon-row{display:flex;gap:8px}
.tm-coupon-row[hidden]{display:none}
.tm-coupon-input{flex:1;min-width:0;padding:11px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;font-size:14px;transition:border-color .15s,box-shadow .15s}
.tm-coupon-input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(var(--brand-rgb),.15)}
.tm-coupon-btn{flex-shrink:0;padding:11px 18px;border:none;border-radius:10px;background:linear-gradient(135deg,var(--brand-2),var(--brand));color:#fff;font-size:13px;font-weight:600;cursor:pointer;transition:box-shadow .15s,transform .1s}
.tm-coupon-btn:hover:not(:disabled){box-shadow:0 4px 14px rgba(var(--brand-rgb),.35)}
.tm-coupon-btn:disabled{opacity:.6;cursor:not-allowed}
.tm-coupon-msg{margin-top:10px;padding:8px 12px;border-radius:8px;font-size:12px;line-height:1.4}
.tm-coupon-msg[hidden]{display:none}
.tm-coupon-msg--success{background:#ECFDF5;color:#065F46}
.tm-coupon-msg--error{background:#FEF2F2;color:#991B1B}

/* Empty state */
.tm-checkout-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;max-width:480px;margin:auto;text-align:center;background:#fff;border-radius:14px;padding:40px;border:1px solid var(--line)}
.tm-checkout-empty[hidden]{display:none}
.tm-checkout-empty h1{font-size:22px;margin:0 0 8px;font-family:'Lato',sans-serif}
.tm-checkout-empty p{color:var(--muted);margin:0 0 24px}
.tm-checkout-main:has(.tm-checkout-empty:not([hidden])){display:flex;align-items:center;justify-content:center}

/* Resultado de pago (artefacto) */
.tm-checkout-payresult{background:#fff;border:1px solid var(--line);border-radius:14px;padding:clamp(20px,3vw,32px);box-shadow:0 1px 3px rgba(0,0,0,.04)}
.tm-checkout-payresult-icon{width:60px;height:60px;margin:0 auto 18px;border-radius:50%;background:linear-gradient(135deg,#10b981,#059669);color:#fff;display:flex;align-items:center;justify-content:center}
.tm-checkout-payresult h2{font-family:'Lato',sans-serif;font-size:20px;font-weight:700;text-align:center;margin:0 0 6px}
.tm-checkout-payresult-sub{text-align:center;color:var(--muted);margin:0 0 20px}
.tm-checkout-payresult-box{background:var(--bg);border:1px solid var(--line);border-radius:12px;padding:16px 18px;margin:0 0 14px;font-size:14px;line-height:1.6}
.tm-checkout-payresult-box .row{display:flex;justify-content:space-between;gap:12px;padding:3px 0}
.tm-checkout-payresult-box .row b{font-family:'Lato',sans-serif}
.tm-checkout-payresult-instructions{white-space:pre-wrap;color:#374151}
.tm-checkout-payresult-wallet{font-family:'SF Mono','Monaco','Menlo',ui-monospace,monospace;font-size:13px;word-break:break-all;background:#fff;border:1px dashed var(--line);border-radius:8px;padding:10px 12px;margin-top:8px}
#stripe-element{margin:14px 0}

/* Processing overlay */
.tm-processing-overlay{position:fixed;inset:0;background:rgba(15,23,42,0.78);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:99999;display:flex;align-items:center;justify-content:center;animation:tmOverlayIn .25s ease-out}
.tm-processing-overlay[hidden]{display:none}
@keyframes tmOverlayIn{from{opacity:0}to{opacity:1}}
.tm-processing-overlay__card{background:#fff;border-radius:16px;padding:32px 40px;box-shadow:0 20px 60px rgba(0,0,0,0.3);text-align:center;max-width:90vw;width:380px;display:flex;flex-direction:column;align-items:center;gap:14px}
.tm-processing-overlay__spinner{width:48px;height:48px;border-radius:50%;border:4px solid rgba(var(--brand-rgb),0.15);border-top-color:var(--brand);animation:tm-spin .9s linear infinite}
.tm-processing-overlay__title{font-size:18px;font-weight:700;color:#0f172a;margin:0;font-family:'Lato',sans-serif}
.tm-processing-overlay__text{font-size:13px;color:var(--muted);margin:0;line-height:1.5}

/* Reduced motion */
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
@media (max-width:767px){input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px!important}}
