/* ===========================================
   ESTILOS DE AUTENTICACIÓN
   =========================================== */

/* Fallback para iOS Safari */
.ios-fallback {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.ios-fallback p {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.ios-fallback .link-button {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: underline;
}

.ios-fallback .link-button:hover {
    color: var(--primary-light);
}

.fallback-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.fallback-buttons .link-button {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.fallback-buttons .link-button:hover {
    color: var(--primary-light);
    background: rgba(255, 255, 255, 0.05);
}

/* Botón de debug */
.debug-btn {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    color: #ffaa00;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: monospace;
}

.debug-btn:hover {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
    color: #ffcc00;
}

.debug-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form {
    width: 100%;
}

.auth-form-content {
    margin-bottom: var(--spacing-lg);
}

/* Divider para separar login de redes sociales */
.auth-divider {
    position: relative;
    text-align: center;
    margin: var(--spacing-lg) 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1;
}

.auth-divider span {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0 var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Botones sociales */
.social-auth {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 14px 20px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.social-icon {
    font-size: 1.2rem;
}

.google-button {
    background: rgba(66, 133, 244, 0.2);
    border: 1px solid rgba(66, 133, 244, 0.4);
    color: var(--text-primary);
}

.google-button:hover {
    background: rgba(66, 133, 244, 0.3);
    transform: translateY(-1px);
}

.apple-button {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

.apple-button:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

/* Enlaces de navegación */
.auth-links {
    margin-top: var(--spacing-lg);
}

.link-button {
    background: none;
    border: none;
    color: var(--primary-blue);
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    transition: var(--transition-fast);
}

.link-button:hover {
    color: var(--secondary-blue);
    text-decoration: none;
}

/* Mensajes de estado */
.error-message {
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.4);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    color: #FFB3B3;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: shake 0.5s ease-in-out;
}

.success-message {
    background: rgba(52, 199, 89, 0.2);
    border: 1px solid rgba(52, 199, 89, 0.4);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    color: #B3FFB3;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideDown 0.3s ease-out;
    margin-bottom: var(--spacing-md);
}

/* Checkbox personalizado */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 30px;
    min-height: 24px;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
    background: rgba(255, 255, 255, 0.15);
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Validación de campos */
.form-input.error {
    border-color: rgba(255, 59, 48, 0.6);
    background: rgba(255, 59, 48, 0.1);
    animation: shake 0.5s ease-in-out;
}

.form-input.success {
    border-color: rgba(52, 199, 89, 0.6);
    background: rgba(52, 199, 89, 0.1);
}

/* Fortaleza de contraseña */
.password-strength {
    margin-top: var(--spacing-xs);
    display: flex;
    gap: 4px;
}

.strength-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    flex: 1;
    transition: var(--transition-fast);
}

.strength-bar.weak {
    background: var(--error-red);
}

.strength-bar.medium {
    background: var(--warning-orange);
}

.strength-bar.strong {
    background: var(--success-green);
}

/* Estados de botones */
.glass-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.glass-button.loading {
    position: relative;
    color: transparent;
}

.glass-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: white;
}

/* Animaciones */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Logo de autenticación */
.auth-container .logo-container {
    margin-bottom: var(--spacing-xxl);
}

.auth-container .logo {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.3);
}

.auth-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-blue), var(--secondary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
}

/* Notificaciones temporales */
.network-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    color: white;
    font-weight: 600;
    z-index: 10000;
    animation: slideDown 0.3s ease-out;
}

.network-notification.success {
    background: rgba(52, 199, 89, 0.9);
    border: 1px solid rgba(52, 199, 89, 1);
}

.network-notification.warning {
    background: rgba(255, 149, 0, 0.9);
    border: 1px solid rgba(255, 149, 0, 1);
}

.network-notification.info {
    background: rgba(0, 122, 255, 0.9);
    border: 1px solid rgba(0, 122, 255, 1);
}

/* Responsive */
@media (max-width: 480px) {
    .auth-container {
        padding: var(--spacing-md);
    }
    
    .auth-container .logo {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .auth-container h1 {
        font-size: 2rem;
    }
    
    .social-button {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .checkbox-container {
        padding-left: 26px;
        font-size: 0.85rem;
    }
    
    .checkmark {
        height: 18px;
        width: 18px;
    }
    
    .checkbox-container .checkmark:after {
        left: 5px;
        top: 1px;
        width: 5px;
        height: 8px;
    }
}

/* Estilos adicionales para recordar contraseña */
.form-group-checkbox {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-right: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: #667eea;
    font-weight: bold;
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.checkbox-input:checked + .checkbox-custom {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.checkbox-input:checked + .checkbox-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.checkbox-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
}

.checkbox-label:hover .checkbox-custom {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.1);
}
