/**
 * Calculadora Fiscal Modal
 * Modal global de calculadora de ahorro fiscal para donaciones
 * Figma: node 5228-36717 — Componente reutilizable desde cualquier sección
 */

/* ==========================================================================
   Overlay
   ========================================================================== */

.calculadora-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calculadora-modal.is-open {
    display: flex;
}

.calculadora-modal.is-visible {
    opacity: 1;
}

/* Backdrop */
.calculadora-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* ==========================================================================
   Container / Card
   ========================================================================== */

.calculadora-modal__container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    background-color: var(--wp--preset--color--white, #FFFFFF);
    border-radius: var(--wp--custom--border-radius--lg, 16px);
    box-shadow: var(--wp--custom--shadow--sm, 0px 4px 4px 0px rgba(0, 0, 0, 0.12));
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.calculadora-modal.is-visible .calculadora-modal__container {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Header (título + botón cerrar)
   ========================================================================== */

.calculadora-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
    gap: 10px;
    flex-shrink: 0;
}

.calculadora-modal__title {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--normal, 16px);
    font-weight: 700;
    line-height: 1.21;
    color: var(--wp--preset--color--text-dark, #333333);
}

.calculadora-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--wp--preset--color--text-dark, #333333);
    transition: opacity 0.2s ease;
}

.calculadora-modal__close:hover {
    opacity: 0.6;
}

.calculadora-modal__close:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #D50032);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ==========================================================================
   Cuerpo scrollable
   ========================================================================== */

.calculadora-modal__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Subtítulo */
.calculadora-modal__subtitle {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--body-large, 18px);
    font-weight: 700;
    line-height: 1.21;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* Descripción */
.calculadora-modal__description {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--body-large, 18px);
    font-weight: 400;
    line-height: 1.21;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* ==========================================================================
   Campo de entrada
   ========================================================================== */

.calculadora-modal__input-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calculadora-modal__label {
    display: block;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--small, 14px);
    font-weight: 500;
    line-height: 1.21;
    color: var(--wp--preset--color--text-gray, #4F4F4F);
}

.calculadora-modal__body .calculadora-modal__input-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--wp--preset--color--light-gray, #F4F4F4);
    border-radius: var(--wp--custom--border-radius--lg, 16px);
    transition: box-shadow 0.2s ease;
    max-width: 60%;
    padding-right: 1rem;
    padding-left: 8px;
}

/* .calculadora-modal__body .calculadora-modal__input-box:focus-within {
    box-shadow: 0 0 0 2px var(--wp--preset--color--primary, #D50032);
} */

.calculadora-modal__body .calculadora-modal__input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--small, 14px);
    font-weight: 400;
    color: var(--wp--preset--color--text-dark, #333333);
    background: transparent;
}

.calculadora-modal__input::placeholder {
    color: var(--wp--preset--color--text-light, #787878);
    opacity: 0.64;
}

.calculadora-modal__input::-webkit-outer-spin-button,
.calculadora-modal__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calculadora-modal__input {
    -moz-appearance: textfield;
}

.calculadora-modal__currency {
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--small, 14px);
    font-weight: 400;
    color: var(--wp--preset--color--text-light, #787878);
    flex-shrink: 0;
}

.calculadora-modal__hint {
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--tiny, 12px);
    font-weight: 400;
    line-height: 1.21;
    color: var(--wp--preset--color--text-gray, #4F4F4F);
}

/* ==========================================================================
   Checkbox donación recurrente
   ========================================================================== */

.calculadora-modal__checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

/* Input nativo oculto (accesible) */
.calculadora-modal__checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Checkbox visual personalizado */
.calculadora-modal__checkbox-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: 1.5px solid var(--wp--preset--color--secondary, #787878);
    border-radius: var(--wp--custom--border-radius--sm, 4px);
    background: var(--wp--preset--color--white, #FFFFFF);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.calculadora-modal__checkbox:checked + .calculadora-modal__checkbox-custom {
    background-color: var(--wp--preset--color--brand-blue, #3A91CF);
    border-color: var(--wp--preset--color--brand-blue, #3A91CF);
}

.calculadora-modal__checkbox:focus-visible + .calculadora-modal__checkbox-custom {
    outline: 2px solid var(--wp--preset--color--brand-blue, #3A91CF);
    outline-offset: 2px;
}

.calculadora-modal__checkbox-custom svg {
    display: none;
    color: var(--wp--preset--color--white, #FFFFFF);
}

.calculadora-modal__checkbox:checked + .calculadora-modal__checkbox-custom svg {
    display: block;
}

.calculadora-modal__checkbox-label {
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--tiny, 12px);
    font-weight: 500;
    line-height: 1.4;
    color: var(--wp--preset--color--text-gray, #4F4F4F);
}

/* ==========================================================================
   Resultados (dos columnas)
   ========================================================================== */

.calculadora-modal__results {
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.calculadora-modal__result-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
}

/* Separador visual entre columnas */
.calculadora-modal__result-item + .calculadora-modal__result-item {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.calculadora-modal__result-label {
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--small, 14px);
    font-weight: 500;
    line-height: 1.21;
    text-align: center;
    color: var(--wp--preset--color--text-light, #787878);
}

.calculadora-modal__result-item--cost .calculadora-modal__result-label {
    color: var(--wp--preset--color--primary, #D50032);
}

.calculadora-modal__result-value {
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.21;
    color: var(--wp--preset--color--text-dark, #333333);
}

/* ==========================================================================
   Botón Reset
   ========================================================================== */

.calculadora-modal__reset {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--body-large, 18px);
    font-weight: 700;
    line-height: 1;
    color: var(--wp--preset--color--text-dark, #333333);
    background: var(--wp--preset--color--white, #FFFFFF);
    border: 1px solid var(--wp--preset--color--secondary, #787878);
    border-radius: 24px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.calculadora-modal__reset:hover {
    background-color: var(--wp--preset--color--light-gray, #F4F4F4);
}

.calculadora-modal__reset:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #D50032);
    outline-offset: 2px;
}

/* ==========================================================================
   Texto legal
   ========================================================================== */

.calculadora-modal__legal {
    margin: 0;
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: var(--wp--preset--font-size--tiny, 12px);
    font-weight: 400;
    line-height: 1.5;
    color: var(--wp--preset--color--text-light, #787878);
}

/* ==========================================================================
   Body scroll lock
   ========================================================================== */

body.calculadora-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   Responsive - Mobile (bottom sheet)
   ========================================================================== */

@media (max-width: 768px) {
    .calculadora-modal {
        padding: 0;
        align-items: flex-end;
    }

    .calculadora-modal__container {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        max-height: 92vh;
    }

    .calculadora-modal.is-visible .calculadora-modal__container {
        transform: translateY(0);
    }

    .calculadora-modal__result-value {
        font-size: 28px;
    }
}

/* ==========================================================================
   Accesibilidad
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .calculadora-modal,
    .calculadora-modal__container {
        transition: none;
    }
}
