
:root {
    --primary-color: #4F46E5;
    --primary-dark: #3730A3;
    --secondary-color: #F3F4F6;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --dark-color: #1F2937;
    --light-color: #FFFFFF;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: var(--light-color);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 600px;
}

.login-brand {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>') center/cover;
    opacity: 0.3;
}

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

.brand-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo i {
    font-size: 2.5rem;
    color: var(--light-color);
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--light-color);
    margin-bottom: 15px;
    letter-spacing: -0.025em;
}

.brand-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    line-height: 1.5;
}

.login-form-section {
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-header {
    margin-bottom: 40px;
    text-align: center;
}

.form-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.form-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

.form-control {
    width: 100%;
    padding: 16px 20px;
    padding-right: 50px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--light-color);
    transition: all 0.2s ease-in-out;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background-color: var(--light-color);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.input-icon {
    position: absolute;
    right: 16px;
    color: var(--text-secondary);
    font-size: 1.125rem;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease-in-out;
}

.input-icon:hover {
    color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-transform: none;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.spinner-border {
    width: 1.2rem;
    height: 1.2rem;
    border-width: 2px;
}

.btn-text {
    transition: opacity 0.2s ease-in-out;
}

.btn-primary:disabled .btn-text {
    opacity: 0;
}

.btn-primary:disabled .btn-loading {
    display: block;
}

.alert {
    border: none;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.alert i {
    margin-right: 8px;
    font-size: 1rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 6px;
    font-weight: 500;
}

.form-control.is-valid {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.security-info {
    margin-top: 30px;
    padding: 20px;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.security-info h6 {
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.security-info p {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: 0;
    line-height: 1.4;
}

/* Overlay de redirection */
.redirect-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.redirect-overlay.show {
    opacity: 1;
    visibility: visible;
}

.redirect-content {
    background: var(--light-color);
    padding: 50px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    max-width: 450px;
    width: 90%;
    transform: translateY(20px);
    transition: transform 0.3s ease-in-out;
}

.redirect-overlay.show .redirect-content {
    transform: translateY(0);
}

.redirect-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: pulse-success 2s infinite;
}

.redirect-icon i {
    font-size: 2.5rem;
    color: var(--light-color);
}

@keyframes pulse-success {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.redirect-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    letter-spacing: -0.025em;
}

.redirect-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

.redirect-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.redirect-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.redirect-loader-text {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.redirect-progress {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.redirect-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    width: 0%;
    transition: width 0.3s ease-in-out;
    animation: progress 3s ease-in-out;
}

@keyframes progress {
    0% {
        width: 0%;
    }
    100% {
        width: 100%;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
        max-width: 450px;
        margin: 20px;
    }

    .login-brand {
        padding: 40px 30px;
        min-height: 300px;
    }

    .login-form-section {
        padding: 40px 30px;
    }

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

    .brand-subtitle {
        font-size: 1rem;
    }

    .form-header h1 {
        font-size: 1.5rem;
    }

    .redirect-content {
        padding: 40px 30px;
    }

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

    .redirect-message {
        font-size: 1rem;
    }
}

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

    .login-container {
        margin: 10px;
    }

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

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

    .redirect-content {
        padding: 30px 20px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .btn-primary {
        border: 2px solid var(--primary-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
    
    .redirect-spinner {
        animation: none !important;
    }
    
    .redirect-progress-bar {
        animation: none !important;
    }
    
    .redirect-icon {
        animation: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .form-control::placeholder {
        color: #9CA3AF;
    }
}

/* Print styles */
@media print {
    .login-container {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .redirect-overlay {
        display: none !important;
    }
}