/* ============================================================
   TPSO Dashboard — Login Page CSS
   Theme  : Navy #0d1e3d + Gold #c4a032
   Font   : Sarabun (Google Fonts)
   Version: 2.0
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
:root {
    --navy-dark  : #0a1a32;
    --navy       : #0d1e3d;
    --navy-mid   : #1a3a6e;
    --navy-light : #0f2856;
    --gold       : #c4a032;
    --gold-light : rgba(196, 160, 50, .18);
    --gold-border: rgba(196, 160, 50, .32);
    --white      : #ffffff;
    --form-bg    : #ffffff;
    --input-bg   : #f7f9fc;
    --input-border: #e5e9f0;
    --input-focus : #1a3a6e;
    --text-primary: #0d1e3d;
    --text-muted  : #aaa;
    --text-label  : #444;
    --radius      : 8px;
    --radius-lg   : 12px;
    --transition  : all .22s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body.login-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
    font-size: 15px;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ── Wrapper ───────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 540px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
    margin: 20px;
    position: relative;
}

/* ═══════════════════════════════════════════════════════
   LEFT PANEL — Branding / Background
   ═══════════════════════════════════════════════════════ */
.login-brand {
    flex: 1;
    position: relative;
    overflow: hidden;

    /*
     * ── Background Image Config ──────────────────────────
     * เปลี่ยนภาพพื้นหลัง: แก้เพียง background-image บรรทัดเดียว
     * ตัวอย่าง:
     *   background-image: url('/Images/login-bg.jpg');
     * ปัจจุบัน: ใช้ gradient แทนภาพจริง
     */
    background-image:
        linear-gradient(145deg,
            var(--navy-dark) 0%,
            var(--navy-mid)  45%,
            var(--navy-light) 100%);
    background-size: cover;
    background-position: center;
}

/* Grid overlay */
.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(196, 160, 50, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(196, 160, 50, .05) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
}

/* Glow overlay */
.login-brand::after {
    content: '';
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 160, 50, .12) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Gold accent bar (ซ้าย) */
.login-brand-bar {
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 5%,
        var(--gold) 30%,
        var(--gold) 70%,
        transparent 95%);
    z-index: 2;
}

/* Brand content */
.login-brand-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 44px 48px 160px;
}

/* Logo row */
.login-brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 44px;
}

.login-brand-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--gold-light);
    border: 2px solid var(--gold-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-brand-name {
    font-size: 2em; /*15px;*/
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

.login-brand-name span {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, .45);
    margin-top: 3px;
    line-height: 1.4;
}

/* Headline */
.login-brand-headline {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.45;
    margin-bottom: 10px;
}

.login-brand-headline em {
    font-style: normal;
    color: var(--gold);
}

/* Description */
.login-brand-desc {
    font-size: 12.5px;
    color: rgba(255, 255, 255, .45);
    line-height: 1.7;
    margin-bottom: 28px;
}

/* Feature list */
.login-brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.login-brand-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .7);
}

.login-brand-features li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
}

/* Footer */
.login-brand-footer {
    position: absolute;
    bottom: 20px;
    left: 48px;
    font-size: 10px;
    color: rgba(255, 255, 255, .2);
    z-index: 3;
}

/* ═══════════════════════════════════════════════════════
   RIGHT PANEL — Login Form
   ═══════════════════════════════════════════════════════ */
.login-form-panel {
    width: 400px;
    flex-shrink: 0;
    background: var(--form-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 44px 38px;
    position: relative;
}

/* Gold top bar */
.login-form-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--gold) 0%,
        rgba(196, 160, 50, .25) 60%,
        transparent 100%);
}

/* Form title */
.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.login-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 26px;
}

/* Alert */
.login-alert {
    background: #fff0f0;
    border: 1px solid #ffc5c5;
    color: #c0392b;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-alert.show { display: block; }

/* Labels */
.login-form-panel .form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 6px;
}

/* Inputs */
.login-form-panel .input-group {
 /*   margin-bottom: 14px;*/
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.login-form-panel .input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-form-panel .input-icon {
    position: absolute;
    left: 12px;
    color: #bbb;
    font-size: 15px;
    z-index: 2;
    pointer-events: none;
    transition: var(--transition);
}

.login-form-panel .form-control {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    background: var(--input-bg);
    padding: 0 42px 0 38px;
    font-size: 14px;
    font-family: 'Sarabun', sans-serif;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.login-form-panel .form-control:focus {
    border-color: var(--input-focus);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(26, 58, 110, .08);
}

.login-form-panel .form-control:focus + .input-icon,
.login-form-panel .input-wrap:focus-within .input-icon {
    color: var(--navy-mid);
}

.login-form-panel .form-control.is-invalid {
    border-color: #e74c3c;
    background: #fffafa;
}

/* Eye toggle */
.btn-eye {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #bbb;
    cursor: pointer;
    padding: 6px;
    font-size: 15px;
    transition: var(--transition);
    z-index: 2;
}

.btn-eye:hover { color: var(--navy-mid); }

/* Remember me */
.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 12.5px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.login-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--navy-mid);
    cursor: pointer;
}

/* Submit button */
.btn-login {
    width: 100%;
    height: 46px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 700;
    font-family: 'Sarabun', sans-serif;
    letter-spacing: .03em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: var(--navy-mid);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 30, 61, .35);
}

.btn-login:active { transform: translateY(0); }

.btn-login-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: inline;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-login .spinner-border {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* Divider */
.login-divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(196, 160, 50, .4),
        transparent);
    margin: 14px 0;
}

/* Form footer */
.login-form-footer {
    text-align: center;
    font-size: 11.5px;
    color: #ccc;
    line-height: 1.6;
}

.login-form-footer strong {
    color: var(--gold);
    font-weight: 500;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.shake { animation: shake .4s ease; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — Mobile (max 768px)
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    body.login-body {
        align-items: flex-start;
        background: var(--white);
    }

    .login-wrapper {
        flex-direction: column;
        max-width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    /* ซ่อน Brand panel บน Mobile */
    .login-brand { display: none; }

    .login-form-panel {
        width: 100%;
        min-height: 100vh;
        padding: 48px 28px 32px;
        justify-content: flex-start;
        padding-top: 64px;
    }

    /* แสดง mini logo บน Mobile แทน */
    .login-mobile-header {
        display: flex !important;
        align-items: center;
        gap: 10px;
        margin-bottom: 32px;
    }

    .login-form-panel::before {
        height: 4px;
    }
}

/* ซ่อน mobile header บน Desktop */
.login-mobile-header {
    display: none;
}
