/* Association Mockup Theme (Modern / Dark Blue) */
:root {
  --bg: #0b1f3a;
  --bg2: #0a1730;
  --surface: #ffffff;
  --muted: #6b7280;
  --text: #0f172a;
  --border: #e5e7eb;
  --brand: #1e3a8a;
  --brand2: #2563eb;
  --accent: #0ea5e9;
  --shadow: 0 10px 30px rgba(2, 6, 23, .15);
  --radius: 14px;
  --radius2: 18px;
  --font-sans: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: #f3f6fb
}

a {
  color: var(--brand2);
  text-decoration: none
}

a:hover {
  text-decoration: none
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px
}

.container-wide {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px
}

.topbar {
  background: linear-gradient(135deg, var(--bg) 0%, var(--brand) 60%, var(--bg2) 100%);
  color: #fff
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18)
}

.brand small {
  display: block;
  font-weight: 600;
  opacity: .85
}

.navlinks {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center
}

.navlinks a {
  color: #fff;
  opacity: .9;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px
}

.navlinks a.active,
.navlinks a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .12);
  text-decoration: none
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none !important
}

.btn-primary {
  background: var(--brand2);
  color: #fff
}

.btn-primary:hover {
  filter: brightness(.95)
}

.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, .25)
}

.btn-outline:hover {
  background: rgba(255, 255, 255, .10)
}

.btn-light {
  background: #fff;
  color: var(--brand);
  border-color: #fff
}

.btn-ghost {
  background: transparent;
  color: var(--brand2);
  border-color: var(--border)
}

.btn-ghost:hover {
  background: #f1f5ff
}

.hero {
  padding: 28px 0 22px;
  color: #fff
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 18px;
  align-items: stretch
}

.hero-card {
  border-radius: var(--radius2);
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .05));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 50px rgba(2, 6, 23, .28);
  min-height: 290px;
  overflow: hidden
}

.hero-card h1 {
  margin: 0 0 10px;
  font-size: 36px;
  line-height: 1.15
}

.hero-card p {
  margin: 0 0 18px;
  opacity: .9;
  max-width: 58ch
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.hero-media {
  border-radius: var(--radius2);
  background:
    radial-gradient(1200px 500px at 0% 0%, rgba(14, 165, 233, .35), rgba(14, 165, 233, 0)),
    radial-gradient(900px 420px at 100% 100%, rgba(37, 99, 235, .35), rgba(37, 99, 235, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 50px rgba(2, 6, 23, .28);
  padding: 18px;
  min-height: 290px
}

.media-box {
  height: 100%;
  border-radius: 16px;
  background: rgba(255, 255, 255, .08);
  border: 1px dashed rgba(255, 255, 255, .25);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18)
}

main {
  padding: 22px 0 50px
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  margin: 16px 0 12px
}

.section-head h2 {
  margin: 0;
  font-size: 18px
}

.section-head .muted {
  color: rgba(15, 23, 42, .65);
  font-size: 13px
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px
}

@media(max-width:980px) {
  .hero-grid {
    grid-template-columns: 1fr
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr)
  }

  .grid-3 {
    grid-template-columns: 1fr
  }

  .grid-2 {
    grid-template-columns: 1fr
  }
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow)
}

.card.pad {
  padding: 16px
}

.card-title {
  font-weight: 800;
  margin: 0 0 6px
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0
}

.thumb {
  height: 130px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e5efff, #f4f7ff);
  border: 1px dashed #cbd5e1;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff
}

.item .meta {
  flex: 1
}

.item h3 {
  margin: 0 0 6px;
  font-size: 15px
}

.item .small {
  font-size: 13px;
  color: var(--muted)
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 14px;
  font-size: 14px
}

.kv div:nth-child(odd) {
  color: var(--muted)
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0
}

.footer {
  background: linear-gradient(135deg, var(--bg2), var(--bg));
  color: #fff;
  padding: 20px 0
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 16px
}

.footer a {
  color: #fff;
  opacity: .9
}

.footer .muted {
  opacity: .8;
  font-size: 13px
}

@media(max-width:980px) {
  .footer-grid {
    grid-template-columns: 1fr
  }
}

/* Admin */
.admin-shell {
  min-height: 100vh;
  background: #f3f6fb
}

.admin-top {
  background: linear-gradient(135deg, var(--bg2), var(--brand));
  color: #fff;
  padding: 14px 0
}

.admin-top .nav {
  padding: 0
}

.admin-main {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 70px)
}

.sidebar {
  background: linear-gradient(180deg, #0b1f3a, #071428);
  color: #fff;
  padding: 16px 12px
}

.side-title {
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .12em;
  opacity: .7;
  margin: 10px 10px
}

.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 6px 6px;
  border-radius: 12px;
  color: #fff;
  opacity: .88;
  font-weight: 700;
  font-size: 14px
}

.side a.active,
.side a:hover {
  background: rgba(255, 255, 255, .10);
  opacity: 1;
  text-decoration: none
}

.ico {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 12px;
  font-weight: 900
}

.admin-content {
  padding: 18px 18px 34px
}

.breadcrumb {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 12px
}

.h1 {
  font-size: 22px;
  margin: 0 0 10px;
  font-weight: 900
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 12px 0 16px
}

@media(max-width:1100px) {
  .admin-main {
    grid-template-columns: 1fr
  }

  /* ห้ามซ่อน sidebar เพราะมือถือใช้ off-canvas */
  .stats {
    grid-template-columns: repeat(2, 1fr)
  }
}

.stat {
  border-radius: 16px;
  color: #fff;
  padding: 14px;
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--brand), var(--bg))
}

.stat.orange {
  background: linear-gradient(135deg, #b45309, #f59e0b)
}

.stat.red {
  background: linear-gradient(135deg, #991b1b, #ef4444)
}

.stat.green {
  background: linear-gradient(135deg, #166534, #16a34a)
}

.stat .k {
  font-weight: 800;
  opacity: .92;
  font-size: 13px
}

.stat .v {
  font-weight: 900;
  font-size: 28px;
  margin-top: 8px
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 12px
}

.input {
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
  font-weight: 600;
  background: #fff
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px
}

.table th {
  background: #f8fafc;
  text-align: left;
  color: #334155;
  font-weight: 900
}

.table tr:last-child td {
  border-bottom: 0
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(0, 0, 0, .06)
}

.pill.active {
  background: #dcfce7;
  color: #166534
}

.pill.expired {
  background: #fee2e2;
  color: #991b1b
}

.pill.pending {
  background: #ffedd5;
  color: #9a3412
}

.btn-sm {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px
}

.btn-dark {
  background: #0b1f3a;
  color: #fff
}

.btn-dark:hover {
  filter: brightness(.95)
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px
}

@media(max-width:980px) {
  .form-grid {
    grid-template-columns: 1fr
  }
}

label {
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  display: block;
  margin-bottom: 6px
}

textarea.input {
  min-height: 120px;
  resize: vertical
}

.note {
  font-size: 13px;
  color: var(--muted)
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--bg2), var(--brand));
  padding: 30px 18px
}

.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 20px 70px rgba(2, 6, 23, .35);
  padding: 18px
}

.small-muted {
  font-size: 12px;
  color: var(--muted)
}


/* --- Mockup images --- */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 16px
}

.thumb.has-img {
  padding: 0;
  overflow: hidden
}


/* ===== Sticky Footer ===== */
html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
}


/* ===== Admin UI Enhancements ===== */
.sidebar {
  background: linear-gradient(180deg, rgba(8, 24, 55, 1) 0%, rgba(10, 30, 70, 1) 100%);
  color: #fff;
}

.side-title {
  margin-top: 14px;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .7;
  padding: 0 14px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  margin: 6px 10px;
  color: rgba(255, 255, 255, .9);
  text-decoration: none;
}

.side-link:hover {
  background: rgba(255, 255, 255, .08);
}

.side-link.active {
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

.topbar {
  background: #0b1f46;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.topbar .brand {
  color: #fff;
}

.content {
  padding-bottom: 20px;
}

/* Auth */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .96);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .18);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0b1f46;
}

.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: #0b1f46;
}

.auth-sub {
  font-size: 12px;
  opacity: .7;
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-label {
  font-size: 12px;
  opacity: .75;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
}

.kpi-sub {
  font-size: 12px;
  opacity: .7;
  margin-top: 2px;
}

.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dash-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-danger {
  background: #b42318;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
}

.btn-danger:hover {
  filter: brightness(1.05);
}

.alert {
  padding: 10px 12px;
  border-radius: 12px;
  margin: 10px 0;
}

.alert-danger {
  background: rgba(180, 35, 24, .12);
  border: 1px solid rgba(180, 35, 24, .25);
  color: #7a1b12;
}

.alert-success {
  background: rgba(22, 163, 74, .12);
  border: 1px solid rgba(22, 163, 74, .25);
  color: #14532d;
}


/* ===== Responsive Enhancements ===== */
.table-responsive {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch
}

.table-responsive>table {
  min-width: 720px
}

/* Public mobile menu */
.navtoggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-weight: 900
}

.navtoggle:active {
  transform: translateY(1px)
}

.navlinks.is-collapsed {
  display: flex
}

@media(max-width: 900px) {
  .brand small {
    display: none
  }

  .navtoggle {
    display: flex
  }

  .navlinks {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 70px;
    display: none;
    flex-direction: column;
    gap: 6px;
    background: rgba(11, 31, 58, .98);
    border: 1px solid rgba(255, 255, 255, .12);
    padding: 12px;
    border-radius: 16px;
    z-index: 999
  }

  .navlinks.open {
    display: flex
  }

  .navlinks a {
    width: 100%
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 998
  }

  .nav-backdrop.open {
    display: block
  }
}

/* Admin sidebar off-canvas */
.admin-top .navlinks {
  gap: 12px
}

.admin-top .navtoggle {
  display: none
}

@media(max-width: 900px) {
  .admin-top .navlinks {
    display: none
  }

  .admin-top .navtoggle {
    display: flex
  }

  .admin-main {
    display: block
  }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 999;
    background: #0b1f3a;
    overflow: auto;
    transition: left .2s ease;
    padding-bottom: 24px
  }

  .sidebar.open {
    left: 0
  }

  .admin-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 998
  }

  .admin-backdrop.open {
    display: block
  }
}