/* ============================================================
   FENIX DASHCAM — Flujo de compra directa (Mercado Pago Bricks)
   Modal 2 pasos: datos de envío → Payment Brick. Scope: .fxb-*
   Dark por defecto; light vía html[data-color-mode="light"]
   ============================================================ */

.fxb-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2.5rem);
    background: rgba(4, 5, 7, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
}
.fxb-overlay.is-open { display: flex; }

.fxb-modal {
    width: min(560px, 100%);
    margin: auto 0;
    background: var(--fxd-surface, #0e1014);
    color: var(--fxd-text, #f5f6f7);
    border: 1px solid var(--fxd-border-strong, rgba(255,255,255,0.16));
    border-radius: 20px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.fxb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--fxd-border, rgba(255,255,255,0.09));
}
.fxb-head strong { font-size: 1.02rem; letter-spacing: -0.01em; }
.fxb-head .fxb-step-tag {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fxd-red, #E31937);
}
.fxb-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--fxd-border, rgba(255,255,255,0.09));
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.fxb-close:hover { background: rgba(227, 25, 55, 0.14); transform: rotate(90deg); }
.fxb-close:focus-visible { outline: 3px solid var(--fxd-red, #E31937); outline-offset: 2px; }

.fxb-body { padding: 1.4rem; }

/* Resumen del pedido */
.fxb-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--fxd-border, rgba(255,255,255,0.09));
    border-radius: 12px;
    background: var(--fxd-surface-2, #14171c);
    margin-bottom: 1.2rem;
    font-size: 0.92rem;
}
.fxb-summary .fxb-total { font-weight: 800; font-size: 1.06rem; white-space: nowrap; }
.fxb-summary .fxb-ship { display: block; font-size: 0.76rem; color: var(--fxd-muted, rgba(245,246,247,0.62)); font-weight: 500; }

/* Selector de cantidad */
.fxb-qty { display: inline-flex; align-items: center; gap: 0.15rem; border: 1px solid var(--fxd-border-strong, rgba(255,255,255,0.16)); border-radius: 999px; }
.fxb-qty button {
    width: 34px; height: 34px;
    border: 0; background: transparent; color: inherit;
    font-size: 1.05rem; font-weight: 700; cursor: pointer; border-radius: 50%;
}
.fxb-qty button:hover { background: rgba(227, 25, 55, 0.15); }
.fxb-qty output { min-width: 26px; text-align: center; font-weight: 700; font-size: 0.95rem; }

/* Formulario de envío */
.fxb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.fxb-field { display: flex; flex-direction: column; gap: 0.3rem; }
.fxb-field--full { grid-column: 1 / -1; }
.fxb-field label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: var(--fxd-muted, rgba(245,246,247,0.62)); }
.fxb-field input {
    width: 100%;
    padding: 0.72rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--fxd-border-strong, rgba(255,255,255,0.16));
    background: var(--fxd-surface-2, #14171c);
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.fxb-field input:focus { outline: none; border-color: var(--fxd-red, #E31937); box-shadow: 0 0 0 3px rgba(227, 25, 55, 0.18); }
.fxb-field input[aria-invalid="true"] { border-color: var(--fxd-red, #E31937); }
.fxb-error { display: none; margin: 0.9rem 0 0; padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.86rem; background: rgba(227, 25, 55, 0.12); border: 1px solid rgba(227, 25, 55, 0.4); }
.fxb-error.is-visible { display: block; }

/* Honeypot: fuera de vista para humanos */
.fxb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.fxb-actions { display: flex; gap: 0.7rem; margin-top: 1.3rem; flex-wrap: wrap; }
.fxb-actions .fxd-btn { flex: 1; min-width: 200px; }
.fxb-btn-pay {
    background: linear-gradient(180deg, var(--fxd-red, #E31937), var(--fxd-red-deep, #B01030));
    color: #fff;
    box-shadow: 0 10px 28px rgba(227, 25, 55, 0.35);
}
.fxb-btn-pay:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(227, 25, 55, 0.45); }
.fxb-btn-pay[disabled] { opacity: 0.55; cursor: wait; transform: none; }

/* Contenedor del Payment Brick */
#fxd-brick { min-height: 320px; }
.fxb-brick-loading { display: flex; align-items: center; justify-content: center; gap: 0.7rem; min-height: 220px; color: var(--fxd-muted, rgba(245,246,247,0.62)); font-size: 0.9rem; }
.fxb-spinner {
    width: 22px; height: 22px; flex: none;
    border-radius: 50%;
    border: 3px solid rgba(227, 25, 55, 0.25);
    border-top-color: var(--fxd-red, #E31937);
    animation: fxb-spin 0.8s linear infinite;
}
@keyframes fxb-spin { to { transform: rotate(360deg); } }

/* Resultado */
.fxb-result { text-align: center; padding: 1.2rem 0.5rem; }
.fxb-result-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.fxb-result-icon svg { width: 30px; height: 30px; }
.fxb-result--ok .fxb-result-icon { background: rgba(31, 174, 84, 0.15); color: #1fae54; }
.fxb-result--wait .fxb-result-icon { background: rgba(240, 165, 0, 0.15); color: #f0a500; }
.fxb-result--fail .fxb-result-icon { background: rgba(227, 25, 55, 0.14); color: var(--fxd-red, #E31937); }
.fxb-result h3 { margin: 0 0 0.5rem; font-size: 1.25rem; letter-spacing: -0.01em; }
.fxb-result p { margin: 0 auto 1rem; max-width: 40ch; color: var(--fxd-muted, rgba(245,246,247,0.62)); font-size: 0.93rem; }
.fxb-result .fxb-order-num { display: inline-block; font-weight: 800; letter-spacing: 0.06em; padding: 0.45rem 1rem; border-radius: 999px; border: 1px dashed var(--fxd-border-strong, rgba(255,255,255,0.16)); margin-bottom: 1rem; }

/* Nota de seguridad */
.fxb-secure { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1.1rem; font-size: 0.76rem; color: var(--fxd-muted, rgba(245,246,247,0.62)); }
.fxb-secure svg { width: 14px; height: 14px; }

/* Botón "Comprar ahora" para la ficha de producto del catálogo.
   Autosuficiente: la ficha NO carga el CSS de la landing. */
.fxb-btn-pdp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 10px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 16px;
    font-family: inherit;
    background: linear-gradient(180deg, #E31937, #B01030);
    color: #fff;
    box-shadow: 0 8px 22px rgba(227, 25, 55, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.fxb-btn-pdp:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(227, 25, 55, 0.4); }
.fxb-btn-pdp:focus-visible { outline: 3px solid #E31937; outline-offset: 3px; }
/* Base mínima de los botones del modal fuera de la landing */
.fxb-overlay .fxd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; font-weight: 700; font-size: 0.98rem; padding: 0.9rem 1.6rem; border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.fxb-overlay .fxd-btn-ghost { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.25); color: inherit; }

/* Sticky móvil con compra + WhatsApp mini */
.fxb-sticky-row { display: flex; gap: 0.6rem; align-items: stretch; }
.fxb-sticky-row .fxd-btn { flex: 1; }
.fxb-wa-mini {
    width: 52px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(180deg, #1fae54, #168a41);
    color: #fff;
    box-shadow: 0 8px 20px rgba(31, 174, 84, 0.35);
}
.fxb-wa-mini svg { width: 22px; height: 22px; }

/* Light mode */
html[data-color-mode="light"] .fxb-overlay { background: rgba(22, 24, 28, 0.45); }
html[data-color-mode="light"] .fxb-modal { box-shadow: 0 40px 120px rgba(22, 24, 28, 0.35); }

/* Responsive */
@media (max-width: 560px) {
    .fxb-grid { grid-template-columns: 1fr; }
    .fxb-body { padding: 1.1rem; }
    .fxb-summary { flex-wrap: wrap; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fxb-close, .fxb-btn-pay, .fxb-spinner { transition: none; animation-duration: 0.01ms !important; }
}
