* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    min-height: 100vh;
    background: #f8f9fa;
}

/* Video Background */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.sleep-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 1;
    filter: brightness(1.05) contrast(1.05);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 2;
}

/* Liquid Glass Background Shapes */
.glass-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.glass-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.08;
    animation: float 20s infinite ease-in-out;
    mix-blend-mode: screen;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #e1e723, #f5f54a);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #e1e723, #ffd700);
    bottom: -15%;
    right: -10%;
    animation-delay: 5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #f5f54a, #e1e723);
    top: 40%;
    right: 10%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Main Container */
.login-container {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Liquid Glass Card */
.login-card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border-radius: 32px;
    padding: 15px 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.37),
        0 20px 60px rgba(0, 0, 0, 0.25),
        inset 0 1px 1px rgba(255, 255, 255, 0.9),
        inset 0 -1px 1px rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent, 
        #e1e723, 
        #f5f54a, 
        #e1e723, 
        transparent);
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
    opacity: 0.8;
}

.login-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: radial-gradient(circle, 
        rgba(225, 231, 35, 0.08) 0%, 
        transparent 70%);
    transform: translate(-50%, -50%);
    animation: pulse 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

/* Logo & Header */
.login-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
    z-index: 1;
}

.company-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 5px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
}

.company-logo:hover {
    transform: translateY(-5px);
}

.company-logo img {
    width: 80%;
    height: 80%;
    object-fit: contain;
}

.system-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(225, 231, 35, 0.1);
}

.system-subtitle {
    font-size: 13px;
    color: #6c757d;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    display: none;
    font-size: 14px;
    font-weight: 600;
    border: 1.5px solid;
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
    box-shadow: 
        0 4px 12px rgba(220, 53, 69, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.alert-success {
    background: rgba(40, 199, 111, 0.15);
    color: #28a745;
    border-color: rgba(40, 199, 111, 0.3);
    box-shadow: 
        0 4px 12px rgba(40, 199, 111, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.alert i {
    margin-right: 10px;
}

/* Form */
.login-form {
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-label {
    display: block;
    color: #34495e;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* FIX: Input wrapper không bị ảnh hưởng bởi error message */
.input-wrapper {
    position: relative;
    display: block;
}

/* FIX: Icon luôn ở vị trí cố định bên trong input */
.input-icon {
    position: absolute;
    left: 20px;
    top: 19px;
    color: #adb5bd;
    font-size: 18px;
    z-index: 2;
    pointer-events: none;
}

.form-control {
    width: 100%;
    padding: 18px 20px 18px 56px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 
        0 4px 12px rgba(31, 38, 135, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.8),
        inset 0 -1px 1px rgba(255, 255, 255, 0.4);
    display: block;
}

.form-control:focus {
    background: rgba(255, 255, 255, 0.55);
    border-color: #e1e723;
    box-shadow: 
        0 0 0 4px rgba(225, 231, 35, 0.15),
        0 6px 20px rgba(225, 231, 35, 0.25),
        inset 0 1px 2px rgba(255, 255, 255, 0.9),
        inset 0 -1px 1px rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.form-control:focus + .input-icon {
    color: #e1e723;
}

.form-control::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

.form-control.error {
    border-color: #dc3545;
}

.form-control.error + .input-icon {
    color: #dc3545;
}

/* FIX: Error label hiển thị bên dưới input, không ảnh hưởng icon */
label.error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 8px;
    display: block;
    font-weight: 600;
    padding-left: 4px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Submit Button - Liquid Glass Style */
.btn-login {
    width: 100%;
    padding: 18px;
    background: rgba(255, 255, 255, 0.35); 
    border: none;
    border-radius: 16px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;

    box-shadow: 
    0 4px 15px rgba(31, 38, 135, 0.12),
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4);



    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-microsoft::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.6), 
        transparent);
    transition: left 0.6s;
}

.btn-microsoft:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 15px 40px rgba(225, 231, 35, 0.45),
        0 8px 20px rgba(0, 0, 0, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.btn-microsoft:hover::before {
    left: 100%;
}

.btn-microsoft:active {
    transform: translateY(-1px);
}

.btn-microsoft:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    margin: 15px 0;
    color: #34495e;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(225, 231, 35, 0.25), 
        transparent);
}

.login-divider span {
    padding: 0 22px;
}

/* Microsoft Login - Liquid Glass */
.btn-microsoft {
    width: 100%;
    padding: 18px;
    background:linear-gradient(135deg, #e1e723 0%, #f5f54a 100%)  ;
    backdrop-filter: blur(20px);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    color: #495057;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    box-shadow: 
    0 10px 30px rgba(225, 231, 35, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-3px);
    box-shadow: 
        0 10px 30px rgba(31, 38, 135, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.9),
        inset 0 -1px 1px rgba(255, 255, 255, 0.5);
}

.microsoft-icon {
    width: 22px;
    height: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
}

.microsoft-icon span {
    display: block;
}

.microsoft-icon .red { background: #f25022; }
.microsoft-icon .green { background: #7fba00; }
.microsoft-icon .blue { background: #00a4ef; }
.microsoft-icon .yellow { background: #ffb900; }

/* Loading Spinner */
#wait {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Rotating Ring */
.spinner::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #e1e723;
    border-right-color: #f5f54a;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 30px rgba(225, 231, 35, 0.4);
}

/* Secondary Ring */
.spinner::after {
    content: '';
    position: absolute;
    width: 85%;
    height: 85%;
    border: 3px solid transparent;
    border-bottom-color: #e1e723;
    border-left-color: #f5f54a;
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite reverse;
}

/* Logo Container */
.spinner-logo {
    position: relative;
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    box-shadow: 
        0 8px 24px rgba(225, 231, 35, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    animation: pulse-logo 2s ease-in-out infinite;
}

.spinner-logo img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    animation: float-logo 3s ease-in-out infinite;
}

/* Glow Effect */
.spinner-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(225, 231, 35, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-logo {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(225, 231, 35, 0.3),
                   inset 0 2px 4px rgba(255, 255, 255, 0.8);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 12px 32px rgba(225, 231, 35, 0.5),
                   inset 0 2px 4px rgba(255, 255, 255, 0.9);
    }
}

@keyframes float-logo {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes glow-pulse {
    0%, 100% { 
        opacity: 0.5;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Loading Text */
.loading-text {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fade-in-out 2s ease-in-out infinite;
}

@keyframes fade-in-out {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1.5px solid rgba(225, 231, 35, 0.15);
    position: relative;
    z-index: 1;
}

.footer-text {
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.8;
}

.footer-link {
    color: #e1e723;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #e1e723;
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: #d4d720;
}

.footer-link:hover::after {
    width: 100%;
}

/* Responsive */
@media (max-width: 576px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .login-container {
        min-height: 100vh;
        padding: 30px 20px;
    }

    .login-card {
        padding: 35px 25px;
        margin: 20px 0;
    }

    .system-title {
        font-size: 26px;
    }

    .system-subtitle {
        font-size: 11px;
    }

    .blob-1, .blob-2, .blob-3 {
        filter: blur(60px);
    }

    /* Smaller spinner on mobile */
    .spinner {
        width: 120px;
        height: 120px;
    }

    .spinner-logo {
        width: 55px;
        height: 55px;
    }

    .spinner-logo img {
        width: 38px;
        height: 38px;
    }

    .spinner-glow {
        width: 140px;
        height: 140px;
    }

    .loading-text {
        bottom: -40px;
        font-size: 12px;
    }
}

/* Glass Reflection Effect */
.glass-reflection {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        transparent 100%);
    border-radius: 32px 32px 0 0;
    pointer-events: none;
    z-index: 0;
}