/* =============================================================
 *  หน้าเข้าสู่ระบบ — ยกมาจาก template ของทีม frontend
 *  ต้นฉบับ: siamtaco_dev/login.php (บล็อก <style> ในไฟล์นั้น)
 *
 *  ยกออกมาเป็นไฟล์แยกเพราะระบบนี้ใช้ layout กลาง (app/Views/layouts/login.php)
 *  ไม่ได้เขียน <style> ไว้ในหน้าเหมือน template — และ CSP ก็ไม่ให้ inline style
 *  ที่ไม่มี nonce อยู่แล้ว
 *
 *  ⚠️ ถ้าทีม frontend แก้ดีไซน์หน้า login ให้ก๊อปบล็อก <style> จากไฟล์ต้นฉบับ
 *     มาทับไฟล์นี้ทั้งก้อน แล้วเช็คว่าส่วน "เพิ่มเติมของระบบ" ท้ายไฟล์ยังอยู่ครบ
 *
 *  ต้องโหลดคู่กับ bootstrap.min.css + desktop_style.css เสมอ
 *  (ตัวแปร --accent / --accent-2 ที่แถบแบรนด์ใช้ มาจาก desktop_style.css)
 * ============================================================= */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f4f5fb;
    /* ต้นฉบับใช้ 'Inter','Noto Sans Thai' ซึ่งไม่ได้โหลดมาไว้ในเครื่อง (และห้ามใช้ CDN)
       เปลี่ยนมาใช้ Sarabun ตัวเดียวกับทั้งระบบ — ดู public/assets/css/stc-fonts.css */
    font-family: var(--font, "Sarabun", sans-serif);
    padding: 24px;
}

.lg-shell {
    width: 100%;
    max-width: 920px;
    min-height: 560px;
    display: flex;
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 60px -20px rgba(30, 41, 59, .25);
}

/* ── Brand panel ── */
.lg-brand {
    flex: 1 1 44%;
    position: relative;
    background: linear-gradient(155deg, var(--accent, #6366f1), var(--accent-2, #8b5cf6));
    color: #fff;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.lg-brand::before,
.lg-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.lg-brand::before {
    width: 320px;
    height: 320px;
    top: -120px;
    right: -100px;
}

.lg-brand::after {
    width: 220px;
    height: 220px;
    bottom: -90px;
    left: -60px;
    background: rgba(255, 255, 255, .06);
}

.lg-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: .01em;
    position: relative;
    z-index: 1;
}

.lg-logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
}

.lg-brand-copy {
    position: relative;
    z-index: 1;
}

.lg-brand-copy h2 {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.35;
    margin: 0 0 12px;
}

.lg-brand-copy p {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255, 255, 255, .85);
    margin: 0;
    max-width: 320px;
}

.lg-brand-foot {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, .65);
}

/* ── Form panel ── */
.lg-form-panel {
    flex: 1 1 56%;
    padding: 52px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lg-form-head h1 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px;
}

.lg-form-head p {
    font-size: 13.5px;
    color: #94a3b8;
    margin: 0 0 30px;
}

.lg-field {
    margin-bottom: 18px;
}

.lg-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 7px;
}

.lg-input-wrap {
    position: relative;
}

.lg-input-wrap .material-symbols-rounded.lg-ico {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 19px;
    color: #94a3b8;
    pointer-events: none;
}

.lg-input-wrap input {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0 14px 0 44px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: all .2s;
}

.lg-input-wrap input:focus {
    border-color: #4f46e5;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

.lg-toggle-pw {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
}

.lg-toggle-pw:hover {
    background: #f1f5f9;
    color: #4f46e5;
}

.lg-toggle-pw .material-symbols-rounded {
    font-size: 19px;
}

.lg-error {
    display: none;
    align-items: center;
    gap: 8px;
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}

.lg-error .material-symbols-rounded {
    font-size: 17px;
}

.lg-shell.lg-shake {
    animation: lg-shake .4s;
}

@keyframes lg-shake {

    10%,
    90% {
        transform: translateX(-3px);
    }

    20%,
    80% {
        transform: translateX(5px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-7px);
    }

    40%,
    60% {
        transform: translateX(7px);
    }
}

.lg-submit {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 12px;
    background: #4f46e5;
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(79, 70, 229, .3);
    transition: all .2s;
}

.lg-submit:hover:not(:disabled) {
    background: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 8px 15px rgba(79, 70, 229, .4);
}

.lg-submit:disabled {
    opacity: .7;
    cursor: default;
}

.lg-submit .material-symbols-rounded {
    font-size: 18px;
}

.lg-spin {
    animation: lg-spin .8s linear infinite;
}

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

.lg-foot-hint {
    text-align: center;
    font-size: 12px;
    color: #cbd5e1;
    margin-top: 22px;
}

@media (max-width: 780px) {
    .lg-brand {
        display: none;
    }

    .lg-shell {
        min-height: 0;
    }

    .lg-form-panel {
        padding: 40px 28px;
    }
}
    

/* =============================================================
 *  เพิ่มเติมของระบบ — ไม่มีใน template ต้นฉบับ
 *  (ต้นฉบับไม่มีช่อง "จำชื่อผู้ใช้" และซ่อน error box ด้วย inline style
 *   ส่วนระบบนี้ใช้ attribute hidden เพราะ login.js สลับด้วย .prop('hidden'))
 * ============================================================= */

/* ต้นฉบับตั้ง .lg-error{display:none} แล้วให้ JS เปลี่ยนเป็น flex เอง
   ระบบนี้ให้ CSS คุมแทน จะได้ไม่ต้องพึ่ง inline style (CSP) */
.lg-error {
    display: flex;
}

.lg-error[hidden] {
    display: none;
}

/* แถวจำชื่อผู้ใช้ — วางระหว่างช่องรหัสผ่านกับปุ่มเข้าสู่ระบบ */
.lg-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -4px 0 18px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.lg-remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent, #6366f1);
    cursor: pointer;
    margin: 0;
}

/* ไอคอนหมุนตอนกำลังเข้าสู่ระบบ — login.js สลับคลาสนี้ที่ไอคอนในปุ่ม */
.lg-submit .lg-spin {
    animation: lg-spin .8s linear infinite;
}

/* ข้อผิดพลาดรายช่อง — โผล่เฉพาะตอน JavaScript ใช้ไม่ได้ (เส้นทาง POST /login)
   เพราะถ้า JS ทำงาน ข้อความจะไปรวมอยู่ในกล่อง .lg-error ด้านบนแทน */
.lg-field-error {
    margin-top: 6px;
    font-size: 12px;
    color: #e11d48;
}

/* โลโก้จริงแทนตัวย่อ "ST" ที่ต้นฉบับใช้ — พื้นของไฟล์โลโก้ถูกทำให้ใสแล้ว
   (scripts/make_logo_transparent.php) จึงวางทับพื้นไล่สีของแถบแบรนด์ได้เลย */
.lg-logo-mark {
    background: rgba(255, 255, 255, .14);
    padding: 4px;
    overflow: hidden;
}

.lg-logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* โลโก้ตัวใหญ่กลางแถบแบรนด์ */
.lg-brand-logo {
    display: block;
    width: 132px;
    height: 132px;
    object-fit: contain;
    margin-bottom: 20px;
    /* เงาอ่อนๆ ให้โลโก้ลอยออกจากพื้นไล่สี ไม่จมไปกับสีเขียว-เหลืองที่ใกล้เคียงกัน */
    filter: drop-shadow(0 6px 18px rgba(15, 23, 42, .28));
}

/* จอเตี้ยไม่ต้องโชว์โลโก้ใหญ่ ไม่งั้นเนื้อหาในแถบแบรนด์จะล้น */
@media (max-height: 700px) {
    .lg-brand-logo {
        display: none;
    }
}
