@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ====== Reset & Variables ====== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0b1a3e;
    --bg-mid: #132d6b;
    --bg-accent: #1a3f8f;
    --blue-light: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.4);
    --white: #ffffff;
    --white-80: rgba(255, 255, 255, 0.8);
    --white-60: rgba(255, 255, 255, 0.6);
    --white-40: rgba(255, 255, 255, 0.4);
    --white-20: rgba(255, 255, 255, 0.2);
    --white-10: rgba(255, 255, 255, 0.1);
    --white-05: rgba(255, 255, 255, 0.05);
    --error-color: #ef4444;
    --field-bg: rgba(255, 255, 255, 0.12);
    --field-border: rgba(255, 255, 255, 0.2);
    --field-focus: rgba(255, 255, 255, 0.3);
    --btn-gradient: linear-gradient(135deg, #1e56a0 0%, #2d7dd2 50%, #1e56a0 100%);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 50px;
    --transition: all 0.3s ease;
}

/* ====== Body & Background ====== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    background: linear-gradient(160deg, #115ec6 0%, #173a95 25%, #163a7a 50%, #2b539c 70%, #1646c1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/img/backgroud_4.png') no-repeat center center;
    background-size: cover;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

/* ====== Background Effects ====== */
.background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Soft glowing circles */
.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
}

.bg-circle-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #2563eb 0%, transparent 70%);
    top: -15%;
    left: -10%;
    animation: drift 25s ease-in-out infinite;
}

.bg-circle-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #1d4ed8 0%, transparent 70%);
    bottom: -10%;
    right: -8%;
    animation: drift 20s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-bg 15s ease-in-out infinite;
}

@keyframes drift {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(40px, 30px) scale(1.05);
    }

    66% {
        transform: translate(-30px, 20px) scale(0.95);
    }
}

@keyframes pulse-bg {

    0%,
    100% {
        opacity: 0.15;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.25;
        transform: translate(-50%, -50%) scale(1.15);
    }
}

/* Wave decoration at bottom */
.wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wave-2 {
    animation: wave-move 8s ease-in-out infinite;
}

@keyframes wave-move {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-30px);
    }
}

/* Floating particles */
.particles {
    position: absolute;
    inset: 0;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--white-40);
    border-radius: 50%;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ====== Login Wrapper ====== */
.login-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    padding: 50px 40px 50px;
    animation: fadeInUp 0.8s ease-out;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
}

/* ====== Logo ====== */
.logo-section {
    margin-bottom: 28px;
    animation: fadeInDown 0.8s ease-out;
}

.logo-badge {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    /* Nền trắng để làm nổi bật logo */
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 0 20px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(59, 130, 246, 0.3),
        inset 0 0 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    animation: logo-pulse 4s ease-in-out infinite;
}

.logo-badge:hover {
    box-shadow:
        0 0 30px rgba(59, 130, 246, 0.7),
        0 0 60px rgba(59, 130, 246, 0.4);
    transform: scale(1.05);
    background: #ffffff;
}

.logo-badge::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            transparent 0deg,
            #3b82f6 90deg,
            transparent 180deg,
            #fbbf24 270deg,
            transparent 360deg);
    animation: spin-ring 4s linear infinite;
    z-index: -1;
    opacity: 0.8;
    mask: radial-gradient(transparent 58px, black 59px, black 62px, transparent 63px);
    -webkit-mask: radial-gradient(transparent 58px, black 59px, black 62px, transparent 63px);
}

@keyframes logo-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.7);
    }
}

@keyframes spin-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.logo-img {
    width: 95px;
    height: 95px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
    transition: var(--transition);
    z-index: 2;
}

/* ====== Title ====== */
.main-title {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    color: var(--white);
    margin-bottom: 40px;
    letter-spacing: 1px;
    line-height: 1.4;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 1s ease-out 0.3s both;
}

/* ====== Form ====== */
.login-form {
    width: 100%;
    max-width: 420px;
    animation: fadeIn 1s ease-out 0.4s both;
}

/* Error Alert */
.error-alert {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    backdrop-filter: blur(10px);
    color: var(--white);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: shake 0.5s ease-in-out;
}

.error-alert i {
    font-size: 16px;
    color: #fca5a5;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* Field Group */
.field-group {
    margin-bottom: 16px;
}

.field-wrapper {
    position: relative;
    transition: var(--transition);
}

.field-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--white-60);
    font-size: 15px;
    z-index: 2;
    transition: var(--transition);
    pointer-events: none;
}

.field-input {
    width: 100%;
    padding: 16px 50px 16px 48px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--white);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--radius-lg);
    outline: none;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.field-input::placeholder {
    color: var(--white-40);
    font-weight: 400;
}

.field-input:focus {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--field-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 20px rgba(0, 0, 0, 0.1);
}

.field-input:focus~.field-icon {
    color: var(--white-80);
}

.field-input.is-invalid {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--white-40);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    z-index: 2;
    padding: 4px;
}

.toggle-password:hover {
    color: var(--white-80);
}

/* ====== Login Button ====== */
.btn-login {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #1558a8 0%, #2778d4 40%, #3b8ef5 60%, #1558a8 100%);
    background-size: 200% 100%;
    color: var(--white);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 25px rgba(37, 99, 235, 0.35);
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    transition: left 0.5s ease;
}

.btn-login:hover:not(:disabled) {
    background-position: 100% 0;
    box-shadow: 0 8px 35px rgba(37, 99, 235, 0.5);
    transform: translateY(-2px);
}

.btn-login:hover:not(:disabled)::before {
    left: 100%;
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 15px rgba(37, 99, 235, 0.3);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-text {
    position: relative;
    z-index: 2;
}

/* ====== Form Options ====== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    font-size: 13px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    color: var(--white-60);
    transition: var(--transition);
}

.remember-me:hover {
    color: var(--white-80);
}

.remember-me input {
    display: none;
}

.custom-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--white-40);
    border-radius: 4px;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.remember-me input:checked~.custom-check {
    background: var(--blue-light);
    border-color: var(--blue-light);
}

.custom-check::after {
    content: '';
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-me input:checked~.custom-check::after {
    display: block;
}

.forgot-link {
    color: var(--white-60);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--white);
}

.forgot-link i {
    font-size: 14px;
    color: #4ade80;
}

/* ====== SSO Divider ====== */
.sso-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 28px 0 24px;
    color: var(--white-40);
    font-size: 13px;
    font-weight: 500;
}

.sso-divider::before,
.sso-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--white-20);
}

.sso-divider:not(:empty)::before {
    margin-right: 16px;
}

.sso-divider:not(:empty)::after {
    margin-left: 16px;
}

/* ====== SSO Button ====== */
.btn-sso-vnedu {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    color: var(--white);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.btn-sso-vnedu i {
    font-size: 18px;
    transition: var(--transition);
}

.btn-sso-vnedu::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    transition: left 0.5s ease;
}

.btn-sso-vnedu:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.btn-sso-vnedu:hover::before {
    left: 100%;
}

.btn-sso-vnedu:hover i {
    transform: scale(1.1) rotate(5deg);
}

.btn-sso-vnedu:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

/* ====== Language Selector ====== */
.lang-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
    animation: fadeIn 1s ease-out 0.6s both;
}

.lang-link {
    color: var(--white-60);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.lang-link:hover,
.lang-link.active {
    color: var(--white);
}

.lang-link.active {
    background: rgba(255, 255, 255, 0.1);
}

.lang-divider {
    color: var(--white-20);
    font-weight: 300;
}

/* ====== Footer ====== */
.page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 16px 20px;
    z-index: 3;
    animation: fadeIn 1s ease-out 0.7s both;
}

.page-footer p {
    font-size: 13px;
    color: var(--white-40);
    font-weight: 300;
}

.page-footer strong {
    color: var(--white-60);
    font-weight: 600;
}

/* ====== Animations ====== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====== Notification (preserved from original) ====== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    z-index: 10000;
    animation: slideInRight 0.5s ease-out, fadeOut 0.5s ease-out 2.5s;
    color: white;
}

.notification-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.notification-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.notification-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ====== Responsive ====== */
@media (max-width: 600px) {
    .login-wrapper {
        padding: 36px 20px 36px;
        margin: 16px;
        border-radius: 20px;
    }

    .main-title {
        font-size: 18px;
        margin-bottom: 30px;
    }

    .logo-badge {
        width: 90px;
        height: 90px;
    }

    .logo-img {
        width: 58px;
        height: 58px;
    }

    .field-input {
        padding: 14px 44px 14px 44px;
        font-size: 14px;
    }

    .btn-login {
        padding: 14px;
        font-size: 15px;
    }

    .form-options {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .main-title {
        font-size: 22px;
    }
}

/* Reduce animation for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}