/* --- Import Font & Biến màu --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4a69bd;
    --primary-color-dark: #3a539b;
    --background-color: #f4f7f9;
    --panel-background: #ffffff;
    --text-color: #333333;
    --label-color: #555555;
    --border-color: #dfe4ea;
    --error-color: #e74c3c;
    --white-color: #ffffff;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- Reset & Thiết lập chung --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- Container Chính --- */
.container {
    display: flex;
    max-width: 1000px;
    width: 90%;
    background-color: var(--panel-background);
    border-radius: 15px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

/* --- Panel Chào mừng (Bên trái) --- */
.welcome-panel {
    flex-basis: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: var(--white-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
    text-align: center;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.welcome-content h1 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.welcome-content p {
    font-size: 1rem;
    max-width: 300px;
}

/* --- Panel Form (Bên phải) --- */
.form-panel {
    flex-basis: 50%;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-panel h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* --- Các thành phần Form --- */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--label-color);
    font-size: 0.9rem;
}

.form-group label i {
    font-size: 1.2rem;
    margin-right: 8px;
    color: var(--primary-color);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.2);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 45px; /* Tạo không gian cho icon mắt */
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--label-color);
    font-size: 1.3rem;
}

/* --- Thông báo lỗi của Form --- */
.form-error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 5px;
    min-height: 1.2em; /* Giữ không gian để tránh layout bị giật */
    display: none; /* Ẩn mặc định */
}

/* --- Nút Bấm & Liên kết --- */
.form-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: var(--white-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.form-btn:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
}

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

/* Trạng thái loading của nút */
.form-btn.loading {
    background-color: var(--primary-color-dark);
    cursor: wait;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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


.switch-form-text {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
}

.switch-form-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.switch-form-text a:hover {
    text-decoration: underline;
}

/* --- Responsive cho Mobile --- */
@media (max-width: 992px) {
    .container {
        flex-direction: column;
        width: 100%;
        max-width: 500px;
        margin: 20px;
    }

    .welcome-panel {
       display: none; /* Ẩn panel chào mừng trên mobile để tập trung vào form */
    }

    .form-panel {
        padding: 40px 30px;
    }
}

/* --- Custom Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-box {
    background: var(--panel-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-box p {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 20px;
}

.modal-box button {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    background-color: var(--primary-color);
    color: var(--white-color);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-box button:hover {
    background-color: var(--primary-color-dark);
}

/* --- Real-time Validation --- */
.form-group input.interacted:invalid {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}