/* Reset y Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --primary-color: #14b8a6;
    --primary-dark: #0d9488;
    --primary-light: #5eead4;
    --secondary-color: #ef4444;
    --secondary-dark: #dc2626;
    
    /* Colores de texto */
    --text-primary: #1a1a1a;
    --text-secondary: #4b5563;
    --text-light: #6b7280;
    --text-white: #ffffff;
    
    /* Colores de fondo */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-light: #fafafa;
    --bg-white: #ffffff;
    
    /* Bordes */
    --border-color: #e5e7eb;
    --border-focus: var(--primary-color);
    --border-error: var(--secondary-color);
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
    
    /* Espaciado */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Body y Layout */
body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

.login-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(165deg, #0f172a 0%, #1e293b 50%, #1f3a3a 100%);
    position: relative;
    overflow-x: hidden;
}

/* Efectos de fondo animados */
.login-body::before,
.login-body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.login-body::before {
    top: -25%;
    right: -15%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.08) 0%, transparent 70%);
    animation: float 20s ease-in-out infinite;
}

.login-body::after {
    bottom: -20%;
    left: -10%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.08) 0%, transparent 70%);
    animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    33% {
        transform: translate(30px, -30px) scale(1.05);
        opacity: 0.8;
    }
    66% {
        transform: translate(-20px, 20px) scale(0.95);
        opacity: 0.9;
    }
}

/* Navbar */
.navbar {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(26, 26, 26, 0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    padding: var(--spacing-md) var(--spacing-2xl);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-smooth);
}

.logo img {
    width: 250%;
    height: 250%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(20, 184, 166, 0.4));
}

.logo:hover {
    transform: scale(1.08) rotate(-3deg);
    filter: drop-shadow(0 6px 20px rgba(20, 184, 166, 0.6));
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f9fafb 0%, #14b8a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.back-btn:hover {
    background: linear-gradient(135deg, var(--secondary-dark), #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

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

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    position: relative;
    z-index: 10;
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.98);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    padding: var(--spacing-2xl);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.alert svg {
    flex-shrink: 0;
}

.alert-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border-left: 4px solid var(--border-error);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #14532d;
    border-left: 4px solid #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

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

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.required {
    color: var(--secondary-color);
}

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

.input-icon {
    position: absolute;
    left: var(--spacing-md);
    color: var(--text-light);
    pointer-events: none;
    transition: color var(--transition-base);
    z-index: 1;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-base);
}

.form-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.form-input:hover {
    border-color: #d1d5db;
    background: var(--bg-white);
}

.form-input:focus {
    border-color: var(--border-focus);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

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

.toggle-password {
    position: absolute;
    right: var(--spacing-md);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition-base);
}

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

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

/* Submit Button */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.3);
    position: relative;
    overflow: hidden;
}

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

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

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(20, 184, 166, 0.4);
}

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

.btn-submit svg {
    transition: transform var(--transition-base);
}

.btn-submit:hover svg {
    transform: translateX(4px);
}

/* Form Footer */
.form-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.link-forgot {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    transition: color var(--transition-base);
}

.link-forgot::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-base);
}

.link-forgot:hover {
    color: var(--primary-dark);
}

.link-forgot:hover::after {
    width: 100%;
}

.divider {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--spacing-md);
    color: var(--text-light);
    font-size: 0.9rem;
}

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

.register-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
}

.link-register {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 700;
    position: relative;
    transition: color var(--transition-base);
}

.link-register::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: width var(--transition-base);
}

.link-register:hover {
    color: var(--secondary-dark);
}

.link-register:hover::after {
    width: 100%;
}

/* Social Login Buttons */
.social-login-section {
    margin-top: var(--spacing-md);
    width: 100%;
}

.social-divider {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--spacing-md);
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: var(--spacing-lg);
}

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

.social-divider span {
    white-space: nowrap;
    font-weight: 500;
}

.social-buttons {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-btn svg {
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.social-btn:hover svg {
    transform: scale(1.1);
}

.social-ripple {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.25);
    transform: translate(-50%, -50%) scale(0);
    animation: socialRipple 0.55s ease-out forwards;
    pointer-events: none;
}

@keyframes socialRipple {
    to {
        transform: translate(-50%, -50%) scale(16);
        opacity: 0;
    }
}

/* Interactive auth states */
.auth-reveal {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
}

.auth-ready .auth-reveal {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.45s ease, transform 0.45s ease;
    transition-delay: calc(var(--reveal-index, 0) * 45ms);
}

.input-wrapper.has-value .input-icon {
    color: var(--primary-color);
}

.btn-submit.is-loading {
    pointer-events: none;
    opacity: 0.9;
}

.btn-submit.is-loading::before {
    display: none;
}

.btn-submit.is-loading::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    transform: translateY(-50%);
    animation: authSpinButton 0.8s linear infinite;
}

.btn-submit.is-loading svg {
    display: none;
}

.oauth-launch-toast {
    position: fixed;
    top: 96px;
    right: 22px;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.oauth-launch-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.oauth-launch-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(226, 232, 240, 0.35);
    border-top-color: #14b8a6;
    animation: authSpin 0.8s linear infinite;
    flex-shrink: 0;
}

.oauth-launch-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.oauth-launch-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f8fafc;
}

.oauth-launch-detail {
    font-size: 0.76rem;
    color: #cbd5e1;
    line-height: 1.3;
}

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

@keyframes authSpinButton {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

@media (max-width: 640px) {
    .oauth-launch-toast {
        top: 88px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* Google Button */
.google-btn:hover {
    border-color: #4285F4;
    background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.25);
}

/* GitHub Button */
.github-btn:hover {
    border-color: #333;
    background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
    box-shadow: 0 4px 16px rgba(51, 51, 51, 0.25);
}

/* Responsive Social Buttons */
@media (max-width: 480px) {
    .social-buttons {
        flex-direction: column;
    }
    
    .social-btn span {
        display: inline;
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .navbar {
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .login-container {
        padding: var(--spacing-xl) var(--spacing-lg);
    }

    .login-title {
        font-size: 1.75rem;
    }

    .logo {
        width: 50px;
        height: 50px;
    }

    .brand-name {
        font-size: 1.25rem;
    }

    .back-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .login-container {
        padding: var(--spacing-lg);
    }

    .login-title {
        font-size: 1.5rem;
    }

    .login-subtitle {
        font-size: 0.9rem;
    }

    .form-input {
        font-size: 0.95rem;
        padding: 12px 14px 12px 44px;
    }
}

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

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

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

.navbar {
    transition: transform var(--transition-base) ease;
    transform: translateY(0);
}

.navbar-hidden {
    transform: translateY(-100%);
}

.navbar-visible {
    transform: translateY(0);
}