/*
 * samo-auth.css — หน้าเข้าสู่ระบบของสโมสรนักศึกษาคณะศึกษาศาสตร์ มข.
 * ใช้ร่วมกัน: equipment-rental/auth-login.php, equipment-rental/admin/index.php, admin/index.php
 *
 * สีมาจากโลโก้ SAMOED (อิฐ + ส้ม) และตึกคณะ (ส้มหอบัว / ฟ้ายามเย็น)
 */
:root {
    --brick: #8A2F1F;        /* ตัวอักษร SAMO ในโลโก้ */
    --brick-deep: #4A170E;   /* เงาไล่สีบนภาพ */
    --ember: #F15A22;        /* ส้ม ED / หอบัว — ใช้ตกแต่งเท่านั้น (คอนทราสต์กับขาวไม่พอสำหรับตัวหนังสือ) */
    --ember-ink: #C4411A;    /* ส้มเข้มสำหรับปุ่มและลิงก์ (ตัวหนังสือขาวอ่านได้) */
    --ember-ink-hover: #A53614;
    --paper: #FFFAF6;
    --ink: #2B1B15;
    --muted: #76655E;
    --line: #EADCD3;
    --field: #FFFFFF;

    --font-display: 'Kanit', 'Prompt', sans-serif;
    --font-body: 'Prompt', 'Kanit', sans-serif;
}

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

html, body { margin: 0; }

body.auth {
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

/* ---------- แผงภาพตึกคณะ (ซ้าย) ---------- */
.auth-scene {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px;
    background:
        linear-gradient(180deg, rgba(20, 30, 70, 0) 30%, rgba(74, 23, 14, 0.7) 62%, rgba(74, 23, 14, 0.96) 88%),
        url("../../equipment-rental/assets/images/background/%E0%B8%9B%E0%B8%81%E0%B8%84%E0%B8%93%E0%B8%B0.jpg");
    background-size: cover;
    /* โฟกัสที่หอบัวสีส้มกลางตึก */
    background-position: 50% 62%;
}

.auth-scene-eyebrow {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    opacity: 0.85;
    margin: 0 0 10px;
}

.auth-scene-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.15;
    margin: 0 0 14px;
    text-wrap: balance;
}

.auth-scene-text {
    font-size: 1rem;
    max-width: 30ch;
    margin: 0;
    opacity: 0.92;
}

/* แถบส้มหัวมน — หยิบมาจากเส้นใต้ตัวอักษรในโลโก้ SAMOED */
.logo-bar {
    display: block;
    width: 64px;
    height: 8px;
    border-radius: 999px;
    background: var(--ember);
    margin: 22px 0 0;
}

/* ---------- ฝั่งฟอร์ม (ขวา) ---------- */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 32px;
    min-height: 100vh;
}

.auth-panel {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    animation: auth-rise 0.45s ease-out both;
}

.auth-logo {
    display: inline-block;
    margin-bottom: 28px;
}

.auth-logo img {
    height: 52px;
    width: auto;
    display: block;
}

.auth-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.25;
    margin: 0 0 6px;
}

.auth-subtitle {
    color: var(--muted);
    margin: 0 0 24px;
}

/* ---------- แท็บ เข้าสู่ระบบ / สร้างบัญชี ---------- */
.auth-tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}

.auth-tab {
    position: relative;
    background: none;
    border: 0;
    padding: 10px 0 14px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--muted);
    cursor: pointer;
}

.auth-tab[aria-selected="true"] { color: var(--ink); }

.auth-tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 7px;
    border-radius: 999px;
    background: var(--ember);
}

.auth-tab:focus-visible { outline: 3px solid rgba(241, 90, 34, 0.45); outline-offset: 4px; border-radius: 6px; }

/* ---------- ช่องกรอก ---------- */
.field { margin-bottom: 18px; }

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field-row.prefix { grid-template-columns: 120px 1fr; }

.field label {
    display: block;
    font-weight: 500;
    font-size: 0.92rem;
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    font: inherit;
    color: var(--ink);
    background: var(--field);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field select { appearance: auto; }

.field input::placeholder { color: #B3A39B; }

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--ember-ink);
    box-shadow: 0 0 0 4px rgba(241, 90, 34, 0.18);
}

.field-hint {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    margin-top: 6px;
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 76px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 6px 10px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ember-ink);
    cursor: pointer;
    border-radius: 8px;
}

.password-toggle:focus-visible { outline: 3px solid rgba(241, 90, 34, 0.45); }

/* ---------- ปุ่ม ---------- */
.btn-auth {
    width: 100%;
    height: 54px;
    margin-top: 8px;
    border: 0;
    border-radius: 999px;
    background: var(--ember-ink);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.15s;
}

.btn-auth:hover { background: var(--ember-ink-hover); }
.btn-auth:active { transform: translateY(1px); }
.btn-auth:focus-visible { outline: 3px solid rgba(241, 90, 34, 0.5); outline-offset: 3px; }

/* ---------- ข้อความแจ้ง ---------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 22px;
    border-radius: 12px;
    background: var(--n-bg);
    border: 1px solid var(--n-line);
    color: var(--n-ink);
    font-size: 0.93rem;
    line-height: 1.5;
}

/* ไอคอนวงกลมเล็กหน้าข้อความ */
.notice::before {
    content: "!";
    flex: 0 0 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--n-ink);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1;
}

.notice-ok   { --n-bg: #F1F8F3; --n-line: #CFE7D6; --n-ink: #1E6B34; }
.notice-ok::before { content: "✓"; }
.notice-warn { --n-bg: #FFF7EC; --n-line: #F6DDB8; --n-ink: #8A4B0A; }
.notice-err  { --n-bg: #FDF1EF; --n-line: #F3CFC9; --n-ink: #A0281C; }

.legacy-note {
    background: #FFF1E8;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.88rem;
    color: #6E3B26;
    margin: 4px 0 20px;
}

/* ---------- ท้ายฟอร์ม ---------- */
.auth-foot {
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 18px;
    font-size: 0.86rem;
    color: var(--muted);
}

.auth-foot a { color: var(--ember-ink); text-decoration: none; font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot a:focus-visible { outline: 3px solid rgba(241, 90, 34, 0.45); border-radius: 4px; }
.auth-foot-links { display: flex; gap: 16px; }

[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-panel { animation: none; }
    .btn-auth, .field input, .field select { transition: none; }
}

/* ---------- มือถือ / แท็บเล็ต: ภาพตึกเป็นแถบด้านบน ---------- */
@media (max-width: 900px) {
    body.auth { grid-template-columns: 1fr; }

    .auth-scene {
        position: relative;
        height: auto;
        min-height: 230px;
        padding: 28px 20px 24px;
        background-position: 50% 58%;
    }

    .auth-scene-title { font-size: 1.7rem; margin-bottom: 6px; }
    .auth-scene-text { font-size: 0.92rem; max-width: none; }
    .logo-bar { width: 48px; height: 6px; margin-top: 14px; }

    .auth-main { min-height: 0; padding: 28px 16px 40px; justify-content: flex-start; }
    .auth-logo { margin-bottom: 20px; }
    .auth-logo img { height: 40px; }
    .auth-title { font-size: 1.5rem; }
}

@media (max-width: 420px) {
    .field-row, .field-row.prefix { grid-template-columns: 1fr; gap: 0; }
}
