/* ============================================
   Auth Pages - Diseño Moderno y Profesional
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%);
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.auth-container {
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 1;
    margin: auto;
    padding: 20px 0;
}

.auth-box {
    background: var(--white);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.5s ease;
}

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

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    font-weight: bold;
    margin-bottom: 16px;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.auth-box h1 {
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
}

.subtitle {
    color: var(--gray);
    margin-bottom: 24px;
    font-size: 14px;
    text-align: center;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    background: var(--white);
    color: var(--dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-light);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--gray);
    font-size: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
    font-family: inherit;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--dark);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid;
    animation: slideDown 0.3s ease;
}

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

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border-color: var(--danger);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-color: var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border-color: #f59e0b;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border-color: #3b82f6;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--gray);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--gray);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
}

.social-login {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s;
}

.social-btn:hover {
    border-color: var(--primary);
    background: var(--bg);
    transform: translateY(-2px);
}

.password-toggle {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 0.3s;
}

.password-toggle-btn:hover {
    color: var(--primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.forgot-password {
    text-align: right;
    margin-top: -16px;
    margin-bottom: 20px;
}

.forgot-password a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.forgot-password a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .auth-box {
        padding: 32px 24px;
    }
    
    .auth-box h1 {
        font-size: 26px;
    }
    
    .social-login {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Mejoras Touch y Accesibilidad
   ============================================ */

/* Touch-friendly buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
    }
    
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    .social-btn:active {
        transform: scale(0.98);
    }
}

/* Focus visible para accesibilidad */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

input:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mejoras para formularios */
.form-group input::placeholder {
    opacity: 0.6;
}

.form-group input:disabled {
    background: var(--bg);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Input error state */
.form-group input.error {
    border-color: var(--danger);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Safe area para iPhone X+ */
@supports (padding: max(0px)) {
    .auth-container {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #4338ca 0%, #5b21b6 100%);
    }
    
    .auth-box {
        background: #1e293b;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .auth-box h1,
    .form-group label {
        color: #f1f5f9;
    }
    
    .subtitle,
    .auth-footer,
    .form-group small {
        color: #94a3b8;
    }
    
    .form-group input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    .form-group input:focus {
        border-color: var(--primary);
        background: #1e293b;
    }
    
    .form-group input::placeholder {
        color: #64748b;
    }
    
    .social-btn {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    .social-btn:hover {
        background: #1e293b;
    }
}
