/* หน้าเข้าสู่ระบบ โครงเดียวกับระบบ asset */

/* Bulma ตั้งฟอนต์ของปุ่มและช่องกรอกแยกจาก body */
body,
button,
input,
.button,
.input {
    font-family: 'Anuphan', system-ui, sans-serif;
}

/* จอคอม: ภาพอยู่ซ้ายในกรอบโค้ง ฟอร์มอยู่ขวา */
.login-page {
    background-color: #fff;
}

.login-shell {
    display: flex;
    gap: 24px;
    min-height: 100vh;
    padding: 24px;
}

.login-side {
    display: flex;
    flex: 0 0 min(500px, 50%);
    flex-direction: column;
    padding: 16px 40px;
}

.login-photo {
    flex: 1;
    order: -1;
    min-width: 0;
    background-image: url("../images/login.jpg");
    background-position: 40% center;
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 20px;
}

/* ชื่อระบบแยกจากฟอร์ม */
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand img {
    flex: none;
    width: auto;
    height: 76px;
}

.login-system {
    color: #08584C;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
}

.login-system-en {
    color: #4d5653;
    font-size: .8125rem;
    font-weight: 500;
}

.login-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

/* กว้าง 300px เท่ากับ Cloudflare Turnstile ขนาดปกติ */
.login-form {
    width: 100%;
    max-width: 300px;
}

.login-title {
    margin-bottom: 24px;
    color: #1f2624;
    font-size: 1.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.login-form .label {
    font-size: .875rem;
    font-weight: 500;
}

.login-form .input,
.login-form .button {
    height: 46px;
    border-radius: 10px;
}

.login-form .button {
    font-weight: 600;
}

/* ไอคอนในช่องกรอก สีเทา เปลี่ยนเป็นสีเขียวเมื่อกำลังกรอกช่องนั้น */
.login-form .control.has-icons-left .input {
    padding-left: 44px;
}

.login-form .control.has-icons-left .icon.is-left {
    width: 44px;
    height: 46px;
    font-size: 1.15rem;
    color: #8a9390;
}

.login-form .control.has-icons-left .input:focus ~ .icon.is-left {
    color: #0B6E5F;
}

/* ปุ่มแสดงรหัสผ่านอยู่ในช่องกรอก */
.login-password .input {
    padding-right: 46px;
}

.login-password button {
    position: absolute;
    top: 1px;
    right: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 10px;
    color: #4d5653;
    cursor: pointer;
}

.login-password button:hover {
    color: #0B6E5F;
}

/* จองความสูงของ Turnstile ไว้ก่อนโหลด ปุ่มจะได้ไม่ขยับ */
.turnstile-field {
    display: flex;
    justify-content: center;
    min-height: 65px;
}

/* Turnstile เป็น iframe ของ Cloudflare แต่งข้างในไม่ได้ จึงตัดมุมให้โค้งเท่าช่องกรอก
   แล้ววาดขอบสีเดียวกับช่องกรอกทับขอบเดิมที่ถูกตัดตรงมุม */
.cf-turnstile {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;
}

.cf-turnstile:not(:empty)::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid #dbdbdb;
    border-radius: 10px;
    pointer-events: none;
}

.button.is-link {
    background-color: #0B6E5F;
    border-color: transparent;
    color: #fff;
}

.button.is-link:hover {
    background-color: #08584C;
    color: #fff;
}

.button.is-link:focus:not(:active) {
    box-shadow: 0 0 0 .125em rgba(11, 110, 95, .25);
}

.button.is-link.is-loading::after {
    border-color: transparent transparent #fff #fff !important;
}

.input:focus,
.input:active,
.button:focus {
    border-color: #0B6E5F;
}

.input:focus,
.input:active {
    box-shadow: 0 0 0 .125em rgba(11, 110, 95, .25);
}

.login-home {
    color: #0B6E5F;
    font-size: .875rem;
}

.login-home:hover {
    color: #08584C;
}

/* มือถือ: ภาพเป็นแถบด้านบน ตามด้วยชื่อระบบและฟอร์ม */
@media screen and (max-width: 768px) {
    .login-shell {
        flex-direction: column;
        gap: 16px;
        padding: 10px;
    }

    .login-photo {
        flex: 0 0 130px;
        background-position: center 30%;
        border-radius: 16px;
    }

    .login-side {
        flex: 1;
        align-items: center;
        padding: 0;
    }

    .login-brand,
    .login-form {
        width: 100%;
        max-width: 300px;
    }

    .login-main {
        flex: none;
        width: 100%;
        padding: 20px 0;
    }

    .login-title {
        margin-bottom: 16px;
        font-size: 1.5rem;
    }
}
