/* ============================================================================
   auth.css — หน้าเข้าสู่ระบบ สมัคร ลืมรหัส หน้าแรกโฉมใหม่ โปรไฟล์ และจัดการผู้ใช้
   ============================================================================ */

/* ---------- 1. หน้าเข้าสู่ระบบ / สมัคร / ลืมรหัสผ่าน ---------- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safetop)) 14px max(26px, env(safe-area-inset-bottom, 26px));
  background:
    radial-gradient(circle at 20% 10%, rgba(225, 29, 47, .12), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(19, 49, 66, .1), transparent 48%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 20px 50px rgba(20, 34, 58, .12);
  overflow: hidden;
  animation: uiPopIn .36s cubic-bezier(.2, .9, .3, 1.2) both;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  padding: 24px 22px 22px;
  background: linear-gradient(128deg, #ef2335 0%, #d41625 58%, #9e0e1a 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 15px;
}
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .03) 70%);
  pointer-events: none;
}
.auth-brand::before { width: 140px; height: 140px; top: -55px; right: -25px; }
.auth-brand::after  { width: 80px;  height: 80px;  bottom: -40px; left: 42%; }

.auth-brand-dot {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: #fff;
  flex: 0 0 auto;
}
.auth-brand-logo {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 17px;
  background: #fff;
  flex: 0 0 auto;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25), 0 0 0 2.5px rgba(255, 255, 255, .35);
}
.auth-brand-text {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.auth-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, .18);
  font-size: 10px;
  letter-spacing: 1.2px;
  font-weight: 800;
}
.auth-brand-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fde047;
}
.auth-brand-text h1 {
  margin: 4px 0 0;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.2px;
}

.auth-body {
  padding: 24px 20px 26px;
}
@media (min-width: 480px) {
  .auth-body { padding: 26px 28px 28px; }
}

.auth-title {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 800;
}
.auth-sub {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.auth-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.auth-link {
  color: var(--brand);
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; color: var(--brand-dark); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .04);
  transition: background .16s, border-color .16s, transform .14s;
}
.google-btn:hover { background: var(--card-2); border-color: #9aa6b6; transform: translateY(-1px); }
.google-btn:active { transform: scale(.98); }
.google-btn svg { width: 20px; height: 20px; flex: 0 0 auto; }

.auth-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 14px;
  color: var(--ink-2);
}
.auth-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- 2. หน้าแรกโฉมใหม่ (Home Dashboard + User Profile Hero) ---------- */
.home-wrap {
  max-width: 1080px;
  margin: 4px auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--warn-soft);
  border: 1.5px solid var(--warn-line);
  color: #78350f;
}
.draft-banner b { display: block; font-size: 14.5px; }
.draft-banner span { font-size: 13px; }

.home-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(225, 29, 47, .08), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(56, 189, 248, .09), transparent 45%),
    var(--card);
}
@media (min-width: 680px) {
  .home-hero {
    flex-direction: row;
    text-align: left;
    padding: 28px 30px;
    gap: 22px;
  }
}
.home-hero-av {
  position: relative;
  text-decoration: none;
  flex: 0 0 auto;
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.4);
}
.home-hero-av:hover { transform: scale(1.05) rotate(-3deg); }
.home-hero-edit {
  position: absolute;
  right: -2px;
  bottom: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: 2.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(225, 29, 47, .3);
}
.home-hero-edit svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.3; }

.home-hero-body { flex: 1; min-width: 0; }
.home-hero-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
@media (min-width: 680px) {
  .home-hero-badges { justify-content: flex-start; }
}
.home-hero-body h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}
.home-hero-body p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-2);
}
.home-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* แถบตัวเลขภาพรวมข้อมูลล่าสุด */
.home-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 760px) {
  .home-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}
.home-stat-card {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-stat-dot {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--stat-bg, #ffe4e6);
  color: var(--stat-fg, var(--brand));
}
.home-stat-dot svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-stat-info { min-width: 0; }
.home-stat-info b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.home-stat-info span {
  font-size: 12px;
  color: var(--ink-2);
}

/* เมนูลัดเข้าใช้งานเร็ว */
.home-sec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 -6px;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
}
.quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) {
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}
.quick-card {
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-decoration: none;
  transition: transform .18s cubic-bezier(.2, .9, .3, 1.3), box-shadow .18s, border-color .18s;
}
.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-2);
  border-color: #fda4af;
}
.quick-ico {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--q-bg, #ffe4e6);
  color: var(--q-fg, var(--brand));
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.4);
}
.quick-card:hover .quick-ico { transform: scale(1.08) rotate(-4deg); }
.quick-ico svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.quick-body { min-width: 0; flex: 1; }
.quick-body h3 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.quick-body p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}

/* ---------- 3. หน้าโปรไฟล์ผู้ใช้งาน (profile.php สไตล์ ExTrack) ---------- */
.profile-wrap {
  max-width: 920px;
  margin: 4px auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 820px) {
  .profile-wrap { grid-template-columns: 310px minmax(0, 1fr); align-items: start; }
}
.profile-side {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.profile-side h2 { margin: 4px 0 0; font-size: 19px; font-weight: 800; }
.profile-side-role { margin: 0; font-size: 13px; color: var(--ink-2); }
.profile-meta-list {
  width: 100%;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  font-size: 13px;
}
.profile-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.profile-meta-row span { color: var(--muted); }
.profile-meta-row b { color: var(--ink); text-align: right; word-break: break-all; }

.profile-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.profile-box { padding: 22px 20px; }
@media (min-width: 640px) { .profile-box { padding: 24px 26px; } }
.profile-box h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-box-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-2);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 540px) {
  .avatar-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.avatar-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .15s;
}
.avatar-opt:hover { border-color: #fda4af; transform: translateY(-2px); }
.avatar-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.avatar-opt:has(input:checked),
.avatar-opt.is-picked {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 6px 16px rgba(225, 29, 47, .14);
}
.avatar-opt span.av-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.25;
}

.avatar-upload-box {
  padding: 14px;
  border-radius: 14px;
  border: 1.5px dashed var(--line-2);
  background: var(--card-2);
  margin-bottom: 16px;
}

/* ---------- 4. หน้า Admin & จัดการผู้ใช้งาน ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (min-width: 1024px) {
  .admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.admin-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  text-decoration: none;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.admin-tile:hover { border-color: #fda4af; box-shadow: var(--sh-2); transform: translateY(-2px); }
.admin-tile h3 { margin: 0; font-size: 16.5px; font-weight: 800; }
.admin-tile p { margin: 0; font-size: 13.5px; color: var(--ink-2); flex: 1; }
.admin-tile-foot { font-size: 13px; font-weight: 700; color: var(--brand); }

.user-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.user-toolbar input { flex: 1 1 220px; }

.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-row {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 780px) {
  .user-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
.user-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.user-meta-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.user-meta-name { font-size: 15.5px; font-weight: 700; }
.user-meta-email { font-size: 13.5px; color: var(--ink-2); word-break: break-all; }
.user-meta-dates { font-size: 12px; color: var(--muted); }
.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.user-actions form { margin: 0; }
