/* --- RESET CƠ BẢN --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; }

body { 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    background-color: #ffffff; 
    color: #1c1e21; 
}

/* --- HỆ THỐNG GRID CHÍNH --- */
.main-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1.2fr; 
    width: 100%;
    max-width: 1440px; 
    margin: 0 auto;
    min-height: calc(100vh - 130px); 
    padding: 0 40px;
    gap: 0; 
}

/* --- CỘT TRÁI: LOGO Ở TRÊN - SLOGAN Ở DƯỚI SÁT MÉP --- */
.col-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    padding: 60px 20px 60px 10px; 
    height: 100%;
}
.top-logo { width: 40px; height: auto; }
.tagline { font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -0.5px; color: #1c1e21; }
.text-blue { color: #1877f2; }

/* --- CỘT GIỮA: ẢNH MINH HỌA LỚN --- */
.col-center { display: flex; justify-content: center; align-items: center; padding: 20px; }
.hero-image { max-width: 95%; height: auto; object-fit: contain; }

/* --- CỘT PHẢI: KHUNG CHỨA FORM --- */
.col-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    border-left: 1px solid #e5e5e5; 
    padding: 40px 20px 40px 40px; 
    height: 100%;
}

/* --- STYLE CHUNG CHO INPUT --- */
input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 15px;
}
input:focus { border-color: #1877f2; outline: none; box-shadow: 0 0 0 2px #e7f3ff; }

/* --- ĐỊNH DẠNG KHUNG CHỨA FORM --- */
.login-container, .whatsapp-container {
    width: 100%;
    max-width: 720px; 
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* --- STEP 1: LOGIN CARD STYLE --- */
.login-title { font-size: 18px; font-weight: normal; margin-bottom: 20px; }
.btn-login {
    width: 100%;
    background-color: #1877f2;
    color: white;
    font-size: 17px;
    font-weight: bold;
    padding: 12px;
    border: none;
    border-radius: 20px; 
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}
.btn-login:hover { background-color: #166fe5; }
.forgot-link { display: block; text-align: center; color: #1c1e21; text-decoration: none; font-size: 14px; margin-bottom: 30px; }
.btn-create { display: block; width: 100%; background-color: #fff; color: #1877f2; border: 1px solid #1877f2; font-size: 15px; font-weight: bold; padding: 10px; border-radius: 20px; cursor: pointer; }
.btn-create:hover { background-color: #f5f6f7; }
.meta-logo { text-align: center; margin-top: 20px; opacity: 0.8; }

/* --- STEP 2: LOGIC ĐIỀU KHIỂN BẰNG CLASS (New) --- */
.main-wrapper.step-2-active {
    grid-template-columns: 1fr !important;
    justify-items: center; 
    align-items: center;   
    min-height: 100vh;
    padding: 20px !important;
}

.main-wrapper.step-2-active .col-right {
    border-left: none !important;
    width: 100%;
    max-width: 500px;
    padding: 0 !important;
}

/* --- STEP 2: WHATSAPP CARD STYLE --- */
.whatsapp-container {
    animation: fadeIn 0.5s ease;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
}

.step2-header { font-size: 16px; font-weight: 400; color: #1c1e21; margin-bottom: 10px; text-align: left; width: 100%; }

.step2-title {
    font-size: 22px; 
    font-weight: 700; 
    margin-bottom: 10px; 
    line-height: 1.2;
    color: #1c1e21;
}

.step2-desc {
    font-size: 14px;
    color: #1c1e21;
    line-height: 1.4;
    margin-bottom: 12px; 
    width: 100%;
    max-width: none; 
    margin-left: 0;
    margin-right: 0;
    text-align: left;
}

.step2-image-box { width: 100%; margin-bottom: 20px; overflow: hidden; }
.step2-img { width: 100%; display: block; height: auto; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

/* --- OTP & Countdown --- */
#otp {
    width: 100%;
    padding: 14px;
    margin: 8px 0; 
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 17px;
    box-sizing: border-box;
}
#otp:focus { outline: none; border-color: #1877f2; box-shadow: 0 0 0 2px #e7f3ff; }

.step2-countdown { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #65676b; margin-bottom: 15px; }
.spinner-icon { display: inline-block; animation: spin 2s linear infinite; }

.btn-continue {
    width: 100%;
    background-color: #1877f2;
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 12px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    margin-bottom: 12px;
    opacity: 1;
}
.btn-continue:hover { background-color: #166fe5; }
.btn-other {
    width: 100%;
    background-color: #ffffff;
    color: #1c1e21;
    border: 1px solid #ccd0d5;
    font-size: 16px;
    font-weight: normal; 
    padding: 12px;
    border-radius: 24px;
    cursor: pointer;
}

/* --- ALERT OVERLAY --- */
#custom-alert {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8); 
    display: none; align-items: center; justify-content: center; z-index: 9999;
}
.alert-box {
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2); 
    border: 1px solid #dddfe2;
    text-align: center;
    max-width: 350px;
}
.alert-box p { font-size: 16px; margin-bottom: 20px; color: #1c1e21; }
.alert-box button {
    background-color: #1877f2;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* --- ANIMATIONS & FOOTER --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

footer { background-color: #ffffff; padding: 20px 40px; font-size: 12px; color: #737373; }
.footer-content { max-width: 1200px; margin: 0 auto; }
.lang-links, .action-links { line-height: 2; }
.lang-links button { border: 1px solid #ccd0d5; background: #f5f6f7; padding: 0 8px; cursor: pointer; }
footer hr { border: none; border-top: 1px solid #dadde1; margin: 10px 0; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 900px) {
    .main-wrapper { 
        grid-template-columns: 1fr;
        padding: 0 10px; 
        margin: 0 auto; 
        gap: 0;
    }
    
    .col-left { 
        display: flex !important; 
        align-items: center; 
        justify-content: center; 
        padding: 20px 0; 
    }
    
    .tagline { display: none; } 
    .col-center { display: none; }
    
    .col-right { 
        border-left: none;
        align-items: center; 
        padding-top: 20px;
        padding-bottom: 100px;
        min-height: 100vh;
    }

    .login-container, .whatsapp-container { 
        padding: 0 10px;
        max-width: 100%; 
        width: 100%;
    }
    
    footer { padding: 20px; }
}
/* --- SỬA LỖI RESPONSIVE MOBILE --- */
@media (max-width: 900px) {
    /* Chuyển từ grid sang flex để căn giữa dễ dàng hơn */
    .main-wrapper {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100% !important;
        padding: 0 15px !important; /* Padding đều 2 bên */
        margin: 0 auto;
        min-height: 100vh;
    }
    
    /* Đảm bảo col-right chiếm trọn chiều rộng hợp lý */
    .col-right {
        border-left: none !important;
        width: 100% !important;
        max-width: 400px; /* Giới hạn độ rộng form trên điện thoại */
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    /* Các phần không cần thiết trên mobile */
    .col-left, .col-center { 
        display: none !important; 
    }

    .login-container, .whatsapp-container { 
        width: 100% !important;
        max-width: 400px !important;
        background: #fff;
    }
    
    footer { padding: 20px; text-align: center; }
}
