/* =========================================
   Variables CSS para consistencia
========================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #d1d5db;
    --bg-input: #fafafa;
    --bg-card: #ffffff;
    --bg-page: #f1f3f5;
    --shadow: 0 12px 40px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-lg: 16px;
}

/* =========================================
   Reset y Base
========================================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   Layout Principal
========================================= */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

/* Efecto de fondo animado opcional */
.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 20s linear infinite;
    opacity: 0.3;
}

@keyframes backgroundMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* =========================================
   Tarjeta de Login
========================================= */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    padding: 40px 35px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

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

/* =========================================
   Header
========================================= */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.auth-logo svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.auth-header h2 {
    font-size: 28px;
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

/* =========================================
   Formulario
========================================= */
.auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    transition: color 0.2s ease;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

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

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

.form-group input:focus + .input-icon {
    color: var(--primary);
}

/* Iconos en inputs (opcional) */
.input-icon {
    position: absolute;
    right: 16px;
    color: var(--text-light);
    transition: color 0.2s ease;
    pointer-events: none;
}

/* Toggle para mostrar/ocultar contraseña */
.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

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

/* Checkbox "Recordarme" */
.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.remember-me label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* =========================================
   Botón de Login
========================================= */
.btn-login {
    width: 100%;
    padding: 14px 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Estado de carga */
.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   Divisor
========================================= */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-light);
    font-size: 14px;
}

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

/* =========================================
   Footer
========================================= */
.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

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

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

/* =========================================
   Alertas/Mensajes
========================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

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

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* =========================================
   Responsive Design
========================================= */

/* Tablets */
@media (max-width: 768px) {
    .auth-wrapper {
        padding: 16px;
    }
    
    .auth-card {
        padding: 32px 28px;
    }
    
    .auth-header h2 {
        font-size: 26px;
    }
}

/* Móviles grandes */
@media (max-width: 480px) {
    .auth-wrapper {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .auth-card {
        padding: 28px 24px;
        border-radius: var(--radius);
        max-width: 100%;
    }
    
    .auth-logo {
        width: 56px;
        height: 56px;
        margin-bottom: 12px;
    }
    
    .auth-logo svg {
        width: 28px;
        height: 28px;
    }
    
    .auth-header {
        margin-bottom: 28px;
    }
    
    .auth-header h2 {
        font-size: 24px;
    }
    
    .auth-header p {
        font-size: 14px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input {
        padding: 12px 14px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .btn-login {
        padding: 13px 0;
        font-size: 15px;
    }
}

/* Móviles pequeños */
@media (max-width: 360px) {
    .auth-card {
        padding: 24px 20px;
    }
    
    .auth-header h2 {
        font-size: 22px;
    }
    
    .form-group input {
        padding: 11px 12px;
    }
}

/* Landscape en móviles */
@media (max-height: 600px) and (orientation: landscape) {
    .auth-wrapper {
        align-items: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    .auth-card {
        padding: 24px 28px;
    }
    
    .auth-header {
        margin-bottom: 20px;
    }
    
    .auth-logo {
        display: none;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
}

/* Pantallas grandes */
@media (min-width: 1024px) {
    .auth-card {
        padding: 48px 40px;
    }
    
    .auth-card:hover {
        box-shadow: 0 24px 70px rgba(0,0,0,0.15);
    }
}

/* Dark mode (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-light: #9ca3af;
        --border: #374151;
        --bg-input: #1f2937;
        --bg-card: #111827;
        --bg-page: #030712;
    }
    
    .auth-wrapper {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .form-group input {
        color: var(--text-primary);
    }
}