/* ============================================================
   หน้าสาธารณะ (เข้าสู่ระบบ · ลืมรหัสผ่าน · ตั้งรหัสผ่าน) — ธีม Ocean
   ใช้ร่วมกัน: templates/login.php, modules/forgot_password, templates/set_password.php
   ============================================================ */
:root {
    --pb-brand: #0d9488;
    --pb-brand-dark: #0f766e;
    --pb-sky: #0ea5e9;
    --pb-grad: linear-gradient(135deg, #0d9488 0%, #0ea5e9 100%);
    --pb-ink: #0f172a;
    --pb-muted: #64748b;
    --pb-line: #dbe5ea;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    font-family: 'Bai Jamjuree', 'Noto Sans Thai', -apple-system, 'Segoe UI', sans-serif;
    color: var(--pb-ink); position: relative; overflow-x: hidden;
    background: linear-gradient(135deg, #053f45 0%, #0b6b73 48%, #0ea5e9 100%);
    background-attachment: fixed;
}
/* วงกลมตกแต่งพื้นหลัง */
body::before, body::after { content: ''; position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; }
body::before { width: 520px; height: 520px; right: -160px; top: -200px; background: rgba(255,255,255,.07); }
body::after  { width: 380px; height: 380px; left: -120px; bottom: -160px; background: rgba(255,255,255,.06); }
.bg-animated, .orb { display: none !important; }   /* ของเดิมแบบมืด — ไม่ใช้แล้ว */

/* ---------- เปลือกหลัก (หน้า login แบ่ง 2 ฝั่ง) ---------- */
.pub-shell { position: relative; z-index: 2; width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr;
    border-radius: 28px; overflow: hidden; background: #fff; box-shadow: 0 40px 80px -30px rgba(0,0,0,.55); }
.pub-brand { position: relative; padding: 48px 44px; color: #fff; display: flex; flex-direction: column; justify-content: center; gap: 22px;
    background: linear-gradient(160deg, #064e4e 0%, #0d9488 60%, #0ea5e9 130%); overflow: hidden; }
.pub-brand::before { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -110px; top: -110px; background: rgba(255,255,255,.09); }
.pub-brand::after  { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -80px; bottom: -90px; background: rgba(255,255,255,.07); }
.pub-brand > * { position: relative; z-index: 1; }
.pub-logo { width: 62px; height: 62px; border-radius: 18px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
    font-size: 27px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.pub-logo-card { background: #fff; border-radius: 18px; padding: 14px 22px; width: fit-content; max-width: 100%;
    box-shadow: 0 16px 30px -16px rgba(0,0,0,.5); }
.pub-logo-card img { display: block; height: 56px; width: auto; max-width: 100%; }
.pub-brand h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.pub-brand .tag { margin: 4px 0 0; font-size: .98rem; opacity: .88; }
.pub-feats { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.pub-feats li { display: flex; align-items: center; gap: 12px; font-size: .95rem; opacity: .95; }
.pub-feats i { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.pub-form { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.pub-form h2 { margin: 0 0 4px; font-size: 1.55rem; font-weight: 700; color: var(--pb-ink); }
.pub-form .sub { margin: 0 0 26px; color: var(--pb-muted); font-size: .95rem; }

/* ---------- การ์ดเดี่ยว (ลืมรหัสผ่าน / ตั้งรหัสผ่าน) ---------- */
.fp-wrap, .sp-card { position: relative; z-index: 2; width: 100%; max-width: 450px; }
.glass-card, .sp-card { background: #fff; border-radius: 26px; overflow: hidden; box-shadow: 0 40px 80px -30px rgba(0,0,0,.55); border: 0; }
.card-top, .sp-header { padding: 38px 32px 20px; text-align: center; background: transparent; color: var(--pb-ink); position: relative; }
.card-top::before, .sp-header::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--pb-grad); }
.icon-box { width: 70px; height: 70px; border-radius: 20px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center;
    background: var(--pb-grad) !important; box-shadow: 0 16px 28px -14px rgba(13,148,136,.8); color: #fff; }
.icon-box i { font-size: 27px; color: #fff; }
.card-top h1, .sp-header h1 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 700; color: var(--pb-ink); letter-spacing: -.01em; }
.card-top p, .sp-header p { margin: 0; font-size: .92rem; color: var(--pb-muted); opacity: 1 !important; }
.card-body, .sp-body { padding: 8px 32px 34px; }

/* ---------- ช่องกรอก ---------- */
.fw, .input-group-modern { position: relative; margin-bottom: 18px; }
.fw .fi, .input-group-modern .input-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #8aa3ad; font-size: 15px; z-index: 2; pointer-events: none; transition: color .2s; }
.fw input, .input-group-modern input, .sp-card .form-control {
    width: 100%; padding: 15px 16px 15px 46px; background: #f5fafa; border: 1.5px solid var(--pb-line); border-radius: 14px;
    color: var(--pb-ink); font-size: 16px; font-family: inherit; outline: none; transition: all .2s;
}
.fw input::placeholder, .input-group-modern input::placeholder { color: #9bb0b8; }
.fw input:hover, .input-group-modern input:hover { border-color: #c1d3da; background: #fff; }
.fw input:focus, .input-group-modern input:focus, .sp-card .form-control:focus { background: #fff; border-color: var(--pb-brand); box-shadow: 0 0 0 4px rgba(13,148,136,.14); }
.fw input:focus ~ .fi, .input-group-modern input:focus ~ .input-icon { color: var(--pb-brand); }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #8aa3ad; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; z-index: 3; }
.pw-toggle:hover { background: #eef6f7; color: var(--pb-brand-dark); }
.sp-card .input-group { display: flex; }
.sp-card .input-group .form-control { flex: 1 1 auto; width: 1%; min-width: 0; padding-left: 16px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.sp-card .input-group .btn { flex: 0 0 auto; width: 48px; display: flex; align-items: center; justify-content: center; padding: 0; }
.sp-card .input-group .btn { border: 1.5px solid var(--pb-line); border-left: 0; border-radius: 0 14px 14px 0; background: #f5fafa; color: var(--pb-muted); }
.sp-card .form-label { font-weight: 600; color: #334155; }

/* ---------- ปุ่ม ---------- */
.btn-fp, .btn-modern, .btn-set {
    width: 100%; padding: 15px 18px; border: 0; border-radius: 14px; color: #fff; font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none; letter-spacing: .01em;
    background: var(--pb-grad); box-shadow: 0 16px 26px -14px rgba(13,148,136,.9); transition: transform .15s, filter .15s, box-shadow .15s;
}
.btn-fp:hover, .btn-modern:hover, .btn-set:hover { transform: translateY(-2px); filter: brightness(1.06); color: #fff; box-shadow: 0 20px 30px -14px rgba(13,148,136,.95); }
.btn-fp:active, .btn-modern:active, .btn-set:active { transform: translateY(0); }
.btn-fp:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-green { background: linear-gradient(135deg, #10b981, #059669) !important; box-shadow: 0 16px 26px -14px rgba(5,150,105,.9) !important; }

/* ---------- ข้อความแจ้ง ---------- */
.error-msg, .msg-box { display: flex; align-items: flex-start; gap: 10px; border-radius: 14px; padding: 13px 16px; font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.error-msg, .msg-err { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.msg-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.sp-card .alert { border-radius: 14px; }

/* ---------- ลิงก์ / ท้ายหน้า ---------- */
.pub-link, .back-link { display: block; text-align: center; margin-top: 20px; color: var(--pb-brand-dark); font-size: 14px; font-weight: 600; text-decoration: none; }
.pub-link:hover, .back-link:hover { text-decoration: underline; color: var(--pb-brand-dark); }
.login-footer, .fp-footer { text-align: center; padding-top: 20px; color: rgba(255,255,255,.75); font-size: 12.5px; position: relative; z-index: 2; }

/* ---------- ความแข็งแรงรหัสผ่าน ---------- */
.sbar, .strength-bar { height: 6px; border-radius: 6px; margin-top: 8px; background: #e6eef1; overflow: hidden; }
.sfill { height: 100%; width: 0; border-radius: 6px; transition: width .3s, background .3s; }
.stxt { font-size: 12px; color: var(--pb-muted); margin-top: 5px; min-height: 15px; }

/* ---------- ปรับสีข้อความที่ฝัง inline สำหรับพื้นมืดเดิม ให้อ่านได้บนการ์ดขาว ---------- */
.glass-card [style*="color:rgba(255,255,255"], .glass-card [style*="color: rgba(255,255,255"] { color: var(--pb-muted) !important; }
.glass-card strong[style*="color:rgba(255,255,255"] { color: var(--pb-ink) !important; }
.glass-card [style*="color:#6ee7b7"] { color: #059669 !important; }
.glass-card [style*="color:#fca5a5"] { color: #dc2626 !important; }
.glass-card [style*="color:#fff"] { color: #fff !important; }
.glass-card .btn-fp[style*="color"], .glass-card .btn-fp { color: #fff !important; }
.glass-card [style*="color:#d1d5db"], .glass-card [style*="color:#9ca3af"] { color: #94a3b8 !important; }

/* ปุ่มรอง (ของเดิมเป็นปุ่มโปร่งแสงบนพื้นมืด) */
.glass-card .btn-fp[style*="rgba(255,255,255,.08)"] { background: #eef6f7 !important; color: var(--pb-brand-dark) !important; box-shadow: none !important; }
@keyframes popIn { 0% { transform: scale(.5); opacity: 0; } 80% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---------- มือถือ ---------- */
@media (max-width: 860px) {
    body { padding: 16px; align-items: center; min-height: 100vh; min-height: 100dvh; }   /* จัดกึ่งกลางจอแนวตั้ง (100dvh = ไม่รวมแถบเบราว์เซอร์มือถือ) */
    .pub-shell { grid-template-columns: 1fr; border-radius: 24px; margin: 0 auto; }
    .pub-shell + .login-footer { padding-top: 16px; }
    .pub-brand { padding: 28px 26px; gap: 14px; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .pub-brand h1 { font-size: 1.3rem; }
    .pub-brand .tag { font-size: .88rem; }
    .pub-feats { display: none; }
    .pub-logo { width: 52px; height: 52px; font-size: 22px; border-radius: 15px; }
    .pub-logo-card { padding: 10px 16px; border-radius: 14px; }
    .pub-logo-card img { height: 42px; }
    .pub-form { padding: 28px 24px 30px; }
}
@media (max-width: 480px) {
    .card-top, .sp-header { padding: 32px 22px 16px; }
    .card-body, .sp-body { padding: 6px 22px 28px; }
}
input[type="text"], input[type="password"], input[type="email"] { font-size: 16px !important; }
@supports (padding-top: env(safe-area-inset-top)) {
    body { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
