/* ================================================================ */
/* Modern Professional Login Page Styles - Optimized UX/UI */
/* ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body.login-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: #F9FAFB;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================================ */
/* Login Container - Split Screen Layout */
/* ================================================================ */
.login-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* ================================================================ */
/* Left Panel - Branding Section */
/* ================================================================ */
.login-left-panel {
    display: none;
    width: 45%;
    min-width: 480px;
    background: linear-gradient(135deg, #244B94 0%, #1A3A6F 100%);
    position: relative;
    padding: 56px 48px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    z-index: 1;
}

@media (min-width: 1200px) {
    .login-left-panel {
        display: flex;
        width: 48%;
    }
}

.login-background-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.08;
    overflow: hidden;
}

.login-background-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 100 C 20 0 50 0 100 100 Z' fill='white'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    mix-blend-mode: multiply;
    opacity: 0.4;
    animation: blob-animation 25s infinite ease-in-out;
}

.login-blob-1 {
    width: 300px;
    height: 300px;
    background: #3B82F6;
    top: 10%;
    right: 10%;
}

.login-blob-2 {
    width: 280px;
    height: 280px;
    background: #6366F1;
    bottom: 5%;
    left: -5%;
    animation-delay: 3s;
}

@keyframes blob-animation {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(40px, -60px) scale(1.15);
    }
    66% {
        transform: translate(-30px, 30px) scale(0.85);
    }
}

.login-brand-content {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand-header {
    display: grid;
    align-items: center;
    gap: 14px;
    margin-bottom: 64px;
}

.login-brand-icon {
    width: 200px;
    height: auto;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.login-brand-icon:hover {
    transform: scale(1.05);
}

.login-brand-icon i {
    font-size: 26px;
    color: #FFFFFF;
}

.login-brand-icon img,
.login-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 10px;
}

.login-brand-title {
    font-size: 26px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    margin: 0;
}

.login-brand-info {
    margin-top: 0;
}

.login-brand-heading {
    font-size: 40px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.25;
    margin-bottom: 28px;
    letter-spacing: -0.03em;
}

.login-brand-accent {
    color: #A5B4FC;
    display: block;
    margin-top: 12px;
}

.login-brand-description {
    font-size: 17px;
    color: #C7D2FE;
    line-height: 1.7;
    max-width: 420px;
    margin-top: 0;
    font-weight: 400;
}

.login-stats-card {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 360px;
    margin-top: 48px;
}

.login-stats-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.login-stats-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-stats-icon i {
    font-size: 22px;
    color: #10B981;
}

.login-stats-content {
    flex: 1;
    min-width: 0;
}

.login-stats-label {
    font-size: 13px;
    color: #C7D2FE;
    margin: 0 0 6px 0;
    font-weight: 500;
}

.login-stats-value {
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: -0.01em;
}

.login-stats-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 4px;
}

.login-stats-progress-bar {
    height: 100%;
    width: 75%;
    background: linear-gradient(90deg, #10B981 0%, #059669 100%);
    border-radius: 9999px;
    animation: progress-animation 2.5s ease-out;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

@keyframes progress-animation {
    from {
        width: 0;
    }
    to {
        width: 75%;
    }
}

.login-footer-text {
    position: relative;
    z-index: 10;
    font-size: 13px;
    color: #A5B4FC;
    margin-top: auto;
    padding-top: 24px;
    font-weight: 400;
}

/* ================================================================ */
/* Right Panel - Login Form */
/* ================================================================ */
.login-right-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #FFE5CC 0%, #FFD4A3 100%);
    overflow-y: auto;
    min-height: 100vh;
}

.login-form-wrapper {
    width: 100%;
    max-width: 420px;
    animation: fade-in-up 0.6s ease-out;
}

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

.login-mobile-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}

@media (min-width: 1200px) {
    .login-mobile-brand {
        display: none;
    }
}

.login-mobile-brand .login-brand-icon {
    background: none;
    width: 200px;
    height: auto;
    box-shadow: none;
    border-radius: 10px;
}

.login-mobile-brand .login-brand-icon i {
    color: #FFFFFF;
    font-size: 22px;
}

.login-mobile-brand .login-brand-title {
    color: #244B94;
    font-size: 40px;
    font-weight: 700;
}

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

.login-form-title {
    font-size: 32px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 12px 0;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.login-form-subtitle {
    font-size: 15px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
    font-weight: 400;
}

/* ================================================================ */
/* Login Form */
/* ================================================================ */
.login-form {
    margin: 0;
}

.login-form-group {
    margin-bottom: 24px;
    animation: fade-in 0.5s ease-out backwards;
}

.login-form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.login-form-group:nth-child(2) {
    animation-delay: 0.2s;
}

.login-form-group:nth-child(3) {
    animation-delay: 0.3s;
}

.login-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.login-form-label i {
    font-size: 15px;
    color: #244B94;
    width: 16px;
    text-align: center;
}

.login-form-label span {
    flex: 1;
}

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

.login-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #9CA3AF;
    z-index: 1;
    pointer-events: none;
    transition: color 0.2s;
}

.login-form-group.focused .login-input-icon {
    color: #244B94;
}

.login-input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 48px;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 400;
    color: #1F2937;
    background: #F9FAFB;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

.login-input::placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

.login-input:hover:not(:focus) {
    border-color: #D1D5DB;
    background: #FFFFFF;
}

.login-input:focus {
    outline: none;
    border-color: #244B94;
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(36, 75, 148, 0.1), 0 2px 8px rgba(36, 75, 148, 0.08);
    transform: translateY(-1px);
}

.login-password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1;
    border-radius: 6px;
}

.login-password-toggle:hover {
    color: #374151;
    background: #F3F4F6;
}

.login-password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.login-password-toggle i {
    font-size: 18px;
}

.login-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.login-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.login-checkbox-label:hover {
    color: #1F2937;
}

.login-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #244B94;
    cursor: pointer;
    border-radius: 4px;
}

.login-forgot-link {
    font-size: 14px;
    font-weight: 600;
    color: #244B94;
    text-decoration: none;
    transition: all 0.2s;
    padding: 4px 0;
}

.login-forgot-link:hover {
    color: #1A3A6F;
    text-decoration: underline;
}

.login-submit-btn {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #244B94 0%, #1A3A6F 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(36, 75, 148, 0.25);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
    animation: fade-in 0.5s ease-out 0.4s backwards;
}

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

.login-submit-btn:hover {
    background: linear-gradient(135deg, #1A3A6F 0%, #244B94 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(36, 75, 148, 0.35);
}

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

.login-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(36, 75, 148, 0.3);
}

.login-submit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(36, 75, 148, 0.15), 0 4px 14px rgba(36, 75, 148, 0.25);
}

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

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

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

.login-submit-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.login-support {
    margin-top: 40px;
    text-align: center;
    padding-top: 28px;
    border-top: 1px solid #E5E7EB;
    animation: fade-in 0.5s ease-out 0.5s backwards;
}

.login-support-text {
    font-size: 13px;
    color: #6B7280;
    margin: 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.login-support-text i {
    font-size: 14px;
    color: #9CA3AF;
}

.login-support-link {
    font-weight: 600;
    color: #244B94;
    text-decoration: none;
    transition: color 0.2s;
}

.login-support-link:hover {
    color: #1A3A6F;
    text-decoration: underline;
}

/* ================================================================ */
/* Animation for form elements */
/* ================================================================ */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================================ */
/* Responsive Styles */
/* ================================================================ */
@media (max-width: 1199px) {
    .login-container {
        flex-direction: column;
    }
    
    .login-left-panel {
        display: none;
    }
    
    .login-right-panel {
        padding: 24px 20px;
        min-height: auto;
    }
    
    .login-form-wrapper {
        max-width: 100%;
    }
    
    .login-form-title {
        font-size: 28px;
    }
    
    .login-mobile-brand {
        margin-bottom: 32px;
    }
}

@media (max-width: 640px) {
    .login-right-panel {
        padding: 20px 16px;
    }
    
    .login-form-wrapper {
        max-width: 100%;
    }
    
    .login-mobile-brand {
        margin-bottom: 28px;
    }
    
    .login-mobile-brand .login-brand-icon {
        width: 140px;
        height: 140px;
        max-width: 140px;
        max-height: 140px;
    }
    
    .login-mobile-brand .login-brand-icon img,
    .login-mobile-brand .login-brand-logo {
        width: 100%;
        height: 100%;
        max-width: 140px;
        max-height: 140px;
        object-fit: contain;
    }
    
    .login-mobile-brand .login-brand-icon i {
        font-size: 20px;
    }
    
    .login-mobile-brand .login-brand-title {
        font-size: 20px;
    }
    
    .login-form-header {
        margin-bottom: 32px;
        text-align: center;
    }
    
    .login-form-title {
        font-size: 26px;
        margin-bottom: 10px;
    }
    
    .login-form-subtitle {
        font-size: 14px;
    }
    
    .login-form-group {
        margin-bottom: 20px;
    }
    
    .login-input {
        height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0 14px 0 46px;
    }
    
    .login-input-icon {
        left: 14px;
        font-size: 17px;
    }
    
    .login-password-toggle {
        right: 14px;
        padding: 5px;
    }
    
    .login-password-toggle i {
        font-size: 17px;
    }
    
    .login-form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .login-submit-btn {
        height: 48px;
        font-size: 15px;
    }
    
    .login-support {
        margin-top: 32px;
        padding-top: 24px;
    }
    
    .login-support-text {
        font-size: 12px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .login-form-title {
        font-size: 24px;
    }
    
    .login-form-subtitle {
        font-size: 13px;
    }
    
    .login-mobile-brand .login-brand-icon {
        width: 120px;
        height: 120px;
        max-width: 120px;
        max-height: 120px;
    }
    
    .login-mobile-brand .login-brand-icon img,
    .login-mobile-brand .login-brand-logo {
        width: 100%;
        height: 100%;
        max-width: 120px;
        max-height: 120px;
        object-fit: contain;
    }
}

/* ================================================================ */
/* Accessibility Improvements */
/* ================================================================ */
.login-input:focus-visible,
.login-submit-btn:focus-visible,
.login-password-toggle:focus-visible {
    outline: 2px solid #244B94;
    outline-offset: 2px;
}

.login-checkbox:focus-visible {
    outline: 2px solid #244B94;
    outline-offset: 2px;
}

/* ================================================================ */
/* Error States & Animations */
/* ================================================================ */
.login-form-group.error .login-input {
    border-color: #EF4444;
    background: #FEF2F2;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1), 0 2px 8px rgba(239, 68, 68, 0.08);
    animation: input-error-pulse 0.4s ease-out;
}

.login-form-group.error .login-input:focus {
    border-color: #DC2626;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15), 0 2px 8px rgba(239, 68, 68, 0.12);
}

.login-form-group.error .login-input-icon {
    color: #EF4444;
}

.login-form-group.error .login-form-label {
    color: #DC2626;
}

.login-form-group.error .login-form-label i {
    color: #EF4444;
}

@keyframes input-error-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
    }
}

.login-form-group.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
    }
}

/* ================================================================ */
/* Error Modal Styles */
/* ================================================================ */
.login-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.login-error-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Fade out animation khi đóng modal */
.login-error-modal.closing {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-error-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-error-modal.active .login-error-modal-overlay {
    opacity: 1;
}

.login-error-modal.closing .login-error-modal-overlay {
    opacity: 0;
}

.login-error-modal-content {
    position: relative;
    background: #FFFFFF;
    border-radius: 20px;
    padding: 40px 32px 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    z-index: 1;
}

.login-error-modal.active .login-error-modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Fade out animation cho content khi đóng */
.login-error-modal.closing .login-error-modal-content {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
}

.login-error-modal-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: error-icon-pulse 0.6s ease-out;
}

.login-error-modal-icon i {
    font-size: 36px;
    color: #EF4444;
    animation: error-icon-shake 0.5s ease-out 0.2s;
}

@keyframes error-icon-pulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes error-icon-shake {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(10deg);
    }
}

.login-error-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 16px 0;
    letter-spacing: -0.02em;
}

.login-error-modal-message {
    font-size: 15px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0 0 32px 0;
    padding: 0 8px;
}

.login-error-modal-button {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}

.login-error-modal-button:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.login-error-modal-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

.login-error-modal-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2), 0 4px 14px rgba(239, 68, 68, 0.3);
}

.login-error-modal-button i {
    font-size: 14px;
    transition: transform 0.3s;
}

.login-error-modal-button:hover i {
    transform: scale(1.1);
}

@media (max-width: 640px) {
    .login-error-modal-content {
        padding: 32px 24px 24px;
        max-width: 90%;
    }
    
    .login-error-modal-icon {
        width: 64px;
        height: 64px;
        margin-bottom: 20px;
    }
    
    .login-error-modal-icon i {
        font-size: 32px;
    }
    
    .login-error-modal-title {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .login-error-modal-message {
        font-size: 14px;
        margin-bottom: 24px;
    }
    
    .login-error-modal-button {
        height: 44px;
        font-size: 14px;
    }
}

/* ================================================================ */
/* Print Styles */
/* ================================================================ */
@media print {
    .login-left-panel {
        display: none;
    }
    
    .login-right-panel {
        background: linear-gradient(135deg, #FFE5CC 0%, #FFD4A3 100%);
    }
    
    .login-error-modal {
        display: none;
    }
}
