/* =========================================
   OVERLAY / BACKDROP
   ========================================= */
.overlay {
    background: rgba(10, 20, 40, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: hidden;
    opacity: 0;
    transition: opacity .28s ease, visibility .28s ease;
}

.overlay.active {
    visibility: visible;
    opacity: 1;
}

/* =========================================
   POPUP CARD
   ========================================= */
.popup {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    transform: scale(0.85) translateY(30px);
    opacity: 0;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}

.popup.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ── Header ── */
.popup-calc-header {
    background: linear-gradient(145deg, #0d47a1 0%, #1565c0 40%, #0277bd 100%);
    padding: 36px 28px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Decoración de fondo */
.popup-calc-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.popup-calc-header::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -30px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

/* Botón cerrar */
.popup-calc-header .btn-cerrar-popup {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    text-decoration: none;
    transition: background .2s, transform .2s;
    z-index: 2;
}
.popup-calc-header .btn-cerrar-popup:hover {
    background: rgba(255,255,255,0.32);
    transform: scale(1.1);
    color: #fff;
}

/* Ícono — igual al estilo de las tarjetas de la página */
.popup-calc-header .calc-icon {
    width: 72px; height: 72px;
    background: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    position: relative;
    z-index: 2;
}
.popup-calc-header .calc-icon i {
    font-size: 30px;
    color: #1565c0;
}

/* Títulos header */
.popup h3 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
    letter-spacing: .8px;
    text-transform: uppercase;
    opacity: 0;
    position: relative; z-index: 2;
}

.popup h4 {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.78);
    margin: 0;
    letter-spacing: .4px;
    opacity: 0;
    position: relative; z-index: 2;
}

/* ── Body (solapado sobre el header) ── */
.popup-calc-body {
    background: #fff;
    border-radius: 18px 18px 0 0;
    margin-top: -22px;
    padding: 28px 28px 24px;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}

/* Input group */
.popup form .contenedor-inputs {
    opacity: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.popup-calc-body .input-group-calc label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.popup-calc-body .input-group-calc small {
    font-size: 11px;
    color: #94a3b8;
}

.popup form .contenedor-inputs input,
.popup form .contenedor-inputs input#a {
    width: 100%;
    height: 56px;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #0d47a1;
    background: #f0f7ff;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    font-family: inherit;
    letter-spacing: 2px;
}

.popup form .contenedor-inputs input:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 4px rgba(21,101,192,0.14);
    background: #fff;
}

/* Botón calcular */
.popup form .btn-submit {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    font-family: inherit;
    text-transform: uppercase;
    box-shadow: 0 6px 20px rgba(13,71,161,0.35);
}

.popup form .btn-submit:hover {
    opacity: .92;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(13,71,161,0.4);
}

.popup form .btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(13,71,161,0.3);
}

/* Resultado */
.popup-calc-result {
    min-height: 44px;
    border-radius: 12px;
    padding: 12px 16px;
    text-align: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

#mostrarmensajeBAD {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #dc2626 !important;
    margin: 0 !important;
    text-transform: none !important;
    line-height: 1.5 !important;
}

#mostrarmensajeOK {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #15803d !important;
    margin: 0 !important;
    text-transform: none !important;
    line-height: 1.5 !important;
}

/* ── Animaciones ── */
.popup.active h3 { animation: calcDown .45s ease .1s forwards; }
.popup.active h4 { animation: calcUp .45s ease .18s forwards; }
.popup.active .contenedor-inputs { animation: calcFade .4s ease .25s forwards; }

@keyframes calcDown {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes calcUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes calcFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
