/* assets/css/auth.css — หน้าเข้าสู่ระบบ และหน้าแจ้งผลการเข้าสู่ระบบ (ใช้ร่วมกัน) */
/* ===== Design Tokens (Modern B2B Enterprise / Clean SaaS) ===== */
:root {
  --pf-primary: #1e3a8a;        /* Core Brand Navy */
  --pf-primary-hover: #1e40af;
  --pf-primary-active: #0f172a;
  --pf-primary-50: #eff6ff;
  --pf-primary-200: #bfdbfe;
  --pf-brand-maroon: #6b1416;   /* สีเฟืองจากตราคณะ */
  --pf-bg: #f8fafc;
  --pf-surface: #ffffff;
  --pf-field: #f8fafc;
  --pf-border: #e2e8f0;
  --pf-border-strong: #cbd5e1;
  --pf-text: #0f172a;
  --pf-text-body: #334155;
  --pf-text-muted: #64748b;
  --pf-text-subtle: #94a3b8;
  --pf-danger: #e11d48;
  --pf-radius-lg: 16px;
  --pf-radius-md: 10px;
  --pf-shadow-card: 0 20px 40px -15px rgba(15, 23, 42, .08), 0 0 1px 1px rgba(226, 232, 240, .8);
  --pf-shadow-btn: 0 4px 14px 0 rgba(30, 58, 138, .35);
  --pf-ring: 0 0 0 3px rgba(30, 58, 138, .18);
}

* { box-sizing: border-box; }

html, body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  color: var(--pf-text-body);
  background: var(--pf-bg);
  font-family: var(--app-font, 'Sarabun', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* ===== Subtle Engineering Grid Background ===== */
.bg-grid,
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-grid {
  opacity: .7;
  background-size: 32px 32px;
  background-image:
    linear-gradient(to right, rgba(226, 232, 240, .55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, .55) 1px, transparent 1px);
}
.bg-glow {
  background: radial-gradient(circle at 50% 15%, rgba(30, 58, 138, .07) 0%, rgba(248, 250, 252, 0) 70%);
}

/* ===== Modern Minimalist Header ===== */
.pf-header {
  position: relative;
  z-index: 10;
  width: 100%;
  background: rgba(255, 255, 255, .72);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.pf-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pf-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.pf-brand img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}
.pf-brand-text { line-height: 1.25; min-width: 0; }
.pf-brand-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--pf-text);
  font-size: 1.2rem;
  font-weight: 700;
}
.pf-brand-sub {
  margin: 2px 0 0;
  color: var(--pf-text-muted);
  font-size: .8rem;
  font-weight: 500;
}
.pf-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}
.pf-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pfPulse 2s ease-in-out infinite;
}
@keyframes pfPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ===== Main ===== */
.login-shell {
  position: relative;
  z-index: 10;
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
}
.login-container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Auth Card ===== */
.login-card {
  background: var(--pf-surface);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-card);
  padding: 20px 30px 22px;
}
.login-card-header {
  text-align: center;
  margin-bottom: 14px;
}
.login-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 12px;
  color: var(--pf-primary);
  background: var(--pf-primary-50);
  border: 1px solid var(--pf-primary-200);
  font-size: 1.35rem;
}
.login-card-header h1 {
  margin: 0;
  color: var(--pf-text);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
}
.login-card-header p {
  margin: 2px 0 0;
  color: var(--pf-text-muted);
  font-size: .88rem;
  line-height: 1.4;
}

/* ===== Form Controls ===== */
.form-group-custom { margin-bottom: 10px; }

.pf-label {
  display: block;
  margin-bottom: 4px;
  color: var(--pf-text-body);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.pf-label .req { color: var(--pf-danger); margin-left: 2px; }
.pf-label .hint {
  font-weight: 500;
  color: var(--pf-text-subtle);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .72rem;
}

.pf-field {
  position: relative;
}
.pf-field-icon {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pf-text-subtle);
  font-size: 1.05rem;
  pointer-events: none;
  transition: color .15s ease;
}
.pf-field-icon.is-brand { color: var(--pf-primary); }

.pf-input,
.pf-select {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 8px 14px 8px 46px;
  color: var(--pf-text);
  font-family: inherit;
  font-size: .95rem;
  background: var(--pf-field);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  outline: none;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pf-input::placeholder { color: var(--pf-text-subtle); }
.pf-input:hover,
.pf-select:hover { border-color: var(--pf-border-strong); }
.pf-input:focus,
.pf-select:focus {
  background: #fff;
  border-color: var(--pf-primary);
  box-shadow: var(--pf-ring);
}
.pf-field:focus-within .pf-field-icon { color: var(--pf-primary); }

.pf-input.has-toggle { padding-right: 50px; }

.pf-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--pf-text-subtle);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 1.05rem;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.pf-toggle:hover { color: var(--pf-text-body); background: #f1f5f9; }
.pf-toggle:focus-visible { outline: none; box-shadow: var(--pf-ring); }

/* Custom Select Dropdown */
.pf-select {
  padding-right: 46px;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none;
}
.pf-select-chevron {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pf-text-muted);
  font-size: .9rem;
  pointer-events: none;
}

/* ===== Submit Button ===== */
.btn-pf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: var(--pf-primary);
  border: 1px solid var(--pf-primary);
  border-radius: var(--pf-radius-md);
  box-shadow: var(--pf-shadow-btn);
  cursor: pointer;
  transition: background-color .2s ease, transform .1s ease, box-shadow .2s ease;
}
.btn-pf:hover { background: var(--pf-primary-hover); border-color: var(--pf-primary-hover); color: #fff; }
.btn-pf:active { background: var(--pf-primary-active); transform: translateY(1px); }
.btn-pf:focus-visible { outline: none; box-shadow: var(--pf-shadow-btn), 0 0 0 3px #fff, 0 0 0 5px var(--pf-primary); }
.btn-pf i { font-size: 1.1rem; }

/* ===== Flash / Error Message ===== */
#flash_message { margin-bottom: 0; }
#flash_message:not(:empty) { margin-bottom: 12px; }

.alert-login-error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 12px;
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--pf-radius-md);
  font-size: .9rem;
  font-weight: 500;
}
.alert-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e11d48;
  background: #ffe4e6;
  border-radius: 8px;
  font-size: .95rem;
}
.alert-content { line-height: 1.55; padding-top: 3px; }

/* ===== Service & Helpdesk Card ===== */
.support-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  color: #78350f;
  background: rgba(255, 251, 235, .85);
  border: 1px solid rgba(253, 230, 138, .9);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  font-size: .85rem;
}
.support-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #92400e;
  background: #fef3c7;
  border-radius: 10px;
  font-size: 1rem;
}
.support-title {
  margin: 0 0 2px;
  color: #451a03;
  font-size: .9rem;
  font-weight: 600;
}
.support-text { margin: 0 0 2px; line-height: 1.5; color: rgba(146, 64, 14, .95); }
.support-phone {
  font-weight: 700;
  color: #451a03;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.support-phone:hover { color: var(--pf-primary); }
.support-hours {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: rgba(180, 83, 9, .85);
  font-size: .78rem;
  font-weight: 500;
}

/* ===== Footer ===== */
.pf-footer {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 8px 24px;
  color: var(--pf-text-muted);
  font-size: .78rem;
  background: rgba(255, 255, 255, .5);
  border-top: 1px solid rgba(226, 232, 240, .8);
}
.pf-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
}
.pf-footer p { margin: 0; }

/* ===== Compact mode สำหรับจอเตี้ย (ลดการเลื่อน scrollbar) ===== */
@media (max-height: 720px) {
  .pf-header-inner { min-height: 62px; }
  .pf-brand img { width: 50px; height: 50px; }
  .login-shell { padding: 10px 16px; }
  .login-container { gap: 10px; }
  .login-card { padding: 16px 28px 18px; }
  .login-card-header { margin-bottom: 10px; }
  .login-card-icon { width: 40px; height: 40px; font-size: 1.2rem; margin-bottom: 4px; }
  .login-card-header h1 { font-size: 1.25rem; }
  .form-group-custom { margin-bottom: 8px; }
  .pf-input, .pf-select { min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
  .btn-pf { min-height: 42px; margin-top: 4px; }
  .support-box { padding: 8px 14px; }
  .pf-footer { padding: 6px 24px; }
}

/* ===== Responsive ===== */
@media (max-width: 575.98px) {
  .pf-header-inner { padding: 0 16px; min-height: 68px; }
  .pf-brand img { width: 50px; height: 50px; }
  .pf-brand-title { font-size: .98rem; }
  .pf-brand-sub { font-size: .72rem; }
  .pf-status { display: none; }
  .login-shell { padding: 16px 12px; }
  .login-card { padding: 20px 18px 22px; }
  .login-card-header h1 { font-size: 1.25rem; }
  .pf-footer { text-align: center; }
}

/* ===== หน้าแจ้งผลการเข้าสู่ระบบ (login/check_login.php) ===== */
.result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 14px;
  font-size: 1.5rem;
}
.result-error .result-icon   { color: #be123c; background: #fff1f2; border: 1px solid #fecdd3; }
.result-warning .result-icon { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--pf-field);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  font-size: .85rem;
}
.result-meta-label { color: var(--pf-text-muted); }
.result-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  color: var(--pf-primary);
  background: var(--pf-primary-50);
  border: 1px solid var(--pf-primary-200);
  border-radius: 999px;
  font-weight: 600;
}

.result-checklist {
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
}
.result-checklist-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--pf-text);
  font-size: .88rem;
  font-weight: 600;
}
.result-checklist ul {
  margin: 0;
  padding-left: 20px;
  color: var(--pf-text-body);
  font-size: .85rem;
  line-height: 1.6;
}
.result-checklist li + li { margin-top: 2px; }
.result-checklist b { color: var(--pf-text); font-weight: 600; }

.result-attempts {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 12px;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--pf-radius-md);
  font-size: .85rem;
  line-height: 1.5;
}
.result-attempts i { margin-top: 2px; }

.result-back { text-decoration: none; margin-top: 2px; }
.result-back:hover { color: #fff; }

/* หน้าแจ้งผลบนจอเตี้ย (ลด scrollbar) */
@media (max-height: 720px) {
  .result-icon { width: 40px; height: 40px; font-size: 1.2rem; margin-bottom: 4px; }
  .result-meta { padding: 6px 12px; margin-bottom: 8px; }
  .result-checklist { padding: 8px 12px; margin-bottom: 8px; }
  .result-checklist ul { line-height: 1.5; }
  .result-attempts { padding: 6px 12px; margin-bottom: 8px; }
}
