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

:root {
    --primary-color: #3b82f6;
    --secondary-color: #2563eb;
    --accent-color: #60a5fa;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #2563eb;
    --text-secondary: #3b82f6;
    --border-color: #3b82f6;
    --error-bg: #7f1d1d;
    --error-text: #fca5a5;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text-primary);
    position: relative;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 6px;
    border: 3px solid transparent;
    background-clip: content-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    background-clip: content-box;
    border: 2px solid transparent;
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 transparent;
}

/* Animaciones de fondo */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.sphere-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #5ddbff, #3ec9ff);
    top: -100px;
    left: -100px;
    animation: float 15s ease-in-out infinite;
}

.sphere-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #7ff3ff, #3ec9ff);
    bottom: -50px;
    right: -50px;
    animation: float 20s ease-in-out infinite reverse;
    animation-delay: 2s;
}

.sphere-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #3ec9ff, #7ff3ff);
    top: 50%;
    left: 50%;
    animation: float 25s ease-in-out infinite;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(30px, -30px);
    }
    50% {
        transform: translate(-30px, 30px);
    }
    75% {
        transform: translate(30px, 30px);
    }
}

/* Login Wrapper */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    width: 100%;
    max-width: 1200px;
    height: 600px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    animation: slideInUp 0.6s ease-out;
}

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

/* Left Side - Branding */
.login-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(37, 99, 235, 0.05) 100%);
    background-size: cover;
    background-position: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.login-branding::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(93, 219, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.brand-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #5ddbff, #3ec9ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 40px;
    color: white;
    box-shadow: 0 10px 30px rgba(93, 219, 255, 0.3);
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.brand-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #5ddbff, #3ec9ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.feature-item i {
    color: var(--success-color);
    font-size: 18px;
}

.feature-item:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}

/* Right Side - Form */
.login-form-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.form-wrapper {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.form-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.form-header h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-header p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    display: flex;
    gap: 14px;
    padding: 16px 18px 16px 16px;
    border-radius: 12px;
    margin: -40px 0 24px 0;
    font-size: 15px;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    order: -1;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.alert::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    animation: barSlide 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes barSlide {
    from {
        width: 0;
    }
    to {
        width: 6px;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) rotateX(10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateX(0deg);
    }
}

.alert i {
    font-size: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    animation: iconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconBounce {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.alert-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.alert-content p {
    margin: 0;
    line-height: 1.4;
    font-weight: 600;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #fca5a5;
    color: #7f1d1d;
}

.alert-error:hover {
    box-shadow: 0 12px 32px rgba(220, 38, 38, 0.4);
    border-color: #f87171;
    transform: translateY(-2px);
}

.alert-error i {
    color: #dc2626;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    justify-content: space-between;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 56px;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 16px;
    z-index: 2;
    transition: all 0.3s ease;
}

.form-input {
    width: 100%;
    padding: 18px 16px 18px 48px;
    background: transparent;
    border: none;
    color: #000000;
    font-size: 18px;
    outline: none;
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: rgba(203, 213, 225, 0.5);
}

.input-wrapper:focus-within {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-wrapper:focus-within i {
    color: var(--primary-color);
}

.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 3;
    font-weight: 600;
}

.toggle-password:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

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

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    font-size: 17px;
    flex-shrink: 0;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.remember-me input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.remember-me label {
    cursor: pointer;
    color: var(--text-secondary);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    font-size: 17px;
}

.forgot-password {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.forgot-password:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Submit Button */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.submit-btn::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;
}

.submit-btn:hover:not(.loading) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(62, 201, 255, 0.4);
}

.submit-btn:hover:not(.loading)::before {
    left: 100%;
}

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

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.submit-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.submit-btn:hover:not(.loading) i {
    transform: translateX(4px);
}

/* Responsive Design */
@media (max-width: 900px) {
    .login-container {
        grid-template-columns: 1fr;
        height: auto;
        max-width: 500px;
    }

    .login-branding {
        padding: 40px;
        min-height: 250px;
    }

    .login-form-container {
        padding: 40px;
    }

    .brand-content h1 {
        font-size: 24px;
    }

    .form-header h2 {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 10px;
    }

    .login-container {
        border-radius: 15px;
        height: auto;
    }

    .login-branding {
        padding: 30px 20px;
    }

    .login-form-container {
        padding: 30px 20px;
    }

    .form-wrapper {
        max-width: 100%;
    }

    .brand-content h1 {
        font-size: 20px;
    }

    .brand-content p {
        font-size: 14px;
    }

    .features {
        gap: 10px;
    }

    .feature-item {
        font-size: 12px;
    }

    .form-header h2 {
        font-size: 28px;
    }

    .form-header p {
        font-size: 16px;
    }

    .form-input {
        font-size: 17px;
        padding: 16px 14px 16px 40px;
    }

    .submit-btn {
        padding: 16px 20px;
        font-size: 17px;
    }

    .form-options {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* Loading State */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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