/* ============================================================
   WEMAILIT CHECKOUT — hoja de estilos única
   Mobile-first · CSS Grid + Flexbox · variables CSS · sin dependencias
   Tokens visuales extraídos del Stripe Checkout de Wemailit.
   ============================================================ */

:root {
    /* Marca */
    --wc-brand: #b9fb6a;
    --wc-brand-ink: #131a05;
    --wc-brand-ink-soft: rgba(19, 26, 5, 0.72);

    /* Neutros (paleta Stripe) */
    --wc-ink: #30313d;
    --wc-muted: #6a7383;
    --wc-surface: #ffffff;
    --wc-border: rgba(26, 31, 54, 0.16);
    --wc-segment-bg: #eef0f3;

    /* Estados */
    --wc-focus: #0570de;
    --wc-focus-ring: 0 0 0 1px var(--wc-focus), 0 0 0 4px rgba(5, 112, 222, 0.18);
    --wc-danger: #df1b41;
    --wc-danger-bg: rgba(223, 27, 65, 0.07);

    /* Botón principal */
    --wc-button-bg: #1a1d29;
    --wc-button-bg-hover: #0d0f17;
    --wc-button-ink: #ffffff;

    /* Geometría y elevación */
    --wc-radius-s: 6px;
    --wc-radius: 8px;
    --wc-radius-l: 12px;
    --wc-shadow-card: 0 2px 5px rgba(26, 31, 54, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
    --wc-shadow-image: 0 14px 32px rgba(19, 26, 5, 0.14);
    --wc-shadow-button: 0 1px 2px rgba(0, 0, 0, 0.12);

    /* Tipografía: stack de sistema, como Stripe */
    --wc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Ubuntu, sans-serif;
}

/* ——— Base ——— */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--wc-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--wc-ink);
    background: var(--wc-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg {
    display: block;
    max-width: 100%;
}

/* Solo lectores de pantalla */
.wc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: none;
    box-shadow: var(--wc-focus-ring);
    border-radius: var(--wc-radius-s);
}

/* ——— Layout ——— */

.wc-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ——— Columna resumen (marca) ——— */

.wc-summary {
    background: var(--wc-brand);
    color: var(--wc-brand-ink);
}

.wc-summary__inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 20px 28px;
}

.wc-header {
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
    min-height: 48px;
}

.wc-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--wc-brand-ink);
    transition: background-color 0.15s ease;
}

.wc-back:hover {
    background: rgba(19, 26, 5, 0.08);
}

.wc-logo {
    justify-self: center;
    height: 26px;
    width: auto;
}

/* Producto y total */

.wc-product {
    text-align: center;
    margin-top: 20px;
}

.wc-product__name {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--wc-brand-ink-soft);
}

.wc-hero {
    margin: 6px 0 0;
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    transition: opacity 0.15s ease;
}

.wc-pending {
    margin: 8px 0 0;
    font-size: 13.5px;
    color: var(--wc-brand-ink-soft);
}

/* Desglose de precio (columna de acción, fondo blanco) */

.wc-breakdown-wrap {
    margin: 4px 0 20px;
}

.wc-breakdown {
    margin: 0;
    padding: 4px 18px;
    background: var(--wc-segment-bg);
    border-radius: var(--wc-radius-l);
    transition: opacity 0.15s ease;
}

.wc-breakdown__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    font-size: 14.5px;
}

.wc-breakdown__row + .wc-breakdown__row {
    border-top: 1px solid var(--wc-border);
}

.wc-breakdown__row dt {
    color: var(--wc-muted);
    font-weight: 400;
}

.wc-breakdown__row dd {
    margin: 0;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.wc-breakdown__row--rate {
    font-size: 13px;
}

.wc-breakdown__row--rate dd {
    font-weight: 400;
    color: var(--wc-muted);
}

.wc-breakdown__row--total {
    font-size: 15.5px;
}

.wc-breakdown__row--total dt,
.wc-breakdown__row--total dd {
    font-weight: 600;
    color: var(--wc-ink);
}

/* Tooltip informativo (ⓘ) */

.wc-tip {
    position: relative;
    display: inline-flex;
    vertical-align: -4px;
    margin-left: 1px;
}

.wc-tip__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    border-radius: 50%;
    transition: opacity 0.15s ease;
}

.wc-tip__trigger:hover {
    opacity: 1;
}

.wc-tip__bubble {
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    width: max-content;
    max-width: min(260px, 74vw);
    padding: 9px 12px;
    background: var(--wc-button-bg);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    border-radius: var(--wc-radius);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 10;
}

.wc-tip__bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--wc-button-bg);
}

.wc-tip:hover .wc-tip__bubble,
.wc-tip.is-open .wc-tip__bubble,
.wc-tip__trigger:focus-visible + .wc-tip__bubble {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.wc-footnote {
    margin: 12px 2px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--wc-muted);
}

.wc-product__description {
    margin: 20px 2px 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--wc-brand-ink-soft);
}

.wc-product__figure {
    margin: 24px 0 0;
}

.wc-product__figure img {
    width: 100%;
    height: auto;
    border-radius: var(--wc-radius-l);
    box-shadow: var(--wc-shadow-image);
}

/* ——— Columna de acción ——— */

.wc-checkout {
    background: var(--wc-surface);
    flex: 1;
}

.wc-checkout__inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.wc-checkout__heading {
    margin: 0 0 24px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.wc-field {
    margin: 0 0 20px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.wc-label {
    display: block;
    margin-bottom: 6px;
    padding: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--wc-ink);
}

/* Segmented control de divisa */

.wc-segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 3px;
    padding: 3px;
    background: var(--wc-segment-bg);
    border-radius: var(--wc-radius);
}

.wc-segmented label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-radius: var(--wc-radius-s);
    font-size: 14px;
    font-weight: 500;
    color: var(--wc-muted);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wc-segmented label:hover {
    color: var(--wc-ink);
}

.wc-segmented input:checked + label {
    background: var(--wc-surface);
    color: var(--wc-ink);
    box-shadow: var(--wc-shadow-card);
}

.wc-segmented input:focus-visible + label {
    box-shadow: var(--wc-focus-ring);
}

/* Variante para las opciones de pago (control principal de la página) */
.wc-segmented--pay label {
    height: 46px;
    font-size: 15px;
}

/* Botón principal */

.wc-button {
    position: relative;
    width: 100%;
    height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: var(--wc-radius);
    background: var(--wc-button-bg);
    color: var(--wc-button-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: var(--wc-shadow-button);
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.06s ease;
}

.wc-button:hover:not(:disabled) {
    background: var(--wc-button-bg-hover);
}

.wc-button:active:not(:disabled) {
    transform: scale(0.995);
}

.wc-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wc-button__spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wc-spin 0.7s linear infinite;
}

.wc-button.is-busy .wc-button__label {
    visibility: hidden;
}

.wc-button.is-busy .wc-button__spinner {
    display: block;
}

@keyframes wc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Nota de seguridad y errores */

.wc-secure {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    margin: 16px 4px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--wc-muted);
    text-align: left;
}

.wc-secure svg {
    flex: none;
    margin-top: 3px;
}

.wc-alert {
    margin: 0 0 16px;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--wc-danger);
    background: var(--wc-danger-bg);
    border-radius: var(--wc-radius);
}

/* Estado de carga de importes */

.wc-breakdown.is-loading,
.wc-hero.is-loading {
    opacity: 0.4;
}

/* ============================================================
   TABLET (una columna, más aire)
   ============================================================ */

@media (min-width: 640px) and (max-width: 991.98px) {
    .wc-summary__inner,
    .wc-checkout__inner {
        max-width: 560px;
    }

    .wc-summary__inner {
        padding: 24px 24px 36px;
    }

    .wc-checkout__inner {
        padding: 40px 24px 56px;
    }
}

/* ============================================================
   DESKTOP (dos columnas 50/50, como Stripe Checkout)
   ============================================================ */

@media (min-width: 992px) {
    .wc-page {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .wc-summary {
        min-height: 100dvh;
    }

    /* El contenido de ambas columnas se ancla al eje central. Menos
       padding hacia el centro (antes 84px) para un texto más ancho,
       en línea con el propio Checkout de Stripe. */
    .wc-summary__inner {
        max-width: 520px;
        margin: 0 0 0 auto;
        padding: 56px 56px 72px 40px;
    }

    .wc-checkout__inner {
        max-width: 520px;
        margin: 0 auto 0 0;
        padding: 74px 40px 72px 56px;
    }

    .wc-header {
        display: flex;
        gap: 4px;
        min-height: 0;
    }

    .wc-logo {
        height: 27px;
        margin-left: 8px;
    }

    .wc-product {
        text-align: left;
        margin-top: 44px;
    }

    .wc-product__name {
        font-size: 17px;
    }

    .wc-hero {
        font-size: 38px;
        margin-top: 8px;
    }

    .wc-product__description {
        margin-top: 28px;
    }

    .wc-product__figure {
        margin-top: 32px;
    }

    .wc-checkout__heading {
        margin-bottom: 28px;
    }
}

/* Pantallas muy pequeñas */

@media (max-width: 359.98px) {
    .wc-hero {
        font-size: 29px;
    }

    .wc-breakdown {
        padding: 4px 14px;
    }
}

/* Accesibilidad: sin animaciones si el usuario lo pide */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
