/* ==========================================================================
   หน้าเว็บสหกรณ์ออมทรัพย์ครูตาก — ธีมสีม่วง (ต่อยอดจาก Bootstrap 5.3)
   ========================================================================== */

:root {
  --brand-950: #2e1065;
  --brand-900: #3b0f7a;
  --brand-800: #4c1d95;
  --brand-700: #5b21b6;
  --brand-600: #6d28d9;
  --brand-500: #7c3aed;
  --brand-400: #a78bfa;
  --brand-200: #ddd6fe;
  --brand-100: #ede9fe;
  --brand-50: #f6f3ff;
  --accent: #f5b301;
  --ink: #1f1633;
  --muted: #6b6480;
  --surface: #ffffff;
  --page-bg: #faf9fd;
  --radius: 1rem;
  --shadow-sm: 0 2px 8px rgba(46, 16, 101, .06);
  --shadow: 0 12px 30px -12px rgba(46, 16, 101, .25);

  --bs-primary: var(--brand-700);
  --bs-primary-rgb: 91, 33, 182;
  --bs-link-color: var(--brand-700);
  --bs-link-color-rgb: 91, 33, 182;
  --bs-link-hover-color: var(--brand-500);
  --bs-link-hover-color-rgb: 124, 58, 237;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--page-bg);
  --bs-body-font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --bs-body-font-size: 1.05rem;
  --bs-border-radius: .65rem;
}

h1, h2, h3, h4, h5, h6, .font-heading, .navbar, .btn { font-family: 'Prompt', 'Sarabun', sans-serif; }
h1, h2, h3 { font-weight: 600; color: var(--ink); }

.btn-primary {
  --bs-btn-bg: var(--brand-700);
  --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-600);
  --bs-btn-hover-border-color: var(--brand-600);
  --bs-btn-active-bg: var(--brand-800);
  --bs-btn-active-border-color: var(--brand-800);
  --bs-btn-disabled-bg: var(--brand-700);
  --bs-btn-disabled-border-color: var(--brand-700);
  --bs-btn-focus-shadow-rgb: 124, 58, 237;
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-700);
  --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-700);
  --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-800);
  --bs-btn-focus-shadow-rgb: 124, 58, 237;
}
.btn-accent { background: var(--accent); color: var(--brand-950); border: 0; font-weight: 600; }
.btn-accent:hover { background: #ffc527; color: var(--brand-950); }
.text-brand { color: var(--brand-700) !important; }
.bg-brand-soft { background: var(--brand-50); }
.form-control:focus, .form-select:focus { border-color: var(--brand-400); box-shadow: 0 0 0 .25rem rgba(124, 58, 237, .2); }
.pagination { --bs-pagination-color: var(--brand-700); --bs-pagination-active-bg: var(--brand-700); --bs-pagination-active-border-color: var(--brand-700); --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(124, 58, 237, .2); }

::selection { background: var(--brand-200); }

.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: .5rem; }

/* ---------- แถบบนสุด ---------- */
.topbar { background: var(--brand-950); color: rgba(255, 255, 255, .8); font-size: .88rem; }
.topbar a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.topbar a:hover { color: #fff; }

/* ---------- Navbar ---------- */
.site-nav {
  /* ห้ามใช้ backdrop-filter ที่นี่: จะทำให้ offcanvas (position: fixed) ถูกจำกัดอยู่ในกรอบ header */
  background: #fff;
  box-shadow: 0 1px 0 rgba(46, 16, 101, .08);
  transition: box-shadow .2s;
}
.site-nav.scrolled { box-shadow: 0 6px 24px -12px rgba(46, 16, 101, .35); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; min-width: 0; }
.brand img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.brand-name { font-family: 'Prompt', sans-serif; font-weight: 600; color: var(--brand-800); line-height: 1.2; font-size: 1.08rem; }
.brand-sub { font-size: .78rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.site-nav .nav-link { color: var(--ink); font-weight: 500; padding: .55rem .9rem !important; border-radius: .6rem; }
.site-nav .nav-link:hover, .site-nav .nav-link:focus { color: var(--brand-700); background: var(--brand-50); }
.site-nav .nav-link.active { color: var(--brand-700); background: var(--brand-100); }
.site-nav .dropdown-menu { border: 0; box-shadow: var(--shadow); border-radius: .8rem; padding: .5rem; }
.site-nav .dropdown-item { border-radius: .5rem; padding: .5rem .85rem; }
.site-nav .dropdown-item:active, .site-nav .dropdown-item.active { background: var(--brand-700); }
@media (max-width: 991.98px) {
  .offcanvas .nav-link { padding: .75rem 1rem !important; }
}

/* ---------- Hero / สไลด์ ---------- */
.hero { background: linear-gradient(135deg, var(--brand-950), var(--brand-700) 60%, var(--brand-500)); padding: 1.5rem 0 4.5rem; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: auto -10% -60% -10%; height: 70%; background: radial-gradient(ellipse at center, rgba(255, 255, 255, .12), transparent 60%); pointer-events: none; }
.hero .carousel { border-radius: var(--radius); overflow: hidden; box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .5); }
.hero .slide { position: relative; aspect-ratio: 16 / 9; background: var(--brand-900); max-height: 640px; width: 100%; }
.hero .slide-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(24px) brightness(.6); transform: scale(1.15); }
.hero .slide img { position: relative; width: 100%; height: 100%; object-fit: contain; }
.hero .carousel-indicators [data-bs-target] { width: 10px; height: 10px; border-radius: 50%; }
.hero-empty { color: #fff; text-align: center; padding: 4rem 1rem; }

/* ---------- ทางลัด ---------- */
.quick-links { margin-top: -3rem; position: relative; z-index: 2; }
.quick-link {
  display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center;
  background: var(--surface); border-radius: var(--radius); padding: 1.25rem .75rem; height: 100%;
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform .2s, box-shadow .2s;
}
.quick-link:hover { transform: translateY(-4px); color: var(--brand-700); }
.quick-link .icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--brand-600), var(--brand-400)); }
.quick-link span { font-family: 'Prompt', sans-serif; font-weight: 500; font-size: .98rem; }

/* ---------- Section ---------- */
.section { padding: 4.5rem 0; }
.section-sm { padding: 3rem 0; }
.section-title { text-align: center; margin-bottom: 2.5rem; }
.section-title .eyebrow { display: inline-block; color: var(--brand-600); font-family: 'Prompt', sans-serif; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; font-size: .82rem; margin-bottom: .35rem; }
.section-title h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.section-title h2::after { content: ''; display: block; width: 64px; height: 4px; margin: .85rem auto 0; border-radius: 4px; background: linear-gradient(90deg, var(--brand-600), var(--accent)); }
.section-title p { color: var(--muted); margin: .75rem auto 0; max-width: 640px; }

.page-hero { background: linear-gradient(135deg, var(--brand-950), var(--brand-700)); color: #fff; padding: 2.75rem 0 2.25rem; } /* ลดความสูง 5% */
.page-hero h1 { color: #fff; font-size: clamp(1.5rem, 3.2vw, 2.3rem); margin: 0; }
.page-hero .breadcrumb { --bs-breadcrumb-divider-color: rgba(255, 255, 255, .6); --bs-breadcrumb-item-active-color: rgba(255, 255, 255, .85); margin-bottom: .6rem; font-size: .92rem; }
.page-hero .breadcrumb a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.page-hero .breadcrumb a:hover { color: #fff; }

/* ---------- แท็บ/ตัวกรอง (pill) ---------- */
.pill-tabs { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.pill-tabs .btn { border-radius: 2rem; padding: .45rem 1.1rem; }
.pill-tabs.scroll { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: .25rem; scrollbar-width: thin; }
.pill-tabs.scroll .btn { white-space: nowrap; }
@media (min-width: 768px) { .pill-tabs.scroll { flex-wrap: wrap; justify-content: center; } }

/* ---------- การ์ด ---------- */
.card-ui {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; height: 100%;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(46, 16, 101, .06);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
  text-decoration: none; color: inherit;
}
a.card-ui:hover { transform: translateY(-4px); box-shadow: var(--shadow); color: inherit; }
.card-ui .thumb { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--brand-50); }
.card-ui .thumb.portrait { aspect-ratio: 3 / 4; }
.card-ui .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .5s; }
a.card-ui:hover .thumb img { transform: scale(1.05); }
.card-ui .thumb .badge-type { position: absolute; top: .75rem; left: .75rem; background: rgba(46, 16, 101, .85); color: #fff; font-size: .78rem; padding: .3rem .7rem; border-radius: 2rem; font-family: 'Prompt', sans-serif; font-weight: 400; }
.card-ui .thumb .badge-count { position: absolute; bottom: .75rem; right: .75rem; background: rgba(0, 0, 0, .6); color: #fff; font-size: .8rem; padding: .2rem .6rem; border-radius: 2rem; }
.card-ui .body { padding: 1rem 1.15rem 1.15rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-ui .title { font-family: 'Prompt', sans-serif; font-weight: 500; font-size: 1.02rem; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-ui .meta { color: var(--muted); font-size: .86rem; display: flex; gap: .9rem; flex-wrap: wrap; margin-top: auto; }
.placeholder-img { width: 100%; height: 100%; display: grid; place-items: center; color: var(--brand-400); font-size: 2.6rem; background: linear-gradient(135deg, var(--brand-50), var(--brand-100)); }

/* skeleton */
.skeleton { background: linear-gradient(90deg, #efeaf9 25%, #f7f4fd 37%, #efeaf9 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: .5rem; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- ปณิธาน ---------- */
.values-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4 / 3; }
.values-img img { width: 100%; height: 100%; object-fit: cover; }
.value-item { display: flex; gap: 1rem; align-items: flex-start; }
.value-item .icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-100); color: var(--brand-700); font-size: 1.4rem; }
.value-item h3 { font-size: 1.1rem; margin: 0 0 .15rem; }
.value-item p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- เนื้อหาบทความ ---------- */
.article { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: clamp(1.25rem, 3vw, 2.5rem); }
.article-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 1rem; font-size: .92rem; }
.article-cover { border-radius: .8rem; overflow: hidden; background: var(--brand-50); text-align: center; }
.article-cover img { max-width: 100%; max-height: 80vh; height: auto; }
.prose { line-height: 1.85; overflow-wrap: anywhere; }
.prose img { max-width: 100% !important; height: auto !important; border-radius: .5rem; }
.prose iframe { max-width: 100%; }
.prose table { width: 100% !important; max-width: 100%; display: block; overflow-x: auto; border-collapse: collapse; }
.prose td, .prose th { border: 1px solid #e3ddf3; padding: .4rem .6rem; }
.prose p:last-child { margin-bottom: 0; }
.ratio-video { border-radius: .8rem; overflow: hidden; }

.share .btn { border-radius: 2rem; }

/* ---------- แกลเลอรี่ ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.photo-grid button { border: 0; padding: 0; border-radius: .7rem; overflow: hidden; aspect-ratio: 1; background: var(--brand-50); cursor: zoom-in; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.photo-grid button:hover img, .photo-grid button:focus-visible img { transform: scale(1.06); }

/* ---------- ดาวน์โหลด ---------- */
.doc-item { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.15rem; background: var(--surface); border-radius: .85rem; border: 1px solid rgba(46, 16, 101, .07); }
.doc-item + .doc-item { margin-top: .65rem; }
.doc-item:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.doc-icon { flex: none; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem; background: #fdecec; color: #d63939; }
.doc-icon.doc { background: #e8f0fe; color: #1a5fd0; }
.doc-icon.xls { background: #e7f6ec; color: #1f8a4c; }
.doc-icon.img { background: var(--brand-100); color: var(--brand-700); }
.doc-icon.zip { background: #fff4db; color: #a86b00; }
.doc-title { font-weight: 500; line-height: 1.45; }
.doc-files a { font-size: .9rem; }

/* ---------- บุคลากร ---------- */
.people-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
.people-row + .people-row { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px dashed var(--brand-200); }
.person { width: 230px; text-align: center; }
.person .photo { width: 190px; height: 230px; margin: 0 auto .9rem; border-radius: 1rem; overflow: hidden; background: var(--brand-50); box-shadow: var(--shadow-sm); border: 4px solid #fff; outline: 1px solid var(--brand-100); }
.person .photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.person.lead { width: 280px; }
.person.lead .photo { width: 230px; height: 280px; outline: 3px solid var(--brand-400); }
.person h3 { font-size: 1.02rem; margin: 0 0 .2rem; }
.person .position { color: var(--brand-700); font-size: .92rem; }
.person .dept { color: var(--muted); font-size: .86rem; }

/* ---------- ติดต่อ ---------- */
.contact-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.contact-side { background: linear-gradient(160deg, var(--brand-900), var(--brand-600)); color: #fff; padding: 2rem; height: 100%; position: relative; }
.contact-side h3 { color: #fff; }
.contact-side .info { display: flex; gap: .85rem; margin-bottom: 1.1rem; }
.contact-side .info i { font-size: 1.25rem; color: var(--accent); }
.contact-side a { color: #fff; }
.contact-photo { border-radius: .8rem; overflow: hidden; aspect-ratio: 16 / 9; margin-top: 1.5rem; }
.contact-photo img { width: 100%; height: 100%; object-fit: cover; }
.hp-field { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-950); color: rgba(255, 255, 255, .75); padding-top: 3.5rem; margin-top: 2rem; }
.site-footer h3 { color: #fff; font-size: 1.05rem; margin-bottom: 1rem; }
.site-footer a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-links li { margin-bottom: .45rem; }
.site-footer .bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 2.5rem; padding: 1.25rem 0; font-size: .88rem; }
.counter-badge { display: inline-flex; gap: .5rem; align-items: center; background: rgba(255, 255, 255, .08); border-radius: 2rem; padding: .35rem .9rem; font-variant-numeric: tabular-nums; }
.counter-badge b { color: var(--accent); letter-spacing: .05em; }

.back-to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1030; width: 46px; height: 46px; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; transform: translateY(10px); box-shadow: var(--shadow); }
.back-to-top.show { opacity: 1; pointer-events: auto; transform: none; }

.empty-state { text-align: center; color: var(--muted); padding: 3.5rem 1rem; }
.empty-state i { font-size: 3rem; color: var(--brand-400); display: block; margin-bottom: .5rem; }

/* แสดงเนื้อหาแบบค่อย ๆ ปรากฏ */
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.swal2-popup { font-family: 'Sarabun', sans-serif; border-radius: 1rem; }
.swal2-title { font-family: 'Prompt', sans-serif; }

@media (max-width: 575.98px) {
  .section { padding: 3rem 0; }
  .brand img { width: 42px; height: 42px; }
  .brand-name { font-size: .95rem; }
  .person, .person.lead { width: calc(50% - .75rem); }
  .person .photo, .person.lead .photo { width: 100%; height: auto; aspect-ratio: 5 / 6; }
}

.min-w-0 { min-width: 0; }
.flex-none { flex: none; }

/* เมนูบนจอใหญ่: แถวบน = โลโก้ + ชื่อเต็ม, แถวล่าง = เมนู (ชื่อเมนูยาว ไม่ให้ตัดบรรทัด) */
.site-nav .nav-link { white-space: nowrap; }
@media (min-width: 992px) {
  .site-nav .navbar { padding-bottom: 0 !important; }
  .site-nav .navbar > .container { flex-wrap: wrap; }
  .site-nav .navbar-expand-lg .offcanvas, .site-nav .navbar .offcanvas { flex-basis: 100%; }
  .site-nav .offcanvas-body { border-top: 1px solid var(--brand-100); margin-top: .5rem; padding: .35rem 0; }
  .site-nav .navbar-nav { margin: 0 auto !important; flex-wrap: wrap; justify-content: center; }
  .brand-name { font-size: 1.25rem; }
}
@media (min-width: 992px) and (max-width: 1399.98px) {
  .site-nav .nav-link { padding: .5rem .62rem !important; font-size: .95rem; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .site-nav .nav-link { padding: .45rem .5rem !important; font-size: .88rem; }
}

/* ---------- SweetAlert2 theme (ใช้ร่วมกันทั้ง admin และหน้าเว็บ) ----------
   - หน้าต่างเล็กลง 25%: SweetAlert ใช้หน่วย em ทั้งหมด จึงลด font-size ของ popup เหลือ .75rem
     ทำให้ความกว้าง (32em), ไอคอน และระยะต่าง ๆ เล็กลงตามสัดส่วน
   - พื้นไล่เฉดสีม่วง, ปุ่มทรงแคปซูลพร้อมไอคอน (ไอคอนใส่ใน ui.js) */
.swal2-container.swal2-backdrop-show { background: rgba(30, 10, 60, .45); }

/* ขึ้นต้นด้วย .swal2-container เพื่อให้ชนะ CSS ที่ sweetalert2.all.js แทรกเข้ามาภายหลัง (เช่น พื้นขาวของ toast) */
.swal2-container .swal2-popup.tk-swal {
  font-size: .75rem;
  color: #fff;
  background: linear-gradient(145deg, #2e1065 0%, #5b21b6 55%, #8b5cf6 100%);
  border-radius: 1.25rem;
  box-shadow: 0 24px 60px -18px rgba(46, 16, 101, .7), inset 0 1px 0 rgba(255, 255, 255, .15);
  padding-bottom: 1.6em;
}
.tk-swal .swal2-title { color: #fff; font-size: 2em; padding-top: .5em; }
.tk-swal .swal2-html-container { color: rgba(255, 255, 255, .9); font-size: 1.4em; line-height: 1.65; }
.tk-swal .swal2-html-container b, .tk-swal .swal2-html-container strong { color: #fff; }
.tk-swal .swal2-html-container ul { padding-left: 1.2em; }
.tk-swal-note { color: rgba(255, 255, 255, .65); }
.tk-swal .swal2-close { color: rgba(255, 255, 255, .7); }
.tk-swal .swal2-close:hover { color: #fff; }
.tk-swal .swal2-validation-message { background: rgba(255, 255, 255, .12); color: #fff; }
.tk-swal .swal2-timer-progress-bar { background: rgba(255, 255, 255, .55); }

/* ไอคอน: ปรับสีให้อ่านง่ายบนพื้นม่วง */
.tk-swal .swal2-icon { margin-top: 2em; }
.tk-swal .swal2-icon.swal2-success { border-color: #86efac; color: #86efac; }
.tk-swal .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(134, 239, 172, .45); }
.tk-swal .swal2-icon.swal2-success [class^='swal2-success-line'] { background-color: #86efac; }
/* ชิ้นส่วนแอนิเมชันของไอคอนสำเร็จมีพื้นสีขาว (ทำไว้สำหรับพื้นขาว) — ทำให้ใสบนพื้นไล่เฉด */
.tk-swal .swal2-icon.swal2-success [class^='swal2-success-circular-line'],
.tk-swal .swal2-icon.swal2-success .swal2-success-fix { background-color: transparent !important; }
.tk-swal .swal2-icon.swal2-error { border-color: #fca5a5; color: #fca5a5; }
.tk-swal .swal2-icon.swal2-error [class^='swal2-x-mark-line'] { background-color: #fca5a5; }
.tk-swal .swal2-icon.swal2-warning { border-color: #fde68a; color: #fde68a; }
.tk-swal .swal2-icon.swal2-question,
.tk-swal .swal2-icon.swal2-info { border-color: #e9d5ff; color: #e9d5ff; }

/* ปุ่ม */
.tk-swal .swal2-actions { gap: .7em; margin-top: 1.5em; }
.swal2-container .tk-swal-btn {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 2em;
  padding: .65em 1.5em;
  font-family: inherit;
  font-size: 1.35em;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
/* SweetAlert กำหนด display ของปุ่มแบบ inline (และใช้ display:none ซ่อนปุ่มที่ไม่ใช้) จึงเว้นระยะด้วย margin ของไอคอนแทน gap */
.swal2-container .tk-swal-btn i { font-size: 1.05em; margin-right: .45em; vertical-align: -.1em; }
.swal2-container .tk-swal-btn:hover { transform: translateY(-1px); }
.swal2-container .tk-swal-btn:focus-visible { outline: 3px solid rgba(255, 255, 255, .65); outline-offset: 2px; }
.swal2-container .tk-swal-confirm { background: #fff; color: #5b21b6; box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .45); }
.swal2-container .tk-swal-confirm:hover { background: #f3e8ff; }
.swal2-container .tk-swal-danger { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; box-shadow: 0 8px 18px -8px rgba(127, 29, 29, .7); }
.swal2-container .tk-swal-danger:hover { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.swal2-container .tk-swal-cancel { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .4); }
.swal2-container .tk-swal-cancel:hover { background: rgba(255, 255, 255, .2); }

/* toast (แจ้งเตือนมุมจอ) ใช้ธีมเดียวกัน ขนาดเดิม */
.swal2-container .swal2-popup.tk-swal.tk-swal-toast { font-size: 1rem; padding: .75em 1em; border-radius: .9rem; }
.tk-swal.tk-swal-toast .swal2-title { font-size: 1em; padding: 0; color: #fff; }
.tk-swal.tk-swal-toast .swal2-icon { margin: 0 .5em 0 0; }

@media (prefers-reduced-motion: reduce) { .tk-swal-btn { transition: none; } .tk-swal-btn:hover { transform: none; } }

/* ==========================================================================
   การ์ดแบบมีมิติ (หน้าแรก) — พื้นไล่เฉด, ขอบไล่เฉด, เงาหลายชั้น, ลอยและเรืองแสงเมื่อ hover
   ========================================================================== */

/* โทนสีของแต่ละการ์ด (ใช้กับไอคอนและแสงเรือง)
   ค่าเริ่มต้นใช้ :where() (specificity = 0) เพื่อให้คลาส .tone-* แทนที่ได้เสมอ */
:where(.quick-link, .value-item) { --tone-a: #6d28d9; --tone-b: #a78bfa; --tone-rgb: 109, 40, 217; }
.tone-violet  { --tone-a: #6d28d9; --tone-b: #a78bfa; --tone-rgb: 124, 58, 237; }
.tone-fuchsia { --tone-a: #a21caf; --tone-b: #e879f9; --tone-rgb: 192, 38, 211; }
.tone-indigo  { --tone-a: #4338ca; --tone-b: #818cf8; --tone-rgb: 79, 70, 229; }
.tone-purple  { --tone-a: #4c1d95; --tone-b: #8b5cf6; --tone-rgb: 91, 33, 182; }
.tone-rose    { --tone-a: #be185d; --tone-b: #f472b6; --tone-rgb: 219, 39, 119; }
.tone-amber   { --tone-a: #b45309; --tone-b: #fbbf24; --tone-rgb: 217, 119, 6; }

/* ---------- ทางลัด ---------- */
.quick-link {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  gap: .65rem;
  padding: 1.5rem .85rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 1.25rem;
  background:
    linear-gradient(165deg, #ffffff 0%, #fbf8ff 55%, #f4edff 100%) padding-box,
    linear-gradient(140deg, rgba(var(--tone-rgb), .55), rgba(255, 255, 255, .6) 45%, rgba(245, 179, 1, .45)) border-box;
  box-shadow:
    0 1px 2px rgba(46, 16, 101, .06),
    0 12px 24px -12px rgba(46, 16, 101, .3),
    0 30px 50px -32px rgba(var(--tone-rgb), .55),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}
/* แสงเรืองโทนสีของการ์ด ค่อย ๆ ปรากฏเมื่อ hover */
.quick-link::before {
  content: '';
  position: absolute;
  inset: -40% -20% auto;
  height: 120%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--tone-rgb), .22), transparent 70%);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .4s ease, transform .4s ease;
}
/* เส้นไฮไลต์ไล่เฉดด้านล่าง */
.quick-link::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--tone-a), var(--tone-b));
  transform: scaleX(.35);
  opacity: .5;
  transition: transform .4s ease, opacity .4s ease;
}
.quick-link .icon {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  font-size: 1.65rem;
  background: linear-gradient(140deg, var(--tone-a) 0%, var(--tone-b) 100%);
  box-shadow: 0 12px 22px -10px rgba(var(--tone-rgb), .85), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -6px 12px rgba(0, 0, 0, .12);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}
/* เงาสะท้อนบนไอคอน */
.quick-link .icon::after {
  content: '';
  position: absolute;
  inset: 4px 8px auto;
  height: 45%;
  border-radius: 14px 14px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.quick-link .label { font-family: 'Prompt', sans-serif; font-weight: 500; font-size: .98rem; line-height: 1.35; color: var(--ink); transition: color .3s ease; }
.quick-link .go { position: absolute; top: .65rem; right: .7rem; font-size: 1.3rem; color: rgb(var(--tone-rgb)); opacity: 0; transform: translateX(-6px); transition: opacity .3s ease, transform .3s ease; }

.quick-link:hover, .quick-link:focus-visible {
  transform: translateY(-7px);
  box-shadow:
    0 2px 4px rgba(46, 16, 101, .08),
    0 22px 36px -14px rgba(46, 16, 101, .38),
    0 40px 60px -30px rgba(var(--tone-rgb), .75),
    inset 0 1px 0 rgba(255, 255, 255, .9);
}
.quick-link:hover::before, .quick-link:focus-visible::before { opacity: 1; transform: none; }
.quick-link:hover::after, .quick-link:focus-visible::after { transform: scaleX(1); opacity: 1; }
.quick-link:hover .icon, .quick-link:focus-visible .icon { transform: translateY(-3px) rotate(-6deg) scale(1.06); box-shadow: 0 18px 28px -10px rgba(var(--tone-rgb), .9), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -6px 12px rgba(0, 0, 0, .12); }
.quick-link:hover .label, .quick-link:focus-visible .label { color: var(--tone-a); }
.quick-link:hover .go, .quick-link:focus-visible .go { opacity: 1; transform: none; }
.quick-link:focus-visible { outline: 3px solid rgba(var(--tone-rgb), .45); outline-offset: 3px; }

/* ---------- การ์ดข่าว / อัลบั้ม ---------- */
.card-ui {
  border: 1px solid transparent;
  border-radius: 1.15rem;
  background:
    linear-gradient(180deg, #ffffff 0%, #fdfbff 70%, #f8f3ff 100%) padding-box,
    linear-gradient(160deg, rgba(167, 139, 250, .45), rgba(255, 255, 255, .5) 40%, rgba(245, 179, 1, .3)) border-box;
  box-shadow:
    0 1px 2px rgba(46, 16, 101, .06),
    0 14px 28px -16px rgba(46, 16, 101, .32),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}
a.card-ui:hover, a.card-ui:focus-visible {
  transform: translateY(-6px);
  box-shadow:
    0 2px 4px rgba(46, 16, 101, .08),
    0 26px 40px -18px rgba(46, 16, 101, .42),
    0 0 0 1px rgba(167, 139, 250, .35);
}
.card-ui .thumb { margin: .5rem .5rem 0; border-radius: .85rem; box-shadow: 0 8px 18px -12px rgba(46, 16, 101, .5); }
/* ไล่เฉดทับภาพด้านล่างเล็กน้อย ให้ป้ายและรูปดูมีมิติ */
.card-ui .thumb::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(46, 16, 101, .28));
  opacity: .7;
  transition: opacity .35s ease;
  pointer-events: none;
}
a.card-ui:hover .thumb::after { opacity: 1; }
.card-ui .thumb .badge-type { z-index: 1; background: linear-gradient(135deg, rgba(76, 29, 149, .92), rgba(139, 92, 246, .92)); box-shadow: 0 4px 12px -4px rgba(46, 16, 101, .6); backdrop-filter: blur(4px); }
.card-ui .thumb .badge-count { z-index: 1; backdrop-filter: blur(4px); }
.card-ui .title { transition: color .3s ease; }
a.card-ui:hover .title { color: var(--brand-700); }
.card-ui .meta i { color: var(--brand-500); }

/* ---------- ปณิธาน ---------- */
.value-item {
  height: 100%;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  background:
    linear-gradient(160deg, #ffffff, #f8f3ff) padding-box,
    linear-gradient(140deg, rgba(var(--tone-rgb), .4), rgba(255, 255, 255, .4)) border-box;
  box-shadow: 0 10px 22px -16px rgba(46, 16, 101, .45);
  transition: transform .3s ease, box-shadow .3s ease;
}
.value-item:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -16px rgba(var(--tone-rgb), .55); }
.value-item .icon { color: #fff; background: linear-gradient(140deg, var(--tone-a), var(--tone-b)); box-shadow: 0 10px 18px -8px rgba(var(--tone-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .3); }
.values-img { box-shadow: 0 30px 60px -28px rgba(46, 16, 101, .6), 0 0 0 6px #fff, 0 0 0 7px rgba(167, 139, 250, .35); }

/* ---------- ติดต่อ ---------- */
.contact-card {
  border-radius: 1.4rem;
  box-shadow:
    0 2px 6px rgba(46, 16, 101, .08),
    0 30px 60px -28px rgba(46, 16, 101, .5),
    0 0 0 1px rgba(167, 139, 250, .25);
}

@media (max-width: 575.98px) {
  .quick-link { padding: 1.1rem .4rem 1rem; border-radius: 1rem; }
  .quick-link .icon { width: 52px; height: 52px; border-radius: 15px; font-size: 1.4rem; }
  .quick-link .label { font-size: .86rem; }
  .quick-link .go { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .quick-link, .quick-link .icon, .quick-link::before, .quick-link::after, .card-ui, .value-item { transition: none !important; }
}

/* หน้าแรก ส่วน “ข่าวสารและประกาศ”: การ์ดเตี้ยลง 15% (ลดเฉพาะความสูงรูป จาก 3:4 เป็น 23:25 ข้อความคงเดิม) */
[data-news] .card-ui .thumb.portrait { aspect-ratio: 23 / 25; }

/* ==========================================================================
   ส่วนที่เพิ่ม: หน้าเว็บ / วีดีโอ / สารบัญเว็บไซต์ และการจัดเรียงส่วนตามที่ตั้งค่าใน admin
   ========================================================================== */
/* ทางลัดที่ไม่ได้อยู่ต่อจากสไลด์: ไม่ซ้อนขึ้นไปบนส่วนก่อนหน้า */
.quick-links.no-overlap { margin-top: 0; padding-top: 3rem; }
.hero.alone { padding-bottom: 2rem; }

/* การ์ดหน้าเว็บ */
.page-card {
  display: flex;
  gap: 1rem;
  height: 100%;
  padding: 1.25rem;
  border-radius: 1.15rem;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--ink);
  background:
    linear-gradient(165deg, #ffffff, #f8f3ff) padding-box,
    linear-gradient(140deg, rgba(var(--tone-rgb), .5), rgba(255, 255, 255, .5) 45%, rgba(245, 179, 1, .35)) border-box;
  box-shadow: 0 1px 2px rgba(46, 16, 101, .06), 0 14px 28px -16px rgba(46, 16, 101, .32);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}
:where(.page-card, .link-tile) { --tone-a: #6d28d9; --tone-b: #a78bfa; --tone-rgb: 109, 40, 217; }
.page-card .icon { flex: none; width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.4rem; color: #fff; background: linear-gradient(140deg, var(--tone-a), var(--tone-b)); box-shadow: 0 10px 18px -8px rgba(var(--tone-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .3); transition: transform .35s ease; }
.page-card .body { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.page-card .type { font-size: .78rem; color: rgb(var(--tone-rgb)); font-family: 'Prompt', sans-serif; }
.page-card .title { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 1.05rem; line-height: 1.4; }
.page-card .excerpt { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.page-card .more { margin-top: auto; padding-top: .35rem; font-size: .88rem; color: rgb(var(--tone-rgb)); font-weight: 500; }
.page-card .more i { transition: transform .3s ease; }
.page-card:hover { transform: translateY(-5px); box-shadow: 0 22px 36px -16px rgba(var(--tone-rgb), .5); color: var(--ink); }
.page-card:hover .icon { transform: rotate(-6deg) scale(1.06); }
.page-card:hover .more i { transform: translateX(4px); }

/* ไทล์ลิงก์เว็บไซต์ */
.link-tile {
  display: flex;
  align-items: center;
  gap: .85rem;
  height: 100%;
  padding: .9rem 1rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--ink);
  background:
    linear-gradient(165deg, #ffffff, #faf6ff) padding-box,
    linear-gradient(140deg, rgba(167, 139, 250, .45), rgba(255, 255, 255, .5)) border-box;
  box-shadow: 0 10px 22px -16px rgba(46, 16, 101, .4);
  transition: transform .3s ease, box-shadow .3s ease;
}
.link-tile .icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; color: #fff; background: linear-gradient(140deg, var(--brand-600), var(--brand-400)); box-shadow: 0 8px 16px -8px rgba(109, 40, 217, .8); }
.link-tile .body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.link-tile .title { font-family: 'Prompt', sans-serif; font-weight: 500; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-tile .host { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-tile .ext { color: var(--brand-400); transition: transform .3s ease, color .3s ease; }
.link-tile:hover { transform: translateY(-4px); box-shadow: 0 18px 30px -16px rgba(109, 40, 217, .5); color: var(--ink); }
.link-tile:hover .ext { color: var(--brand-600); transform: translate(2px, -2px); }
.link-group + .link-group { margin-top: 2.5rem; }
.link-group-title { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; color: var(--brand-800); }
@media (prefers-reduced-motion: reduce) { .page-card, .page-card .icon, .link-tile { transition: none !important; } }

/* การ์ดวีดีโอ: ปุ่มเล่นต้องเต็มกรอบ 16:9 (ห้ามใช้ .position-relative เพราะ !important จะทับ .ratio > * ที่เป็น absolute) */
.ratio > .video-play { border-radius: 0; overflow: hidden; }
.video-play img { object-fit: cover; transition: transform .5s ease; }
.video-play:hover img { transform: scale(1.05); }

/* ---------- การ์ดวีดีโอขนาดเล็ก (ภาพ 16:9 ไม่มีพื้นดำ) ---------- */
.video-card .video-box { background: linear-gradient(135deg, var(--brand-100), var(--brand-50)); overflow: hidden; }
.video-card .video-box iframe { border: 0; }
.video-card .play-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.5rem; color: #fff; padding-left: .15rem;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-500));
  box-shadow: 0 6px 18px rgba(59, 15, 122, .35); transition: transform .3s ease, box-shadow .3s ease;
}
.video-play:hover .play-icon { transform: translate(-50%, -50%) scale(1.12); box-shadow: 0 8px 24px rgba(59, 15, 122, .45); }
.video-card .body { padding: .6rem .8rem .75rem; gap: .2rem; }
.video-card .title { font-size: .88rem; line-height: 1.4; }
.video-card .meta { font-size: .75rem; }
@media (max-width: 575.98px) {
  .video-card .title { font-size: .8rem; }
  .video-card .play-icon { width: 2.1rem; height: 2.1rem; font-size: 1.2rem; }
}

/* ---------- ดูรูปขนาดใหญ่ (lightbox): พื้นดำ รูปพอดีพื้นที่ระหว่างแถบบนกับคำบรรยาย ไม่ถูกทับ ---------- */
.lightbox .modal-content { background: #000; border: 0; display: flex; flex-direction: column; height: 100%; }
.lightbox .lb-top, .lightbox .caption { flex: none; background: #000; }
.lightbox .modal-body { flex: 1 1 auto; min-height: 0; overflow: hidden; background: #000; }
.lightbox .carousel, .lightbox .carousel-inner, .lightbox .carousel-item { height: 100%; background: #000; }
.lightbox .carousel-item.active, .lightbox .carousel-item-next, .lightbox .carousel-item-prev { display: flex; align-items: center; justify-content: center; }
.lightbox .carousel-item img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; margin: 0 auto; -webkit-user-drag: none; user-select: none; }
.lightbox .caption { color: rgba(255, 255, 255, .85); text-align: center; padding: .75rem 1rem; font-size: .92rem; }
.lightbox .caption:empty { display: none; }

/* ---------- PDPA: แถบแจ้งการใช้คุกกี้ ---------- */
.consent-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1080;
  padding: 0 0 1rem; pointer-events: none;
  transform: translateY(110%); opacity: 0; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .35s ease;
}
.consent-banner.show { transform: none; opacity: 1; }
.consent-inner {
  pointer-events: auto; display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-radius: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--brand-950), var(--brand-700));
  box-shadow: 0 18px 40px -12px rgba(46, 16, 101, .55); border: 1px solid rgba(255, 255, 255, .12);
}
.consent-icon { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; background: rgba(255, 255, 255, .14); }
.consent-text { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.6; }
.consent-text a { color: #fde68a; text-decoration: underline; text-underline-offset: 2px; }
.consent-text a:hover { color: #fff; }
.consent-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; margin-bottom: .25rem; padding: .1rem .6rem; border-radius: 1rem; background: rgba(253, 230, 138, .2); color: #fde68a; }
.consent-actions { flex: none; }
.consent-actions .btn-primary { background: #fff; border-color: #fff; color: var(--brand-800); font-weight: 600; }
.consent-actions .btn-primary:hover { background: #ede9fe; border-color: #ede9fe; color: var(--brand-900); }
@media (max-width: 575.98px) {
  .consent-banner { padding: 0 0 .5rem; }
  .consent-inner { flex-wrap: wrap; gap: .65rem; padding: .9rem 1rem; }
  .consent-icon { display: none; }
  .consent-actions, .consent-actions .btn { width: 100%; }
}
body:has(.consent-banner.show) .back-to-top { bottom: 7rem; }

/* ---------- PDPA: หน้านโยบาย + ช่องยินยอมในฟอร์มติดต่อ ---------- */
.privacy-doc { background: #fff; border-radius: var(--radius, 1rem); padding: clamp(1.25rem, 3vw, 2.5rem); border: 1px solid #e6defa; box-shadow: 0 10px 30px -18px rgba(46, 16, 101, .35); }
.privacy-doc .prose h2 { font-size: 1.15rem; color: var(--brand-800); margin: 1.75rem 0 .6rem; }
.privacy-doc .prose ul { padding-left: 1.25rem; }
.privacy-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .88rem; color: #6c6489; margin-bottom: 1rem; }
.privacy-meta i { color: var(--brand-600); margin-right: .25rem; }
.privacy-consent { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; margin-bottom: 1.5rem; border-radius: .75rem; font-size: .92rem; background: #fff8e6; border: 1px solid #f5d98b; color: #7a5300; }
.privacy-consent.ok { background: #effaf3; border-color: #a7dcc0; color: #146c43; }
.privacy-consent > i { font-size: 1.3rem; }
.privacy-note { margin-top: 1.25rem; padding: .7rem 1rem; border-radius: .75rem; background: var(--brand-50); color: var(--brand-800); font-size: .92rem; }
.privacy-contact { margin-top: 1.5rem; padding: 1rem 1.25rem; border-radius: .75rem; border: 1px dashed #c9b8f0; }
.privacy-contact h2 { color: var(--brand-800); }
.consent-check { padding: .75rem .9rem .75rem 2.4rem; border-radius: .75rem; background: var(--brand-50); border: 1px solid #e3d9fb; font-size: .92rem; }
.consent-check .form-check-input { margin-top: .3rem; }
.consent-check a { font-weight: 600; }
.footer-privacy { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-privacy:hover { color: #fff; }
