/* ============================================================
   THEME 2030 — สำนักงานสภามหาวิทยาลัยราชภัฏนครราชสีมา
   Futuristic redesign: aurora header, glassmorphism, dark mode
   Loaded last — overrides bootstrap.css + custom.css
   ============================================================ */

:root {
  --bg: #eef4ec;
  --bg-soft: #f5faf3;
  --card: #ffffff;
  --card-border: rgba(20, 50, 30, 0.08);
  --ink: #16271c;
  --ink-soft: #3f5645;
  --muted: #6c8073;
  --brand-1: #157a3c;   /* institutional green */
  --brand-2: #bb9326;   /* metallic gold (matches banner) */
  --brand-3: #0b5b2f;
  --accent-grad: linear-gradient(120deg, #0b5b2f 0%, #2f9e4d 42%, #d8b04c 100%);
  --header-bg: #042a1d;  /* deep green — sampled from banner */
  --nav-glass: rgba(4, 42, 29, 0.80);
  --nav-border: rgba(255, 255, 255, 0.10);
  --shadow-sm: 0 2px 10px rgba(20, 50, 30, 0.07);
  --shadow-md: 0 10px 30px rgba(20, 50, 30, 0.12);
  --shadow-lg: 0 24px 60px rgba(20, 50, 30, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --font-head: 'Prompt', 'Noto Sans Thai', 'Segoe UI', sans-serif;
  --font-body: 'Sarabun', 'Noto Sans Thai', 'Segoe UI', sans-serif;
}

html[data-theme="dark"] {
  --bg: #07140d;
  --bg-soft: #0c1f15;
  --card: #0f2418;
  --card-border: rgba(160, 200, 170, 0.12);
  --ink: #e7f1e8;
  --ink-soft: #bcd2c1;
  --muted: #8aa291;
  --brand-1: #36b766;   /* brighter green for dark bg */
  --brand-2: #e7c052;   /* brighter gold (matches banner highlight) */
  --header-bg: #02180f;
  --nav-glass: rgba(2, 24, 15, 0.82);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* ---------- base ---------- */

html { scroll-behavior: smooth; }

body {
  background: var(--bg) !important;
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(21, 122, 58, 0.10), transparent 60%),
    radial-gradient(900px 480px at -10% 30%, rgba(187, 147, 38, 0.08), transparent 60%) !important;
  background-attachment: fixed !important;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .navbar, .brand-text, .bg_news1 {
  font-family: var(--font-head);
}

::selection { background: rgba(21, 122, 58, 0.25); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-1), var(--brand-2));
  border-radius: 99px;
  border: 2px solid var(--bg);
}

img { max-width: 100%; height: auto; }

a { color: var(--brand-1); transition: color .2s ease; }
a:hover { color: var(--brand-2); text-decoration: none; }

.pad_row { padding-left: 4rem; padding-right: 4rem; }
@media (max-width: 991px) { .pad_row { padding-left: 1rem; padding-right: 1rem; } }

/* ---------- aurora header ---------- */

.site-header {
  position: relative;
  overflow: hidden;
  background: var(--header-bg);
  isolation: isolate;
}

/* full-width banner image header */
.header-banner-link { display: block; line-height: 0; }
.header-banner-img {
  display: block;
  width: 100%;
  height: auto;
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  pointer-events: none;
  z-index: -1;
}

.aurora { position: absolute; inset: -40% -10%; z-index: -2; filter: blur(70px); opacity: .8; }
.aurora span { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.aurora span:nth-child(1) {
  width: 46vw; height: 46vw; left: -8vw; top: -10vw;
  background: radial-gradient(circle, #1f9a4a 0%, transparent 65%);
  animation: float-a 16s ease-in-out infinite alternate;
}
.aurora span:nth-child(2) {
  width: 38vw; height: 38vw; right: -6vw; top: -4vw;
  background: radial-gradient(circle, #d8a317 0%, transparent 65%);
  animation: float-b 20s ease-in-out infinite alternate;
}
.aurora span:nth-child(3) {
  width: 30vw; height: 30vw; left: 38vw; bottom: -18vw;
  background: radial-gradient(circle, #0c7a38 0%, transparent 65%);
  animation: float-c 24s ease-in-out infinite alternate;
}
@keyframes float-a { to { transform: translate(8vw, 6vw) scale(1.15); } }
@keyframes float-b { to { transform: translate(-6vw, 8vw) scale(0.9); } }
@keyframes float-c { to { transform: translate(-10vw, -6vw) scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none !important; }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2.6rem 4rem 2.4rem;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 991px) { .header-inner { padding: 1.8rem 1rem; gap: 1rem; } }

.brand { display: flex; align-items: center; gap: 1.4rem; text-decoration: none; }
.brand:hover { text-decoration: none; }

.brand-logo {
  flex: 0 0 auto;
  width: 96px; height: 96px;
  display: grid; place-items: center;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: transform .35s cubic-bezier(.2,.9,.3,1.4);
}
.brand:hover .brand-logo { transform: translateY(-4px) rotate(-2deg); }
.brand-logo img { max-width: 72px; max-height: 72px; height: auto; }
@media (max-width: 575px) { .brand-logo { width: 72px; height: 72px; } .brand-logo img { max-width: 52px; } }

.brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.brand-title {
  font-size: clamp(1.5rem, 3.6vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(95deg, #ffffff 20%, #d6f0c7 52%, #ffe08a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #fff;
}
.brand-sub {
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 500;
  color: #ffd86a;
  letter-spacing: 1.5px;
  margin-top: .2rem;
}
.brand-en {
  font-size: clamp(.6rem, 1.1vw, .78rem);
  font-weight: 400;
  color: rgba(226, 232, 240, 0.55);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: .55rem;
}

/* legacy name classes (other pages) */
.nameTh, .nameEng, .nameDetail { color: #fff; }

/* ---------- glass sticky navbar ---------- */

.site-nav.navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--nav-glass) !important;
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid var(--nav-border);
  padding: .35rem 4rem;
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.25);
  transition: padding .25s ease;
}
@media (max-width: 991px) { .site-nav.navbar { padding: .35rem 1rem; } }
.site-nav.scrolled { box-shadow: 0 10px 34px rgba(2, 6, 23, 0.45); }

.site-nav .nav-link {
  color: rgba(226, 232, 240, 0.88) !important;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: .98rem;
  padding: .85rem 1.05rem !important;
  position: relative;
  border-radius: 10px;
  transition: color .2s ease, background .2s ease;
}
.site-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 1rem; right: 1rem; bottom: .45rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.site-nav .nav-link:hover { color: #fff !important; background: rgba(255,255,255,0.06); }
.site-nav .nav-link:hover::after,
.site-nav .nav-item.active .nav-link::after { transform: scaleX(1); }

.site-nav .navbar-toggler {
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
}

/* dropdowns — floating glass panels */
.dropdown-menu {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  margin-top: .5rem;
  z-index: 1050;  /* above the sticky navbar (1030) when the menu flips upward */
  animation: dd-in .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes dd-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-item {
  border-radius: 9px;
  padding: .5rem .9rem;
  color: var(--ink-soft);
  font-size: .95rem;
  transition: background .18s ease, color .18s ease, padding-left .18s ease;
}
.dropdown-item:hover {
  background: linear-gradient(120deg, rgba(21,122,58,.12), rgba(200,148,26,.12));
  color: var(--brand-1);
  padding-left: 1.15rem;
}

/* theme toggle */
.theme-toggle {
  margin-left: auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  color: #fde68a;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform .3s ease, background .2s ease;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.08); background: rgba(255,255,255,0.14); }

/* ---------- content area ---------- */

.bg_fff, .bg_content {
  background: var(--card) !important;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  color: var(--ink);
}
.bg_content { padding-left: 1.5rem; padding-right: 1.5rem; }

#div_content { margin-top: 1.4rem; margin-bottom: 1.4rem; }

/* main two-column gap */
body > .row.pad_row:first-of-type,
.row.pad_row { margin-top: 0; }

/* ---------- sidebar ---------- */

.bg_left {
  background: transparent !important;
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}

.bg_conf, .bg_conf_r {
  background: var(--card) !important;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm) !important;
  margin-bottom: .55rem !important;
  box-shadow: var(--shadow-sm);
  overflow: visible;
  position: relative;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.bg_conf::before, .bg_conf_r::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-grad);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  opacity: 0;
  transition: opacity .25s ease;
}
.bg_conf:hover, .bg_conf_r:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(21, 122, 58, 0.35);
}
.bg_conf:hover::before, .bg_conf_r:hover::before { opacity: 1; }
.bg_conf :hover { background: transparent; }  /* kill legacy green hover */
.bg_conf .row.bg_conf, .bg_conf_r .row.bg_conf_r {
  background: transparent !important;
  border: none; box-shadow: none; margin-bottom: 0 !important;
}
.bg_conf .nav-link, .bg_conf_r .nav-link {
  color: var(--ink-soft);
  font-family: var(--font-head);
  font-size: .95rem;
  padding: .7rem .9rem;
  transition: color .2s ease;
}
.bg_conf:hover .nav-link, .bg_conf_r:hover .nav-link { color: var(--brand-1); }
.bg_conf .fa, .bg_conf_r .fa {
  background: linear-gradient(120deg, rgba(21,122,58,.14), rgba(200,148,26,.14));
  color: var(--brand-1);
  width: 28px; height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 8px;
  margin-right: .35rem;
}

/* ---------- carousel ---------- */

.carousel {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--card-border);
}
.carousel-item img {
  width: 100%;
  height: auto;
  transform: scale(1.001);
  transition: transform 6s ease;
}
.carousel-item.active img { transform: scale(1.045); }
.carousel-control-prev, .carousel-control-next {
  width: 9%;
  opacity: 0;
  transition: opacity .3s ease;
}
.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next { opacity: 1; }
.carousel-control-prev-icon, .carousel-control-next-icon {
  background-color: rgba(10, 15, 36, 0.55);
  border-radius: 12px;
  padding: 1.4rem;
  backdrop-filter: blur(6px);
}

/* ---------- news sections ---------- */

.news-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.3rem 1.4rem 1rem !important;
  margin-bottom: 1.3rem;
  transition: box-shadow .3s ease, transform .3s ease;
}
.news-section:hover { box-shadow: var(--shadow-md); }

.bg_news1 {
  position: relative;
  background: transparent !important;
  color: var(--ink) !important;
  font-size: 1.22rem;
  font-weight: 600;
  padding: 0 0 .8rem 0 !important;
  margin-bottom: 1rem !important;
  border-bottom: 1px solid var(--card-border);
}
.bg_news1::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 88px; height: 3px;
  border-radius: 3px;
  background: var(--accent-grad);
}
.bg_news1 .fa {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  margin-right: .55rem;
  border-radius: 12px;
  background: var(--accent-grad);
  color: #fff !important;
  font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(21, 122, 58, 0.35);
}

.news-item {
  border-radius: 10px;
  padding: .35rem .5rem;
  margin-left: -0.5rem !important;
  margin-right: -0.5rem !important;
  transition: background .2s ease, transform .2s ease;
}
.news-item:hover {
  background: linear-gradient(120deg, rgba(21,122,58,.07), rgba(200,148,26,.07));
  transform: translateX(4px);
}
.news-item a { color: var(--ink-soft); }
.news-item:hover a { color: var(--brand-1); }
.news-item .fa-volume-down { color: var(--brand-2); }
.news-item .text-center {
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.news-item .text-center::after { content: " ครั้ง"; font-size: .72rem; }

/* read-more links */
.news-section .text-right a,
a[href^="show_newsAll"] {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--font-head);
  font-size: .88rem;
  color: var(--brand-1);
  font-weight: 500;
}
.news-section .text-right a:hover { letter-spacing: .4px; color: var(--brand-2); }

/* ---------- legacy bits used by inner pages ---------- */

.bg_news2, .bg_news3, .bg_news4, .bg_news5, .bg_news6 {
  background: var(--accent-grad) !important;
  color: #fff !important;
  border-radius: 10px;
  padding: .5rem .9rem !important;
  font-family: var(--font-head);
}

.box_imgname {
  background: linear-gradient(120deg, rgba(10,15,36,.85), rgba(10,15,36,.55)) !important;
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  backdrop-filter: blur(4px);
  font-family: var(--font-head);
}

.img-thumbnail, .img-thumbnail_news {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--card-border) !important;
  background: var(--card) !important;
  box-shadow: var(--shadow-sm);
  transition: transform .3s ease, box-shadow .3s ease !important;
}
.img-thumbnail:hover, .img-thumbnail_news:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.portfolio-item { margin-bottom: 1rem; }

/* tables from CKEditor content */
.bg_content table, #div_content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.bg_content table td, .bg_content table th,
#div_content table td, #div_content table th {
  border: none;
  border-bottom: 1px solid var(--card-border);
  padding: .55rem .8rem;
}
.bg_content table tr:hover td, #div_content table tr:hover td {
  background: rgba(21, 122, 58, 0.05);
}

/* pagination (if any) */
.page-link {
  border-radius: 10px !important;
  margin: 0 3px;
  border: 1px solid var(--card-border);
  color: var(--brand-1);
}
.page-item.active .page-link { background: var(--accent-grad); border: none; }

/* buttons */
.btn-primary {
  background: var(--accent-grad) !important;
  border: none !important;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(21, 122, 58, 0.35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(21, 122, 58, 0.45); }

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  margin-top: 3rem;
  background: var(--header-bg);
  color: rgba(226, 232, 240, 0.78);
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-grad);
}
.site-footer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 280px at 12% 110%, rgba(21, 122, 58, 0.18), transparent 65%),
    radial-gradient(520px 260px at 88% 110%, rgba(187, 147, 38, 0.14), transparent 65%);
  pointer-events: none;
}
.footer-grid {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.8rem 4rem 1.6rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 991px) { .footer-grid { grid-template-columns: 1fr; padding: 2rem 1rem 1.2rem; } }

.footer-brand {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: .6rem;
}
.footer-brand small {
  display: block;
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: 3px;
  color: rgba(226, 232, 240, 0.45);
  text-transform: uppercase;
  margin-top: .3rem;
}
.footer-head {
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 600;
  color: #ffd86a;
  margin-bottom: .8rem;
}
.site-footer p { margin: 0 0 .45rem; font-size: .92rem; }
.site-footer .fa {
  width: 30px; height: 30px;
  display: inline-grid;
  place-items: center;
  margin-right: .5rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #ffd86a;
}
.footer-bottom {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  padding: 1rem;
  font-size: .82rem;
  color: rgba(226, 232, 240, 0.45);
}

/* legacy footer class (safety net) */
.bg_footer { background: var(--header-bg) !important; color: rgba(226,232,240,.8) !important; }

/* ---------- scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s cubic-bezier(.2,.6,.2,1), transform .7s cubic-bezier(.2,.6,.2,1);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- back to top ---------- */

#backTop {
  position: fixed;
  right: 1.4rem; bottom: 1.4rem;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: none;
  border-radius: 14px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(21, 122, 58, 0.45);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 1040;
}
#backTop.show { opacity: 1; transform: none; pointer-events: auto; }
#backTop:hover { transform: translateY(-3px); }
