/**
 * ESTILOS PARA MODAL DE AUTENTICACIÓN POR EMAIL
 * Diseño consistente con ChainFeed
 */

/* Overlay del modal */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Contenedor del modal */
.auth-modal {
    background: linear-gradient(135deg, rgba(26, 26, 36, 0.98), rgba(15, 15, 20, 0.98));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botón cerrar */
.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.auth-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: rotate(90deg);
}

/* Header del modal */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Botones de método de autenticación */
.auth-methods {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-method-btn {
    width: 100%;
    padding: 24px 30px;
    background: linear-gradient(135deg, rgb(99 102 241 / 0%), rgb(139 92 246 / 10%));
    border: 0.5px solid rgb(99 102 241 / 32%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s 
ease;
    position: relative;
    overflow: hidden;
}

.auth-method-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    transition: left 0.5s ease;
}

.auth-method-btn:hover::before {
    left: 100%;
}

.auth-method-btn:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
}

.method-icon {
    font-size: 48px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.method-content {
    flex: 1;
    text-align: center;
}

.method-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.method-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

.method-arrow {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

/* Botón volver */
.auth-back-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.auth-back-btn:hover {
    opacity: 0.7;
    transform: translateX(-4px);
}

/* Formularios */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.form-input {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Botón submit */
.auth-submit-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Footer del formulario */
.auth-footer {
    text-align: center;
    margin-top: 16px;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.auth-link:hover {
    opacity: 0.7;
}

/* Mensajes de error */
.auth-error {
    background: rgb(6 4 93 / 10%);
    border: 2px solid rgb(3 2 16 / 40%);
    border-radius: 20px;
    color: #263f87;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
}

/* Mensajes de éxito */
.auth-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    color: #10b981;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-modal {
        padding: 24px;
        width: 95%;
        max-height: 95vh;
    }
    
    .method-icon {
        font-size: 36px;
    }
    
    .method-title {
        font-size: 18px;
    }
}

/* Scrollbar personalizada para modal */
.auth-modal::-webkit-scrollbar {
    width: 8px;
}

.auth-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.auth-modal::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.auth-modal::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* ================================================
   NOTIFICACIONES TOAST ESTILO CHAINFEED
   ================================================ */

.toast-container {
    position: fixed;
    top: 100px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
}

.toast {
    background: linear-gradient(135deg, rgba(26, 26, 36, 0.98), rgba(15, 15, 20, 0.98));
    border: 2px solid;
    border-radius: 16px;
    padding: 20px 24px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    pointer-events: auto;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Tipos de toast */
.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
}

.toast.success::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #10b981, #34d399);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
}

.toast.error::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ef4444, #f87171);
}

.toast.info {
    border-color: rgba(99, 102, 241, 0.5);
}

.toast.info::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.toast.warning {
    border-color: rgba(245, 158, 11, 0.5);
}

.toast.warning::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #f59e0b, #fbbf24);
}

/* Icono del toast */
.toast-icon {
    font-size: 32px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px currentColor);
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info .toast-icon {
    color: var(--primary);
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

/* Contenido del toast */
.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-line;
}

/* Botón cerrar */
.toast-close {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Barra de progreso */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    animation: progressBar 5s linear forwards;
    opacity: 0.5;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

.toast.success .toast-progress {
    color: #10b981;
}

.toast.error .toast-progress {
    color: #ef4444;
}

.toast.info .toast-progress {
    color: var(--primary);
}

.toast.warning .toast-progress {
    color: #f59e0b;
}

/* Responsive */
@media (max-width: 768px) {
    .toast-container {
        right: 16px;
        left: 16px;
        top: 80px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}


/* ================================================
   ESTILOS PARA RECUPERACIÓN DE CONTRASEÑA
   Manteniendo el diseño existente de ChainFeed
   ================================================ */

/* Contenedor de inputs de contraseña con toggle */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    z-index: 2;
}

.password-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* Mensajes de error específicos para contraseñas */
.form-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
    display: none;
}

/* Asegurar que los inputs de contraseña tengan padding extra para el toggle */
.password-input-container .form-input {
    padding-right: 48px;
    width: 100%;
}

/* Estados de validación en tiempo real */
.form-input.invalid {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.form-input.valid {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

/* Mensaje de éxito específico para recuperación */
.auth-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
    display: none;
    line-height: 1.5;
}

/* Mejoras responsive para móviles */
@media (max-width: 768px) {
    .password-toggle {
        right: 10px;
        font-size: 16px;
    }
    
    .password-input-container .form-input {
        padding-right: 44px;
    }
}

/* Animación sutil para cambios de estado */
.password-input-container .form-input {
    transition: all 0.3s ease;
}

/* Estilo para el token hidden input */
input[type="hidden"] {
    display: none;
}

/* Mejora visual para los grupos de formulario en recuperación */
#auth-reset-view .form-group,
#auth-newpassword-view .form-group {
    margin-bottom: 8px;
}

/* Espaciado adicional en la vista de nueva contraseña */
#auth-newpassword-view .auth-form {
    gap: 24px;
}

/* Enlaces de recuperación lado a lado */
#recovery-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

#recovery-links .auth-link {
    white-space: nowrap;
}

/* Responsive: en móvil, uno debajo del otro */
@media (max-width: 480px) {
    #recovery-links {
        flex-direction: column;
        gap: 8px;
    }
}

/* ========================================
   PASSWORD INPUT CONTAINER
   ======================================== */

.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container .form-input {
    padding-right: 50px; /* Espacio para el botón */
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    z-index: 10;
}

.password-toggle:hover {
    transform: scale(1.1);
}

.password-toggle:active {
    transform: scale(0.95);
}