/* login.css — IL-SYNC
   standalone lightweight สำหรับหน้า login / forgot-password / reset-password
   ไม่โหลด bootstrap หรือ app-shell.css เพราะยังไม่มีประโยชน์ก่อนล็อกอิน (first load เร็ว)

   ⚠️ สีหลักของโปรเจกต์อยู่ 2 ไฟล์และ "ไม่ share ตัวแปรกัน" — แก้สีต้องแก้ทั้งคู่:
      - assets/css/login.css   (ไฟล์นี้) หน้าที่ยังไม่ล็อกอิน
      - assets/css/app-shell.css               หน้าที่ล็อกอินแล้ว */

@font-face {
    font-family: "ChulabhornLikit";
    src: url("../fonts/chulabhornlikittext-regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "ChulabhornLikit";
    src: url("../fonts/chulabhornlikittext-medium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "ChulabhornLikit";
    src: url("../fonts/chulabhornlikittext-bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --ilsync-bg: #fce7f3;
    --ilsync-accent: #be185d;
    --ilsync-accent-dark: #9d174d;
    --ilsync-red: #e6564f;
    --form-text: #4a044e;
    --form-muted: #7a4460;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "ChulabhornLikit", system-ui, "Segoe UI", sans-serif;
    background: linear-gradient(160deg, #fce7f3 0%, #fde68a 48%, #ddd6fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    /* การ์ดขาวตัดกับพื้น pastel — ในระบบพื้นหน้าใช้ --app-body-bg (#fff7fa) */
    background: #ffffff;
    border: 1px solid rgba(157, 23, 77, 0.12);
    border-radius: 12px;
    padding: 32px 28px;
    color: var(--form-text);
    box-shadow: 0 18px 50px rgba(157, 23, 77, 0.18);
}

.login-brand {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.login-brand img.logo { width: 56px; height: auto; border-radius: 0; flex-shrink: 0; margin-top: 2px; }
.login-brand .title { font-size: 18px; font-weight: 700; line-height: 1.25; }
.login-brand .title small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--form-muted);
}

.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--form-muted); }

.input-wrap { position: relative; }

.input-group {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
}

.input-group .form-control {
    flex: 1 1 auto;
    min-width: 0;
    width: 1%;
    height: 44px;
    padding: 0 12px;
    border-radius: 8px 0 0 8px;
    border: 1px solid rgba(0,0,0,0.15);
    border-right: 0;
    background: #fff;
    color: var(--form-text);
    font-size: 14px;
    font-family: inherit;
}

.input-group-text {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 10px;
    border: 1px solid rgba(0,0,0,0.15);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #fce7f3;
    color: var(--form-muted);
    font-size: 13px;
    white-space: nowrap;
}

.input-group:focus-within .form-control,
.input-group:focus-within .input-group-text {
    border-color: var(--ilsync-accent);
}

.form-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--form-muted);
    text-align: center;
}

input[type="email"], input[type="password"], input[type="text"] {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.15);
    background: #fff;
    color: var(--form-text);
    font-size: 14px;
    font-family: inherit;
}
input:focus { outline: none; border-color: var(--ilsync-accent); }

.btn-eye {
    position: absolute;
    right: 6px;
    top: 6px;
    height: 32px;
    width: 32px;
    border: none;
    background: transparent;
    color: var(--form-muted);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--ilsync-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary:hover:not(:disabled) { background: var(--ilsync-accent-dark); }

.btn-google {
    width: 100%;
    height: 44px;
    margin-top: 10px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 8px;
    background: #fff;
    color: var(--form-text);
    font-size: 14px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
}
.btn-google:hover { background: #fff1f5; }

.btn-dev {
    width: 100%;
    height: 40px;
    border: 1px dashed rgba(190, 24, 93, 0.55);
    border-radius: 8px;
    background: rgba(190, 24, 93, 0.08);
    color: var(--ilsync-accent);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.btn-dev:hover { background: rgba(190, 24, 93, 0.15); }

.error-box {
    background: #ebd8d1;
    border: 1px solid rgba(230,86,79,0.35);
    color: #8f2e28;
    font-size: 13px;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.success-box {
    background: #d5e0d3;
    border: 1px solid rgba(45,150,90,0.35);
    color: #146038;
    font-size: 13px;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

/* รายการ error หลายข้อจาก PasswordPolicy — แสดงพร้อมกันทุกข้อในกล่องเดียว */
.hint-list { margin: 6px 0 0; padding-left: 18px; }
.hint-list li { margin-bottom: 2px; }

/* ลิงก์รอง เช่น "ลืมรหัสผ่าน?" / "กลับไปหน้าเข้าสู่ระบบ" */
.link-muted {
    display: inline-block;
    font-size: 12px;
    color: var(--form-muted);
    text-decoration: none;
}
.link-muted:hover { color: var(--ilsync-accent); text-decoration: underline; }
.link-row { margin-top: 10px; text-align: center; }

/* ตัวนับความยาวรหัสผ่าน (assets/js/reset-password.js) */
.pw-counter { font-size: 12px; color: var(--form-muted); margin-top: 6px; display: block; }
.pw-counter.ok { color: #1f7a4d; }

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: var(--form-muted);
}

.htmx-request .btn-primary-label { display: none; }
.htmx-request .btn-primary-spinner { display: inline !important; text-align: center; }
.btn-primary-spinner { display: none; }
