/* บังคับเปลี่ยนสีหลักของ Theme */
:root {
    --base-color: #0F6C3A !important;
    --base-highlight-color: #0F6C3A !important;
    --header-background-color: #0F6C3A !important;
}

/* พื้นหลัง */
.login-bg {
    background-image: url('../images/background_desktop.png'); /* เปลี่ยนชื่อไฟล์ตามที่คุณตั้ง */
    background-size: cover; 
    background-position: center center; 
    background-repeat: no-repeat; 
    width: 100vw;
    height: 100vh;
}

/* คุมขนาด Logo ทั่วไป */
.x-image.x-has-img img {
    max-height: 100%;
    width: auto !important; /* ป้องกันรูปยืดแนวกว้าง */
    object-fit: contain;
}

/* ปรับแต่งกรอบ Form */
.custom-form {
    border-radius: 40px !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    /* ย้าย padding มาไว้ใน CSS เพื่อความชัวร์ */
    padding: 25px !important; 
}

/* ปรับแต่งช่อง Input */
.custom-input {
    background-color: #f1f3f4 !important;
    border-radius: 15px !important;
    margin-bottom: 12px !important;
    border: none !important;
}

/* ปุ่ม LOGIN */
.btn-login-green {
    background-image: linear-gradient(to right, #76a16e, #4d7a46) !important;
    border: none !important;
    border-radius: 30px !important;
    margin-top: 10px;
}
.btn-login-green * {
    color: white !important;
    font-weight: bold !important;
    font-size: 16px !important;
}

/* Checkbox & Label Utility */
.x-checkbox.x-checked .x-icon-el {
    color: #4d7a46 !important;
}

.text-right {
    text-align: right !important;
}

.no-wrap {
    white-space: nowrap !important;
}

/* Responsive CSS */
@media screen and (max-width: 500px) {
    .login-bg {
        background-image: url('../images/background_mobile.png'); 
        background-position: center top; 
    }
}

@media screen and (max-height: 500px) {
    .login-bg {
        /* เมื่อตะแคงจอ แนะนำให้กลับไปใช้รูป Desktop เพราะสัดส่วนจอจะเป็นแนวนอนเหมือนกัน */
        background-image: url('../images/background_desktop.png');
        background-position: center center;
    }

    .x-image {
        height: 60px !important; /* ย่อจาก 100 เหลือ 60 */
        margin-top: 5px !important;
        margin-bottom: 5px !important;
    }
    
    /* .custom-form {
        max-height: 95vh !important;
        padding: 15px !important;
    } */

    /* 1. ลดความโค้งมนและ Padding ของฟอร์ม */
    .custom-form {
        /* border-radius: 20px !important; */
        padding: 10px 25px !important;
        max-height: 98vh !important; /* ให้กางเกือบเต็มจอ */
    }

    /* 2. ลดขนาดตัวอักษร Welcome Back และ Margin */
    .custom-form .x-label[html*="Welcome"] {
        font-size: 18px !important;
        margin-bottom: 10px !important;
    }

    /* 3. ลดระยะห่างของช่อง Input */
    .custom-input {
        margin-bottom: 8px !important;
    }

    /* 4. ลดระยะห่างส่วน Remember & Forgot */
    .custom-form .x-container[margin*="5 0 15 0"] {
        margin: 2px 0 8px 0 !important;
    }

    /* 5. ลดความสูงปุ่ม LOGIN */
    .btn-login-green {
        height: 40px !important;
        margin-top: 5px !important;
    }

    /* 6. ย่อส่วน Footer ลิขสิทธิ์ให้เล็กลงไปอีก หรือซ่อนถ้าจำเป็น */
    .login-footer-label {
        margin-top: 5px !important;
    }
}

@media screen and (max-height: 400px) {
    /* ถ้าจอเตี้ยมากจริงๆ ให้ย่อขนาดลงอีก */
    .login-footer-label div:first-child { font-size: 12px !important; }
    .login-footer-label div:last-child { font-size: 10px !important; }
}