/* Phase 7A — Auth pages (Login/Dashboard + Register split design) */
:root {
  --auth-bg: #f4f6fa;
  --auth-card: #fff;
  --auth-text: #152033;
  --auth-muted: #6b7a90;
  --auth-line: #e3e8f0;
  --auth-accent: #2f5bff;
  --auth-accent-2: #1e40af;
  --auth-soft: #eaf0ff;
  --auth-danger: #c62828;
  --auth-font: "IBM Plex Sans Thai", "Sarabun", sans-serif;
  --auth-display: "Sora", "IBM Plex Sans Thai", sans-serif;
  --auth-shadow: 0 18px 48px rgba(21, 32, 51, 0.1);
}

* { box-sizing: border-box; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  color: var(--auth-text);
  font-family: var(--auth-font);
  background:
    radial-gradient(900px 380px at 80% -10%, rgba(47, 91, 255, 0.1), transparent 55%),
    linear-gradient(180deg, #f8f9fc, var(--auth-bg));
}

/* —— Simple centered card (dashboard) —— */
body.auth-page:not(.auth-page--split):not(.auth-page--login) {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: var(--auth-shadow);
}

.auth-card--wide { width: min(520px, 100%); }

.auth-brand {
  margin: 0 0 8px;
  font-family: var(--auth-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--auth-accent);
}

.auth-card h1,
.auth-panel h2 {
  margin: 0;
  font-family: var(--auth-display);
  font-size: 1.45rem;
}

.auth-sub { margin: 6px 0 18px; color: var(--auth-muted); font-size: 0.92rem; }

.auth-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: var(--auth-danger);
  font-size: 0.9rem;
}

.auth-form { display: grid; gap: 14px; }
.auth-form > label:not(.auth-field):not(.auth-check) {
  display: grid;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
}
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
  background: #fff;
  color: inherit;
}
.auth-form input:focus {
  outline: 2px solid rgba(47, 91, 255, 0.25);
  border-color: var(--auth-accent);
}

.auth-check {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500 !important;
  color: var(--auth-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.auth-check input { margin-top: 3px; flex-shrink: 0; }
.auth-check a { color: var(--auth-accent); font-weight: 600; text-decoration: none; }

.auth-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b6bff, var(--auth-accent));
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 91, 255, 0.28);
}
.auth-btn:hover { filter: brightness(1.03); }
.auth-btn--block { width: 100%; }
.auth-btn--ghost {
  background: #fff;
  color: var(--auth-text);
  border: 1px solid var(--auth-line);
  box-shadow: none;
}

.auth-foot { margin: 18px 0 0; font-size: 0.9rem; color: var(--auth-muted); text-align: center; }
.auth-foot a { color: var(--auth-accent); font-weight: 700; text-decoration: none; }
.muted { color: var(--auth-muted); }

.auth-meta {
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}
.auth-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f8fb;
  border: 1px solid var(--auth-line);
  font-size: 0.9rem;
}
.auth-meta dt { color: var(--auth-muted); }
.auth-meta dd { margin: 0; font-weight: 600; }
.auth-nav { display: flex; flex-wrap: wrap; gap: 10px; }

/* —— Register split shell —— */
body.auth-page--split {
  display: block;
  padding: 28px 20px 40px;
}

.auth-shell {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 0;
  background: #fff;
  border: 1px solid var(--auth-line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--auth-shadow);
  min-height: min(860px, calc(100vh - 56px));
}

.auth-promo {
  position: relative;
  padding: 36px 36px 28px;
  background:
    radial-gradient(600px 280px at 20% 0%, rgba(47, 91, 255, 0.12), transparent 60%),
    linear-gradient(165deg, #f7f9ff 0%, #eef2ff 45%, #f8fafc 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.auth-promo__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.auth-promo__brand strong {
  display: block;
  font-family: var(--auth-display);
  font-size: 1.15rem;
}
.auth-promo__brand span {
  display: block;
  font-size: 0.78rem;
  color: var(--auth-muted);
}

.auth-promo__title {
  margin: 8px 0 0;
  font-family: var(--auth-display);
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.35;
  max-width: 16ch;
}

.auth-promo__lead {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 36ch;
}

.auth-features {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.auth-features li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}
.auth-features__ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--auth-accent);
  border: 1px solid var(--auth-soft);
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(47, 91, 255, 0.08);
}
.auth-features strong { display: block; font-size: 0.95rem; }
.auth-features p {
  margin: 2px 0 0;
  color: var(--auth-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.auth-collage {
  margin-top: auto;
  position: relative;
  height: 180px;
  pointer-events: none;
}
.auth-collage__card {
  position: absolute;
  margin: 0;
  width: 118px;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  background: #dbe3f5;
  border: 3px solid #fff;
  box-shadow: 0 12px 28px rgba(21, 32, 51, 0.18);
}
.auth-collage__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.auth-collage__card--0 { left: 8%; bottom: 8px; transform: rotate(-10deg); z-index: 1; }
.auth-collage__card--1 { left: 28%; bottom: 18px; transform: rotate(4deg); z-index: 3; }
.auth-collage__card--2 { left: 48%; bottom: 6px; transform: rotate(-3deg); z-index: 2; }
.auth-collage__card--3 { left: 66%; bottom: 20px; transform: rotate(8deg); z-index: 4; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  background: #fff;
}
.auth-panel__inner {
  width: min(400px, 100%);
}
.auth-panel__sub {
  margin: 6px 0 20px;
  color: var(--auth-muted);
  font-size: 0.92rem;
}

.auth-field { display: grid; gap: 6px; }
.auth-field__label {
  font-size: 0.86rem;
  font-weight: 600;
}
.auth-field__label em {
  font-style: normal;
  font-weight: 500;
  color: var(--auth-muted);
}
.auth-field__control {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-field__ico {
  position: absolute;
  left: 12px;
  color: #90a0b8;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.auth-field__control input {
  padding-left: 42px !important;
  padding-right: 42px !important;
  min-height: 46px;
}
.auth-eye {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #90a0b8;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.auth-eye:hover { color: var(--auth-text); background: #f3f5f9; }

.auth-strength {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}
.auth-strength[hidden] { display: none; }
.auth-strength__bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.auth-strength__bars i {
  height: 5px;
  border-radius: 99px;
  background: #e5e9f2;
}
.auth-strength[data-level="1"] .auth-strength__bars i:nth-child(1) { background: #ef5350; }
.auth-strength[data-level="2"] .auth-strength__bars i:nth-child(-n+2) { background: #ffb300; }
.auth-strength[data-level="3"] .auth-strength__bars i:nth-child(-n+3) { background: #ffb300; }
.auth-strength[data-level="4"] .auth-strength__bars i { background: #43a047; }
.auth-strength__label {
  font-size: 0.78rem;
  color: var(--auth-muted);
}
.auth-strength__label em { font-style: normal; font-weight: 700; color: var(--auth-text); }

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
  color: var(--auth-muted);
  font-size: 0.82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--auth-line);
}

.auth-social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--auth-line);
  background: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--auth-text);
  cursor: not-allowed;
  opacity: 0.72;
  text-decoration: none;
  box-sizing: border-box;
}
a.auth-social__btn--live,
.auth-social__btn--live {
  cursor: pointer;
  opacity: 1;
}

/* —— Login page layout —— */
body.auth-page--login {
  display: flex;
  flex-direction: column;
  padding: 0;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(47, 91, 255, 0.12), transparent 55%),
    radial-gradient(700px 320px at 90% 10%, rgba(47, 91, 255, 0.06), transparent 50%),
    linear-gradient(180deg, #f7f9ff, #f3f5fa 40%, #eef2f8);
}

.auth-top {
  padding: 18px 28px 8px;
}
.auth-top__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.auth-top__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.auth-top__brand strong {
  display: block;
  font-family: var(--auth-display);
  font-size: 1.1rem;
}
.auth-top__brand em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--auth-muted);
}
.auth-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--auth-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.85;
}

.auth-login {
  max-width: 1120px;
  width: 100%;
  margin: 8px auto 0;
  padding: 8px 28px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 36px;
  align-items: start;
}

.auth-login__promo { padding-top: 12px; }
.auth-badge {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--auth-soft);
  color: var(--auth-accent-2);
  font-size: 0.82rem;
  font-weight: 600;
}
.auth-login__title {
  margin: 0;
  font-family: var(--auth-display);
  font-size: clamp(1.7rem, 2.8vw, 2.35rem);
  line-height: 1.3;
  max-width: 14ch;
}
.auth-login__lead {
  margin: 12px 0 22px;
  color: var(--auth-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 40ch;
}

.auth-features--login { margin-top: 0; }
.auth-features__ico--round {
  border-radius: 999px;
  background: var(--auth-soft);
  border-color: transparent;
  box-shadow: none;
}

.auth-collage--login {
  height: 200px;
  margin-top: 28px;
}
.auth-collage__card--l0 { left: 2%; bottom: 10px; transform: rotate(-12deg); z-index: 1; width: 100px; height: 128px; }
.auth-collage__card--l1 { left: 18%; bottom: 28px; transform: rotate(5deg); z-index: 3; width: 110px; height: 140px; }
.auth-collage__card--l2 { left: 36%; bottom: 8px; transform: rotate(-4deg); z-index: 2; width: 104px; height: 134px; }
.auth-collage__card--l3 { left: 54%; bottom: 24px; transform: rotate(8deg); z-index: 4; width: 112px; height: 144px; }
.auth-collage__card--l4 { left: 72%; bottom: 12px; transform: rotate(-6deg); z-index: 3; width: 100px; height: 130px; }

.auth-login__card {
  background: #fff;
  border: 1px solid var(--auth-line);
  border-radius: 20px;
  padding: 28px 26px 22px;
  box-shadow: var(--auth-shadow);
}
.auth-login__card h2 {
  margin: 0;
  font-family: var(--auth-display);
  font-size: 1.55rem;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.auth-check--inline {
  margin: 0 !important;
  align-items: center !important;
}
.auth-check--inline input { margin-top: 0; }
.auth-link {
  color: var(--auth-accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

.auth-social--stack {
  grid-template-columns: 1fr;
}
.auth-social--stack .auth-social__btn {
  font-size: 0.88rem;
}
.auth-social--stack .auth-social__btn:disabled {
  opacity: 0.78;
}

.auth-trust {
  max-width: 900px;
  width: 100%;
  margin: 8px auto 20px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.auth-trust__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(227, 232, 240, 0.9);
}
.auth-trust__ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--auth-soft);
  color: var(--auth-accent);
  flex-shrink: 0;
  font-size: 0.95rem;
}
.auth-trust__item strong {
  display: block;
  font-size: 0.9rem;
}
.auth-trust__item p {
  margin: 2px 0 0;
  color: var(--auth-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-bottom {
  max-width: 1120px;
  width: 100%;
  margin: auto auto 0;
  padding: 18px 28px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--auth-muted);
  font-size: 0.82rem;
}
.auth-bottom nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-bottom a {
  color: var(--auth-muted);
  text-decoration: none;
}
.auth-bottom a:hover { color: var(--auth-accent); }

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .auth-promo { padding-bottom: 20px; }
  .auth-collage { height: 140px; }
  .auth-promo__title { max-width: none; }

  .auth-login {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .auth-login__title { max-width: none; }
  .auth-collage--login { height: 160px; }
  .auth-trust { grid-template-columns: 1fr; max-width: 520px; }
}

@media (max-width: 560px) {
  body.auth-page--split { padding: 12px; }
  .auth-shell { border-radius: 16px; }
  .auth-promo, .auth-panel { padding: 22px 18px; }
  .auth-social { grid-template-columns: 1fr; }
  .auth-collage__card { width: 92px; height: 118px; }

  .auth-top, .auth-login, .auth-trust, .auth-bottom { padding-left: 16px; padding-right: 16px; }
  .auth-login__card { padding: 22px 18px; }
  .auth-collage__card--l0,
  .auth-collage__card--l1,
  .auth-collage__card--l2,
  .auth-collage__card--l3,
  .auth-collage__card--l4 { width: 78px; height: 100px; }
}

/* —— Admin Console login (แยกจาก User) —— */
body.auth-page--admin {
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(700px 360px at 20% 0%, rgba(14, 165, 233, 0.12), transparent 55%),
    linear-gradient(165deg, #0f172a 0%, #1e293b 48%, #0b1220 100%);
  color: #e2e8f0;
}
.admin-auth {
  width: min(420px, 100%);
}
.admin-auth__card {
  background: #fff;
  color: #152033;
  border-radius: 18px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.admin-auth__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-auth__mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #0f172a;
  color: #38bdf8;
  font-family: var(--auth-display);
  font-weight: 700;
  font-size: 0.85rem;
}
.admin-auth__brand strong {
  display: block;
  font-family: var(--auth-display);
  font-size: 1rem;
}
.admin-auth__brand em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: #64748b;
}
.admin-auth h1 {
  margin: 0 0 6px;
  font-family: var(--auth-display);
  font-size: 1.35rem;
}
.admin-auth__sub {
  margin: 0 0 18px;
  color: #64748b;
  font-size: 0.88rem;
}
.admin-auth__submit {
  background: #0f172a !important;
  border-color: #0f172a !important;
}
.admin-auth__submit:hover {
  background: #1e293b !important;
}
.admin-auth__foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.86rem;
}
.admin-auth__foot a {
  color: #0369a1;
  text-decoration: none;
  font-weight: 600;
}
.admin-auth__foot a:hover { text-decoration: underline; }
