/* ==================== POPUP DE INICIO DE SESIÓN ==================== */

/* Overlay del popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Contenedor del popup */
.popup-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin: auto;
}

.popup-overlay.active .popup-container {
    transform: scale(1);
}

/* Header del popup */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid #e1e5e9;
}

.popup-title {
    font-size: 24px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8b8d94;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #f1f1f1;
    color: #d31515;
}

/* Cuerpo del popup */
.popup-body {
    padding: 30px;
}

/* Formulario */
.popup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    font-family: "Roboto", Helvetica, Arial, Verdana, sans-serif;
    color: #333333;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #d31515;
    box-shadow: 0 0 0 3px rgba(211, 21, 21, 0.1);
}

.form-input::placeholder {
    color: #8b8d94;
}

/* Input de contraseña con icono */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8b8d94;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #d31515;
}

.password-input-wrapper .form-input {
    padding-right: 45px;
}

/* Botones del formulario */
.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.btn-popup-primary {
    background: #d31515;
    color: white;
    border: 2px solid #d31515;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Roboto", Helvetica, Arial, Verdana, sans-serif;
    width: 100%;
}

.btn-popup-primary:hover {
    background: #b31212;
    border-color: #b31212;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(211, 21, 21, 0.3);
}

.btn-popup-primary:active {
    transform: translateY(0);
}

.btn-popup-primary:disabled {
    background: #8b8d94;
    border-color: #8b8d94;
    cursor: not-allowed;
    transform: none;
}

.btn-popup-secondary {
    background: white;
    color: #333333;
    border: 2px solid #e1e5e9;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Roboto", Helvetica, Arial, Verdana, sans-serif;
    width: 100%;
}

.btn-popup-secondary:hover {
    background: #f5f5f5;
    border-color: #d31515;
    color: #d31515;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-popup-secondary:active {
    transform: translateY(0);
}

/* Enlaces adicionales */
.popup-footer {
    margin-top: 20px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

.popup-footer-link {
    color: #d31515;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.popup-footer-link:hover {
    color: #b31212;
    text-decoration: underline;
}

/* Mensajes de error */
.form-error {
    color: #d31515;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.form-error.show {
    display: block;
}

.form-group.has-error .form-input {
    border-color: #d31515;
}

/* Loading state */
.btn-popup-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-popup-primary.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .popup-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .popup-container {
        max-width: 100%;
        margin: 0;
        border-radius: 12px 12px 0 0;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    .popup-header {
        padding: 20px;
    }

    .popup-title {
        font-size: 20px;
    }

    .popup-body {
        padding: 20px;
    }

    .form-input {
        font-size: 16px; /* Evita zoom en iOS */
    }
}

@media (max-width: 480px) {
    .popup-overlay {
        padding: 0;
        padding-top: 0;
    }

    .popup-container {
        border-radius: 0;
        max-height: 100vh;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .popup-body {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .popup-form {
        flex: 1;
    }
}

/* Animación de entrada */
@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-overlay.active .popup-container {
    animation: popupSlideIn 0.3s ease;
}

