/* ====================== MODAL FORMULARIO ====================== */

/* 1. El fondo oscuro del modal */
.modal-formulario {
    display: none; /* El JS lo cambia a flex cuando se activa */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85); /* Fondo oscuro semitransparente */
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Cuando el JS le agrega la clase 'show', el fondo aparece */
.modal-formulario.show {
    opacity: 1;
}

/* 2. El contenedor blanco del formulario */
.modal-contenido {
    background: #ffffff;
    max-width: 450px; /* Reducido de 560px a 450px */
    width: 90%; 
    border-radius: 20px;
    padding: 30px 35px; /* Reducido para que sea más compacto */
    position: relative;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ¡LA MAGIA! Al abrir el modal, el contenido sube y se vuelve visible */
.modal-formulario.show .modal-contenido {
    opacity: 1;
    transform: translateY(0);
}

/* 3. Botón para cerrar (X) */
.btn-cerrar-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cerrar-modal:hover {
    background: #cf0c57;
    color: white;
    transform: rotate(90deg);
}

/* 4. Estilos del Formulario (Textos e Inputs) */
#form-header h2 {
    font-size: 28px; /* Reducido de 32px a 28px */
    color: #1a1a1a;
    margin-bottom: 20px; /* Reducido de 25px a 20px */
    font-weight: 700;
    text-align: center;
}

.form-grupo {
    margin-bottom: 16px; /* Reducimos el espacio entre preguntas */
    text-align: left;
}

.form-grupo label {
    display: block;
    font-size: 15px;
    color: #444;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-grupo input {
    width: 100%;
    padding: 12px 15px; /* Cajas un poco menos altas */
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px; /* Letra ligeramente más pequeña */
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

.form-grupo input:focus {
    border-color: #cf0c57;
    outline: none;
    box-shadow: 0 0 0 3px rgba(207, 12, 87, 0.1);
}

.btn-enviar-form {
    width: 100%;
    background-color: #cf0c57;
    color: white;
    border: none;
    padding: 14px; /* Reducido de 16px a 14px */
    border-radius: 10px;
    font-size: 16px; /* Reducido de 18px a 16px */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 5px;
    font-family: 'Poppins', sans-serif;
}

.btn-enviar-form:hover {
    background-color: #b00a4a;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(207, 12, 87, 0.2);
}

.btn-enviar-form.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.datos-seguros {
    font-size: 13px;
    color: #888;
    margin-top: 20px;
    text-align: center;
}

/* ====================== ESTADOS (ÉXITO Y ERROR) ====================== */
.mensaje-estado {
    display: none;
    width: 100%;
    padding: 20px 0;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: white;
}

/* Animación de entrada con un leve zoom para darle presencia */
@keyframes fadeInScale {
    0% { opacity: 0; transform: scale(0.92) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.mensaje-estado:not(.oculto) {
    display: flex;
    animation: fadeInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.estado-contenido {
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Tipografía más robusta para los títulos */
.estado-contenido h3 {
    font-size: 28px;
    color: #1a1a1a;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.estado-contenido p {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* ================= ÉXITO ================= */
/* Convertimos la palomita en una medalla profesional */
.check-icon {
    font-size: 45px;
    color: white;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.3);
    animation: pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Barra de progreso con efecto de profundidad */
.progress-container {
    width: 100%;
    height: 10px;
    background: #f3f4f6;
    border-radius: 20px;
    margin-top: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #34d399, #059669);
    width: 0%;
    border-radius: 20px;
    transition: width 2.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= ERROR ================= */
/* Convertimos la X en una alerta visual atractiva */
.error-icon {
    font-size: 45px;
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    box-shadow: 0 15px 30px rgba(239, 68, 68, 0.3);
    animation: shakeError 0.6s ease-in-out;
}

/* Estilo de Tarjeta de Notificación para el mensaje de error */
#error-mensaje {
    background-color: #fffafb;
    color: #b91c1c;
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid #ef4444; /* Línea lateral que le da un toque corporativo */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    margin: 10px auto 30px auto;
    font-weight: 500;
    font-size: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Botón reintentar más llamativo y corporativo */
.btn-reintentar {
    background: #1a1a1a;
    color: white;
    border: none;
    padding: 16px 35px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    width: 100%;
}

.btn-reintentar:hover {
    background: #cf0c57; /* Cambia a tu color rosa al pasar el mouse */
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(207, 12, 87, 0.25);
}

/* Ocultar formulario cuando se muestra mensaje */
#form-auditoria, #form-header {
    transition: opacity 0.4s ease;
}

/* ================= ANIMACIONES ================= */
@keyframes pop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* ================= RESPONSIVE MODAL ================= */
@media (max-width: 576px) {
    .modal-contenido {
        padding: 30px 20px;
    }
    
    #form-header h2 {
        font-size: 26px;
    }
    
    .btn-cerrar-modal {
        top: 15px;
        right: 15px;
    }

    .check-icon, .error-icon {
        width: 75px;
        height: 75px;
        font-size: 38px;
    }
}

/* ================= RESPONSIVE MODAL ================= */

/* Tablets y pantallas medianas (Max: 768px) */
@media (max-width: 768px) {
    .modal-contenido {
        padding: 30px 25px;
    }
}

/* Celulares (Max: 576px) */
@media (max-width: 576px) {
    /* Ajustes generales del contenedor */
    .modal-contenido {
        width: 95%; /* Aprovecha casi toda la pantalla en celular */
        padding: 25px 20px;
        border-radius: 16px; /* Borde ligeramente menos curvo para ahorrar espacio */
    }
    
    /* Botón cerrar más sutil */
    .btn-cerrar-modal {
        top: 12px;
        right: 12px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    /* Textos y espacios del formulario */
    #form-header h2 {
        font-size: 24px;
        margin-top: 10px; /* Separación para que no choque con la X */
        margin-bottom: 15px;
    }

    .form-grupo {
        margin-bottom: 12px;
    }

    .form-grupo label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .form-grupo input {
        padding: 10px 12px;
        font-size: 14px; /* Letra un poco más pequeña en inputs */
    }

    .btn-enviar-form {
        padding: 12px;
        font-size: 15px;
    }

    .datos-seguros {
        font-size: 12px;
        margin-top: 15px;
    }

    /* ================= Responsive Éxito / Error ================= */
    .estado-contenido h3 {
        font-size: 24px;
    }

    .estado-contenido p {
        font-size: 15px;
        margin-bottom: 10px;
    }

    /* Reducción proporcional de las medallas/íconos */
    .check-icon, .error-icon {
        width: 65px;
        height: 65px;
        font-size: 32px;
        margin-bottom: 15px;
    }

    #error-mensaje {
        font-size: 14px;
        padding: 12px 15px;
        margin: 10px auto 20px auto;
    }

    .btn-reintentar {
        padding: 12px 20px;
        font-size: 15px;
    }
}