﻿/* ==== Fondo del Modal ==== */
#loginModal.modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(14, 165, 233, 0.1)), rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-out;
}

/* Animación suave para el fondo */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==== Contenedor del Modal ==== */
#loginModal .modal-content {
    background: linear-gradient(145deg, #ffffff 0%, #fafbff 50%, #f8fafc 100%);
    border-radius: 24px;
    padding: 52px 44px 44px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 32px 64px rgba(59, 130, 246, 0.15), 0 16px 32px rgba(14, 165, 233, 0.1), 0 0 0 1px rgba(59, 130, 246, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalSlideIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
    border: 1px solid rgba(59, 130, 246, 0.12);
}

/* Animación elegante */
@keyframes modalSlideIn {
    from {
        transform: scale(0.88) translateY(-40px) rotateX(8deg);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0) rotateX(0);
        opacity: 1;
    }
}

/* ==== Botón de Cierre ==== */
#loginModal .close-modal {
    position: absolute;
    top: 24px;
    right: 28px;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    background: rgba(248, 250, 252, 0.8);
}

    #loginModal .close-modal:hover {
        color: #dc2626;
        background: linear-gradient(135deg, #fef2f2, #fee2e2);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    }

/* ==== Header del Modal ==== */
#loginModal .modal-header {
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
    position: relative;
}

    /* Icono mejorado con gradiente */
    #loginModal .modal-header::before {
        content: "";
        display: block;
        width: 64px;
        height: 64px;
        margin: 0 auto 24px;
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #0ea5e9 100%);
        border-radius: 20px;
        position: relative;
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    }

    #loginModal .modal-header::after {
        content: "🔐";
        position: absolute;
        top: 18px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 28px;
        filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
    }

/* ==== Título Principal ==== */
#loginModal .modal-content h2 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #475569 50%, #3b82f6 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: -0.8px;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ==== Subtítulo Elegante ==== */
#loginModal .modal-subtitle {
    font-size: 17px;
    color: #64748b;
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.7;
    font-weight: 400;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ==== Formulario ==== */
#loginModal form {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 28px;
}

/* ==== Grupo de Input ==== */
#loginModal .input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

#loginModal .input-label {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

    /* Iconos con gradientes */
    #loginModal .input-label.email::before {
        content: "";
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #0ea5e9, #3b82f6);
        mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75'/%3e%3c/svg%3e") no-repeat center;
        -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75'/%3e%3c/svg%3e") no-repeat center;
    }

    #loginModal .input-label.password::before {
        content: "";
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #1d4ed8, #3b82f6);
        mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z'/%3e%3c/svg%3e") no-repeat center;
        -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z'/%3e%3c/svg%3e") no-repeat center;
    }

/* ==== Inputs Premium ==== */
#loginModal .modal-content input {
    width: 100%;
    padding: 20px 24px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 2px solid #bae6fd;
    border-radius: 16px;
    font-size: 16px;
    color: #1e293b;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    font-family: inherit;
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.05);
}

    #loginModal .modal-content input:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(59, 130, 246, 0.1);
        background: #ffffff;
        transform: translateY(-2px) scale(1.01);
    }

    #loginModal .modal-content input::placeholder {
        color: #94a3b8;
        font-weight: 400;
    }

/* ==== Área de Extras del Formulario ==== */
#loginModal .form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -8px 0 16px 0;
    flex-wrap: wrap;
    gap: 16px;
}

#loginModal .remember-me {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
}

    #loginModal .remember-me:hover {
        color: #1e293b;
    }

    #loginModal .remember-me input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin: 0;
        accent-color: #3b82f6;
        cursor: pointer;
    }

#loginModal .forgot-password {
    font-size: 15px;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(14, 165, 233, 0.05));
}

    #loginModal .forgot-password:hover {
        color: #1d4ed8;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(14, 165, 233, 0.15));
        text-decoration: none;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    }

/* ==== Botón Principal - Gradiente Elegante ==== */
#loginModal .modal-content button {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #1e40af 100%);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    margin-top: 16px;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

    #loginModal .modal-content button::before {
        content: "";
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        transition: left 0.6s ease;
    }

    #loginModal .modal-content button:hover::before {
        left: 100%;
    }

    #loginModal .modal-content button:hover {
        background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 50%, #1e3a8a 100%);
        box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
        transform: translateY(-3px) scale(1.02);
    }

    #loginModal .modal-content button:active {
        transform: translateY(-1px) scale(1.01);
        box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    }

/* ==== Mensaje de Seguridad Premium ==== */
#loginModal .security-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 14px;
    font-size: 14px;
    color: #0f172a;
    border: 1px solid rgba(14, 165, 233, 0.2);
    font-weight: 500;
}

    #loginModal .security-message::before {
        content: "";
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #0ea5e9, #0284c7);
        mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.623 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z'/%3e%3c/svg%3e") no-repeat center;
        -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='currentColor'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.623 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z'/%3e%3c/svg%3e") no-repeat center;
    }

/* ==== Divisor Elegante ==== */
#loginModal .divider {
    display: flex;
    align-items: center;
    margin: 32px 0;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
}

    #loginModal .divider::before,
    #loginModal .divider::after {
        content: "";
        flex: 1;
        height: 2px;
        background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    }

    #loginModal .divider::before {
        margin-right: 20px;
    }

    #loginModal .divider::after {
        margin-left: 20px;
    }

/* ==== Botón Secundario Premium ==== */
#loginModal .secondary-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    color: #475569;
    border: 2px solid #bae6fd;
    border-radius: 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

    #loginModal .secondary-button:hover {
        background: linear-gradient(145deg, #f8fafc, #f1f5f9);
        border-color: #3b82f6;
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
        color: #1e293b;
    }

/* ==== Enlaces Adicionales ==== */
#loginModal .additional-links {
    text-align: center;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 2px solid rgba(186, 230, 253, 0.5);
}

    #loginModal .additional-links p {
        font-size: 16px;
        color: #64748b;
        margin: 0 0 16px 0;
        line-height: 1.6;
        font-weight: 500;
    }

    #loginModal .additional-links a {
        color: #3b82f6;
        text-decoration: none;
        font-weight: 700;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 10px;
        padding: 8px 16px;
        display: inline-block;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(14, 165, 233, 0.08));
    }

        #loginModal .additional-links a:hover {
            color: #1d4ed8;
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(14, 165, 233, 0.18));
            text-decoration: none;
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
        }

/* ==== Estados de Error Mejorados ==== */
#loginModal .error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 14px;
    font-size: 15px;
    margin-bottom: 24px;
    display: none;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

#loginModal .input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
    background: linear-gradient(145deg, #fef2f2, #ffffff) !important;
}

/* ==== Indicador de Carga Premium ==== */
#loginModal .loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

    #loginModal .loading::after {
        content: "";
        position: absolute;
        width: 24px;
        height: 24px;
        margin: auto;
        border: 3px solid transparent;
        border-top: 3px solid #ffffff;
        border-right: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==== Responsive Mejorado ==== */
@media (max-width: 520px) {
    #loginModal .modal-content {
        width: 94%;
        padding: 40px 32px 36px;
        margin: 20px;
        border-radius: 20px;
    }

        #loginModal .modal-content h2 {
            font-size: 28px;
        }

    #loginModal .modal-subtitle {
        font-size: 16px;
        margin-bottom: 36px;
    }

    #loginModal .modal-content input,
    #loginModal .modal-content button {
        font-size: 16px;
        padding: 18px 20px;
    }

    #loginModal .form-extras {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    #loginModal .modal-header::before {
        width: 56px;
        height: 56px;
        margin-bottom: 20px;
    }
}

@media (max-width: 360px) {
    #loginModal .modal-content {
        padding: 32px 24px 28px;
        width: 96%;
    }

        #loginModal .modal-content h2 {
            font-size: 26px;
        }
}

/* ==== Tema Oscuro Premium ==== */
@media (prefers-color-scheme: dark) {
    #loginModal.modal {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.15), rgba(51, 65, 85, 0.15)), rgba(2, 6, 23, 0.95);
    }

    #loginModal .modal-content {
        background: linear-gradient(145deg, #0f172a 0%, #1e293b 50%, #334155 100%);
        border-color: rgba(59, 130, 246, 0.2);
        color: #f1f5f9;
    }

        #loginModal .modal-content h2 {
            background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 50%, #3b82f6 100%);
            background-clip: content-box;
            -webkit-background-clip: content-box;
            -webkit-text-fill-color: transparent;
        }

    #loginModal .modal-subtitle {
        color: #94a3b8;
    }

    #loginModal .input-label {
        color: #f1f5f9;
    }

    #loginModal .modal-content input {
        background: linear-gradient(145deg, #1e293b, #334155);
        border-color: #475569;
        color: #f1f5f9;
    }

        #loginModal .modal-content input:focus {
            border-color: #3b82f6;
            background: #334155;
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
        }

    #loginModal .security-message {
        background: linear-gradient(135deg, #1e293b, #334155);
        color: #cbd5e1;
        border-color: rgba(14, 165, 233, 0.3);
    }

    #loginModal .secondary-button {
        background: linear-gradient(145deg, #1e293b, #334155);
        border-color: #475569;
        color: #cbd5e1;
    }

        #loginModal .secondary-button:hover {
            border-color: #3b82f6;
            background: linear-gradient(145deg, #334155, #475569);
        }
}

/* ALERTAS */
.alert {
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.95rem;
    animation: fadeIn 0.4s ease-in-out;
}

.alert-danger {
    background-color: #ffdddd;
    border: 1px solid #f44336;
    color: #b71c1c;
}

.alert-success {
    background-color: #ddffdd;
    border: 1px solid #4CAF50;
    color: #1b5e20;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}




/* ===== MEJORAS ESPECÍFICAS PARA MÓVILES - LOGIN CON TECLADO ===== */
@media (max-width: 768px) {
    /* MODAL MÁS COMPACTO Y OPTIMIZADO PARA TECLADO */
    #loginModal.modal {
        align-items: flex-start; /* Alinear arriba para mejor visibilidad con teclado */
        padding: 10px;
        overflow-y: auto; /* Permitir scroll si es necesario */
        -webkit-overflow-scrolling: touch;
    }

    /* CONTENEDOR MÁS COMPACTO Y ALTO */
    #loginModal .modal-content {
        width: 95%;
        max-width: 400px;
        padding: 30px 25px 25px;
        margin: 20px auto;
        border-radius: 20px;
        max-height: 90vh; /* Limitar altura máxima */
        overflow-y: auto; /* Scroll interno si es necesario */
        animation: modalSlideInMobile 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* ANIMACIÓN OPTIMIZADA PARA MÓVILES */
    @keyframes modalSlideInMobile {
        from {
            transform: scale(0.95) translateY(20px);
            opacity: 0;
        }

        to {
            transform: scale(1) translateY(0);
            opacity: 1;
        }
    }

    /* HEADER MÁS COMPACTO */
    #loginModal .modal-header {
        margin-bottom: 25px;
    }

        #loginModal .modal-header::before {
            width: 50px;
            height: 50px;
            margin-bottom: 15px;
            border-radius: 15px;
        }

        #loginModal .modal-header::after {
            top: 14px;
            font-size: 22px;
        }

    /* TÍTULOS MÁS PEQUEÑOS */
    #loginModal .modal-content h2 {
        font-size: 24px;
        margin-bottom: 12px;
        letter-spacing: -0.5px;
    }

    #loginModal .modal-subtitle {
        font-size: 14px;
        margin-bottom: 25px;
        line-height: 1.5;
        max-width: 100%;
    }

    /* FORMULARIO MÁS COMPACTO */
    #loginModal form {
        gap: 20px;
    }

    /* INPUTS OPTIMIZADOS PARA TECLADO */
    #loginModal .modal-content input {
        padding: 16px 18px;
        font-size: 16px; /* IMPORTANTE: Prevenir zoom en iOS */
        border-radius: 12px;
        min-height: 52px; /* Altura mínima para toques */
        border-width: 1.5px;
    }

        #loginModal .modal-content input:focus {
            transform: none; /* Eliminar transform en focus para evitar saltos */
            border-width: 2px;
        }

    /* ETIQUETAS MÁS COMPACTAS */
    #loginModal .input-label {
        font-size: 14px;
        margin-bottom: 6px;
        gap: 8px;
    }

        #loginModal .input-label::before {
            width: 18px;
            height: 18px;
        }

    /* EXTRAS DEL FORMULARIO MÁS COMPACTOS */
    #loginModal .form-extras {
        margin: -5px 0 12px 0;
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    #loginModal .remember-me {
        font-size: 14px;
        gap: 10px;
    }

        #loginModal .remember-me input[type="checkbox"] {
            width: 18px;
            height: 18px;
        }

    #loginModal .forgot-password {
        font-size: 14px;
        padding: 5px 10px;
    }

    /* BOTÓN PRINCIPAL OPTIMIZADO */
    #loginModal .modal-content button {
        padding: 16px;
        font-size: 16px;
        border-radius: 12px;
        min-height: 54px; /* Altura mínima para toques */
        margin-top: 10px;
    }

        #loginModal .modal-content button:hover {
            transform: none; /* Eliminar transform en hover para móviles */
        }

    /* MENSAJE DE SEGURIDAD COMPACTO */
    #loginModal .security-message {
        margin-top: 20px;
        padding: 12px 16px;
        font-size: 13px;
        border-radius: 10px;
        gap: 8px;
    }

        #loginModal .security-message::before {
            width: 18px;
            height: 18px;
        }

    /* DIVISOR COMPACTO */
    #loginModal .divider {
        margin: 25px 0;
        font-size: 14px;
    }

        #loginModal .divider::before {
            margin-right: 15px;
        }

        #loginModal .divider::after {
            margin-left: 15px;
        }

    /* BOTÓN SECUNDARIO COMPACTO */
    #loginModal .secondary-button {
        padding: 14px;
        font-size: 15px;
        border-radius: 12px;
        min-height: 50px;
        margin-bottom: 15px;
        gap: 10px;
    }

        #loginModal .secondary-button:hover {
            transform: none;
        }

    /* ENLACES ADICIONALES COMPACTOS */
    #loginModal .additional-links {
        margin-top: 25px;
        padding-top: 20px;
    }

        #loginModal .additional-links p {
            font-size: 14px;
            margin-bottom: 12px;
        }

        #loginModal .additional-links a {
            font-size: 14px;
            padding: 6px 12px;
        }

    /* BOTÓN DE CIERRE MÁS ACCESIBLE */
    #loginModal .close-modal {
        top: 15px;
        right: 18px;
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    /* VERSIÓN AÚN MÁS COMPACTA PARA MÓVILES PEQUEÑOS */
    #loginModal.modal {
        padding: 5px;
    }

    #loginModal .modal-content {
        padding: 25px 20px 20px;
        width: 98%;
        margin: 10px auto;
    }

        #loginModal .modal-content h2 {
            font-size: 22px;
        }

    #loginModal .modal-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    #loginModal form {
        gap: 18px;
    }

    #loginModal .modal-content input {
        padding: 14px 16px;
        min-height: 48px;
    }

    #loginModal .modal-content button {
        padding: 14px;
        min-height: 50px;
        font-size: 15px;
    }

    #loginModal .secondary-button {
        padding: 12px;
        min-height: 46px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    /* VERSIÓN MÍNIMA PERO FUNCIONAL */
    #loginModal .modal-content {
        padding: 20px 15px 15px;
    }

        #loginModal .modal-content h2 {
            font-size: 20px;
        }

        #loginModal .modal-content input {
            padding: 12px 14px;
            min-height: 44px;
        }

        #loginModal .modal-content button {
            padding: 12px;
            min-height: 46px;
        }
}

/* MEJORAS ESPECÍFICAS PARA CUANDO EL TECLADO ESTÁ ABIERTO */
@media (max-width: 768px) and (max-height: 500px) {
    /* Cuando el teclado ocupa mucho espacio */
    #loginModal.modal {
        align-items: flex-start;
        padding-top: 5px;
    }

    #loginModal .modal-content {
        margin: 5px auto;
        max-height: 95vh;
    }

    #loginModal .modal-header {
        margin-bottom: 15px;
    }

        #loginModal .modal-header::before {
            width: 40px;
            height: 40px;
            margin-bottom: 10px;
        }

    #loginModal form {
        gap: 15px;
    }

    #loginModal .security-message,
    #loginModal .divider,
    #loginModal .additional-links {
        display: none; /* Ocultar elementos no esenciales cuando hay poco espacio */
    }
}

/* OPTIMIZACIONES PARA TECLADO EN MÓVILES */
@media (max-width: 768px) {
    /* Prevenir zoom en inputs en iOS */
    #loginModal .modal-content input[type="email"],
    #loginModal .modal-content input[type="password"],
    #loginModal .modal-content input[type="text"] {
        font-size: 16px !important; /* Crucial para prevenir zoom */
    }

    /* Mejorar áreas táctiles */
    #loginModal .modal-content input,
    #loginModal .modal-content button,
    #loginModal .secondary-button,
    #loginModal .close-modal,
    #loginModal .forgot-password,
    #loginModal .remember-me {
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

        /* Estados táctiles con feedback visual */
        #loginModal .modal-content button:active,
        #loginModal .secondary-button:active,
        #loginModal .forgot-password:active {
            transform: scale(0.98);
            opacity: 0.9;
            transition: transform 0.1s ease, opacity 0.1s ease;
        }

        /* Eliminar efectos que no funcionan bien en móviles */
        #loginModal .modal-content button::before,
        #loginModal .modal-content button:hover::before {
            display: none; /* Eliminar efecto de shine que consume recursos */
        }

        #loginModal .modal-content input:focus {
            transform: none; /* Eliminar transform que puede causar saltos */
        }

    /* Scroll suave para iOS */
    #loginModal .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* MEJORAS DE ACCESIBILIDAD CON TECLADO */
@media (max-width: 768px) {
    #loginModal .modal-content input:focus,
    #loginModal .modal-content button:focus,
    #loginModal .secondary-button:focus,
    #loginModal .close-modal:focus,
    #loginModal .forgot-password:focus {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
    }

    /* Asegurar contraste adecuado en exteriores */
    #loginModal .modal-content {
        background: #ffffff;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    }
}

/* SOPORTE PARA DISPOSITIVOS CON NOTCH */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        #loginModal.modal {
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
            padding-top: max(10px, env(safe-area-inset-top));
            padding-bottom: max(10px, env(safe-area-inset-bottom));
        }
    }
}
