/* =====================================================
   custom.css - สไตล์หลักเว็บไซต์ สพป.อุบลราชธานี เขต 3
   สีหลัก: (น้ำเงินเข้ม) #1a4fa8
   ===================================================== */

/* --- Container Width --- */
@media (min-width: 1400px) {
  .container, .container-lg, .container-xl, .container-xxl {
    max-width: 1400px;
  }
}

/* --- Root Variables --- */
:root {
  --accent: #1a4fa8;
  --accent-dark: #153d84;
  --accent-light: #e8eef9;
  --heading: #1a2a4a;
  --text: #444444;
  --text-muted: #888;
  --bg: #ffffff;
  --bg-light: #f9f9f9;
  --dark: #1a1a2e;
  --nav-bg: #ffffff;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  font-family: 'Sarabun', 'Poppins', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* ชดเชยความสูง sticky header (~80px) */
html {
  scroll-padding-top: 90px;
}

body {
  font-family: 'Sarabun', 'Poppins', sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.7;
}

/* --- Typography --- */
h1,h2,h3,h4,h5,h6 { font-family: 'Sarabun','Poppins',sans-serif; color: var(--heading); font-weight: 700; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-dark); }

/* --- Utility --- */
.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent) !important; }
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: var(--transition);
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.btn-outline-accent { border: 2px solid var(--accent); color: var(--accent); border-radius: var(--radius-sm); font-weight: 600; }
.btn-outline-accent:hover { background: var(--accent); color: #fff; }

/* =====================================================
   TOPBAR
   ===================================================== */
.topbar {
  background: var(--dark);
  color: rgba(255,255,255,.8);
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.topbar a { color: rgba(255,255,255,.7); }
.topbar a:hover { color: var(--accent); }
.topbar-icon { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:50%; background:rgba(255,255,255,.1); transition:var(--transition); font-size:13px; }
.topbar-icon:hover { background:var(--accent); color:#fff !important; }
.divider-v { width:1px; height:16px; background:rgba(255,255,255,.2); }

/* =====================================================
   HEADER
   ===================================================== */
#header {
  background: var(--nav-bg);
  box-shadow: var(--shadow-sm);
  padding: 10px 0;
  z-index: 100;
}
.logo { text-decoration: none; }
.logo-icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius-sm);
  display:flex; align-items:center; justify-content:center;
  color: #fff; font-size: 22px; flex-shrink: 0;
  margin-right: 10px;
}
.logo-title { display:block; font-size:26px; font-weight:800; color:var(--heading); line-height:1.2; }
.logo-sub { display:block; font-size:14px; color:var(--text-muted); }

.navmenu ul { list-style:none; margin:0; padding:0; display:flex; gap:4px; }
.navmenu ul li a {
  padding: 8px 14px;
  color: #212529;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  white-space: nowrap;
}
.navmenu ul li a:hover, .navmenu ul li a.active { color: var(--accent); background: var(--accent-light); }
.navmenu .dropdown ul {
  display:none; position:absolute; top:100%; left:0; min-width:200px;
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 0; z-index:200; border-top: 3px solid var(--accent);
  flex-direction:column; gap:0;
}
.navmenu .dropdown:hover > ul { display:flex; }
.navmenu .dropdown ul li a { border-radius:0; padding:8px 20px; font-size:13px; }

/* Flyout submenu (has-sub) — ออกด้านขวา */
.navmenu .dropdown ul li.has-sub { position:relative; }
.navmenu .dropdown ul li.has-sub > a { display:flex; align-items:center; justify-content:space-between; }
.navmenu .dropdown ul li.has-sub > a .bi-chevron-right { font-size:11px; margin-left:8px; flex-shrink:0; }
.navmenu .dropdown ul li.has-sub > ul {
  display:none; position:absolute; top:0; left:100%;
  min-width:220px; border-top:3px solid var(--accent);
  border-radius:var(--radius); box-shadow:var(--shadow);
  background:#fff; padding:8px 0; flex-direction:column; gap:0; z-index:300;
}
.navmenu .dropdown ul li.has-sub:hover > ul { display:flex; }

.header-search .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right:none; font-size:13px; }
.header-search .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
/* ปุ่ม hamburger — ซ่อนบนจอใหญ่, แสดงบน mobile */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  outline: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--heading);
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
  z-index: 600;
  position: relative;
}

/* =====================================================
   HERO
   ===================================================== */
/* =====================================================
   HERO — Responsive banner
   swiper เป็น background, content กำหนดความสูงเอง
   ===================================================== */
#hero {
  position: relative;
  padding: 0;
  overflow: hidden;
}

/* --- Swiper แสดงแบบปกติ ไม่ทับข้อความ --- */
.hero-swiper {
  position: relative !important;
  inset: unset !important;
  width: 100% !important;
  height: auto !important;
  z-index: 0;
  overflow: hidden;
}
.hero-swiper .swiper-wrapper,
.hero-swiper .swiper-slide {
  height: auto !important;
}
.hero-swiper .swiper-slide img {
  width: 100%;
  height: auto;
  display: block;
}
.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.50);
  z-index: 1;
}
.hero-slide-link {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.hero-swiper .swiper-button-prev,
.hero-swiper .swiper-button-next {
  color: #fff;
  z-index: 10;
}
.hero-swiper .swiper-pagination {
  z-index: 10;
}

/* --- Content กำหนดความสูงของ section ไม่มีทับปุ่ม --- */
.hero-content-wrap {
  position: relative;
  z-index: 5;
  padding: 60px 0 120px; /* 120px เผื่อ stats bar (~80px) + margin ปุ่ม */
}
.hero-content-wrap .container {
  width: 100%;
}

/* --- hero-bg-overlay (กรณีไม่มีแบนเนอร์) --- */
.hero-bg-overlay {
  position: absolute; inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60"><circle cx="30" cy="30" r="1" fill="rgba(95,207,128,0.15)"/></svg>');
}

/* --- Text ใน hero --- */
.min-vh-hero { padding: 0; }
.hero-badge {
  display: inline-flex; align-items: center;
  background: rgba(95,207,128,.15);
  border: 1px solid rgba(95,207,128,.3);
  color: var(--accent);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
}
.hero-title {
  font-size: clamp(1.4rem, 3.5vw, 3rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin: 12px 0;
}
.hero-desc { color: rgba(255,255,255,.75); font-size: clamp(13px, 1.5vw, 16px); }
.btn-hero-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 24px; border-radius: var(--radius); font-weight: 700;
  font-size: clamp(13px, 1.5vw, 15px);
  transition: var(--transition);
}
.btn-hero-primary:hover { background: var(--accent-dark); transform: translateY(-2px); }
.btn-hero-outline {
  background: transparent; color: #fff;
  border: 2px solid rgba(255,255,255,.5);
  padding: 10px 24px; border-radius: var(--radius); font-weight: 600;
  font-size: clamp(13px, 1.5vw, 15px);
  transition: var(--transition);
}
.btn-hero-outline:hover { border-color:#fff; background:rgba(255,255,255,.1); color:#fff; }

/* Hero Cards */
.hero-card-wrap { display:flex; flex-direction:column; gap:12px; }
.hero-news-card {
  background: rgba(255,255,255,.12); backdrop-filter:blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius); padding: 16px 20px;
  animation: slideInRight .5s ease both;
}
@keyframes slideInRight { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
.hero-news-cat { font-size:11px; font-weight:700; padding:2px 10px; border-radius:50px; color:#fff; display:inline-block; margin-bottom:6px; }
.hero-news-card p { color:#fff; font-size:13px; margin:0 0 4px; }
.hero-news-card small { color:rgba(255,255,255,.6); font-size:11px; }

/* Hero Stats — ลอยอยู่ด้านล่าง */
.hero-stats {
  position: relative;
  background: #1a2a4a;
  border-top: 3px solid #1a4fa8;
  z-index: 6;
}
.stat-item {
  padding: 10px 8px;
  border-right: 1px solid rgba(255,255,255,.1);
  text-align: center;
}
.stat-num { display:block; font-size: clamp(1.2rem, 2.5vw, 2rem); font-weight:800; color:#ffffff; }
.stat-label { color:rgba(255,255,255,.75); font-size: clamp(10px, 1.2vw, 13px); }

/* --- Responsive hero padding ตามขนาดจอ --- */
@media (max-width: 767px) {
  .hero-content-wrap { padding: 40px 0 110px; }
  .hero-title { font-size: clamp(1.2rem, 5vw, 1.6rem) !important; }
  .hero-desc { font-size: 13px; }
  .hero-actions { gap: 8px !important; margin-top: 12px !important; }
  .hero-actions .btn { padding: 8px 14px; font-size: 13px; }
  .hero-badge { font-size: 11px; padding: 4px 12px; margin-bottom: 8px !important; }

  /* --- Hero Stats: 2 คอลัมน์บนมือถือ --- */
  .hero-stats .row { margin: 0; }
  .stat-item {
    padding: 14px 8px;
    border-right: 1px solid rgba(255,255,255,.12);
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  /* คอลัมน์ที่ 2 และ 4 (ขวาสุดของแต่ละแถว) ไม่มี border-right */
  .hero-stats .col-6:nth-child(2n) .stat-item,
  .hero-stats .col-6:nth-child(2n) .stat-item {
    border-right: none;
  }
  /* แถวล่าง (item ที่ 3 และ 4) ไม่มี border-bottom */
  .hero-stats .col-6:nth-child(3) .stat-item,
  .hero-stats .col-6:nth-child(4) .stat-item {
    border-bottom: none;
  }
  .stat-num { font-size: 1.5rem !important; }
  .stat-label { font-size: 11px; }
}

@media (max-width: 575px) {
  .hero-content-wrap { padding: 32px 0 100px; }
  .hero-title { font-size: clamp(1.1rem, 5.5vw, 1.4rem) !important; }
  .stat-num { font-size: 1.3rem !important; }
  .stat-label { font-size: 10px; }
  .stat-item { padding: 12px 6px; }
}


/* =====================================================
   MARQUEE
   ===================================================== */
.marquee-bar { background: var(--accent-light); border-bottom: 2px solid var(--accent); overflow:hidden; }
.marquee-label {
  background: var(--accent); color: #fff;
  padding: 10px 20px; font-size:13px; font-weight:700;
  flex-shrink:0; white-space:nowrap;
}
.marquee-content { overflow:hidden; flex:1; }
.marquee-inner { display:inline-flex; white-space:nowrap; animation:marqueeScroll 40s linear infinite; padding:10px 0; }
.marquee-inner a { color:var(--text); font-size:13px; padding:0 8px; white-space:nowrap; }
.marquee-inner a:hover { color:var(--accent); }
@keyframes marqueeScroll { from { transform:translateX(0); } to { transform:translateX(-50%); } }
.marquee-inner:hover { animation-play-state:paused; }

/* =====================================================
   SECTIONS
   ===================================================== */
.section { padding: 60px 0; }

/* ===== PAGE HERO (ใช้ร่วมกันทุกหน้า) ===== */
.page-hero {
  background: #1a4fa8;     /* #0d2248  สีนำเงินเข้ม*/
  padding: 48px 0;
  text-align: center;
  scroll-margin-top: 90px;
}
.page-hero h1 { color: #fff; font-size: 2rem; font-weight: 800; }
.page-hero p  { color: rgba(255,255,255,.75); }
.page-hero .breadcrumb-item a { color: rgba(255,255,255,.7); }
.page-hero .breadcrumb-item.active,
.page-hero .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.5); }
.main { scroll-margin-top: 90px; }
.light-background { background: var(--bg-light); }
.section-title { font-size:1.8rem; font-weight:800; color:var(--heading); margin:0 0 4px; }
.section-subtitle { color:var(--text-muted); font-size:14px; margin:0; }
.section-header-inline { display:flex; justify-content:space-between; align-items:center; }

/* =====================================================
   NEWS CARDS
   ===================================================== */
.news-card-main {
  border-radius: var(--radius); overflow:hidden;
  box-shadow: var(--shadow-sm); background:#fff;
  transition: var(--transition);
  border: 1px solid #eee;
}
.news-card-main:hover { box-shadow:var(--shadow); transform:translateY(-3px); }
.news-card-img { position:relative; aspect-ratio:16/9; overflow:hidden; }
.news-card-img img { width:100%; height:100%; object-fit:cover; transition:transform .4s ease; }
.news-card-main:hover .news-card-img img { transform:scale(1.05); }
.news-img-placeholder {
  width:100%; height:100%;
  background: linear-gradient(135deg, var(--accent-light), #d4f5e2);
  display:flex; align-items:center; justify-content:center;
  font-size:3rem; color:var(--accent); opacity:.6;
  min-height: 200px;
}
.news-cat-badge {
  position:absolute; top:12px; left:12px;
  color:#fff; font-size:11px; font-weight:700;
  padding:4px 12px; border-radius:50px;
}
.news-card-body { padding:20px; }
.news-meta { font-size:12px; color:var(--text-muted); margin-bottom:8px; }
.news-title { font-size:1.1rem; font-weight:700; line-height:1.4; margin-bottom:10px; }
.news-title a { color:var(--heading); }
.news-title a:hover { color:var(--accent); }
.news-excerpt { font-size:14px; color:var(--text-muted); margin-bottom:12px; }
.btn-read-more { color:var(--accent); font-weight:700; font-size:13px; }
.btn-read-more:hover { color:var(--accent-dark); }

/* News list card */
.news-card-list {
  background:#fff; border-radius:var(--radius-sm); padding:12px;
  border:1px solid #eee; transition:var(--transition);
}
.news-card-list:hover { box-shadow:var(--shadow-sm); border-color:var(--accent); }
.news-list-img { width:110px; height:85px; border-radius:var(--radius-sm); overflow:hidden; flex-shrink:0; }
.news-list-img img { width:100%; height:100%; object-fit:cover; }
.news-img-placeholder-sm { width:100%;height:100%;background:var(--accent-light);display:flex;align-items:center;justify-content:center;color:var(--accent);font-size:1.5rem; }
.news-list-body h5 { font-size:13px; margin:4px 0; line-height:1.4; }
.news-list-body h5 a { color:var(--heading); }
.news-list-body h5 a:hover { color:var(--accent); }
.news-cat-sm { font-size:11px; font-weight:700; }

.news-card { border-radius:var(--radius); overflow:hidden; background:#fff; border:1px solid #eee; transition:var(--transition); }
.news-card:hover { box-shadow:var(--shadow); transform:translateY(-3px); }
.news-card-img-sm { position:relative; aspect-ratio:16/9; overflow:hidden; }
.news-card-img-sm img { width:100%;height:100%;object-fit:cover;transition:transform .4s; }
.news-card:hover .news-card-img-sm img { transform:scale(1.05); }
.news-card h5 { font-size:14px; font-weight:700; }
.news-card h5 a { color:var(--heading); }
.news-card h5 a:hover { color:var(--accent); }

/* =====================================================
   ANNOUNCEMENTS
   ===================================================== */
.announcement-list { display:flex; flex-direction:column; gap:2px; }
.ann-item { padding:12px 16px; border-radius:var(--radius-sm); background:#fff; border:1px solid #eee; transition:var(--transition); }
.ann-item:hover { border-color:var(--accent); background:var(--accent-light); }
.ann-icon {
  width:36px;height:36px; border-radius:50%; background:var(--accent-light);
  color:var(--accent); display:flex;align-items:center;justify-content:center;
  font-size:16px; flex-shrink:0;
}
.ann-icon.important { background:#fff3cd; color:#f0a500; }
.ann-cat { font-size:10px; background:var(--accent-light); color:var(--accent); border:none; }
.ann-title { display:block; color:var(--heading); font-weight:600; font-size:14px; margin:4px 0 2px; }
.ann-title:hover { color:var(--accent); }
.ann-date { font-size:11px; color:var(--text-muted); }

/* =====================================================
   JOURNALS
   ===================================================== */
.journal-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.journal-card { display:flex; gap:12px; background:#fff; border-radius:var(--radius-sm); border:1px solid #eee; padding:12px; transition:var(--transition); }
.journal-card:hover { box-shadow:var(--shadow-sm); border-color:var(--accent); }
.journal-cover { width:60px; height:80px; border-radius:var(--radius-sm); overflow:hidden; flex-shrink:0; }
.journal-cover img { width:100%;height:100%;object-fit:cover; }
.journal-cover-placeholder { width:100%;height:100%;background:linear-gradient(135deg,var(--accent),var(--accent-dark));display:flex;align-items:center;justify-content:center;color:#fff;font-size:1.5rem; }
.journal-info h6 { font-size:13px;margin:0 0 4px; }
.journal-info h6 a { color:var(--heading); }
.journal-info h6 a:hover { color:var(--accent); }
.journal-info small { font-size:11px; }

/* =====================================================
   DEPARTMENTS
   ===================================================== */
.dept-card {
  background:#fff; border-radius:var(--radius); padding:20px 16px;
  border:1px solid #eee; text-decoration:none; transition:var(--transition);
}
.dept-card:hover { box-shadow:var(--shadow); border-color:var(--accent); transform:translateY(-4px); }
.dept-icon {
  width:52px;height:52px; border-radius:var(--radius); margin:0 auto 12px;
  background:var(--accent-light); color:var(--accent);
  display:flex;align-items:center;justify-content:center; font-size:22px;
  transition:var(--transition);
}
.dept-card:hover .dept-icon { background:var(--accent); color:#fff; }
.dept-name { font-size:13px;font-weight:700;color:var(--heading);margin:0 0 4px;line-height:1.3; }
.dept-phone { font-size:11px; color:var(--text-muted); }

/* =====================================================
   QUICK LINKS
   ===================================================== */
.quick-link-card { padding:20px 10px; border-radius:var(--radius); background:#fff; border:1px solid #eee; transition:var(--transition); text-decoration:none; }
.quick-link-card:hover { box-shadow:var(--shadow); transform:translateY(-4px); }
.quick-link-icon { width:56px;height:56px;border-radius:var(--radius);margin:0 auto 12px;display:flex;align-items:center;justify-content:center;font-size:24px;transition:var(--transition); }
.quick-link-card:hover .quick-link-icon { transform:scale(1.1); }
.quick-link-label { font-size:14px;font-weight:700;color:var(--heading); }
.quick-link-sub { font-size:11px;color:var(--text-muted); }

/* =====================================================
   FOOTER
   ===================================================== */
.footer { background:var(--dark); color:rgba(255,255,255,.75); }
.footer-top { padding: 50px 0 30px; }
.footer-heading { color:#fff;font-weight:700;font-size:15px;margin-bottom:16px;position:relative;padding-bottom:10px; }
.footer-heading::after { content:'';position:absolute;bottom:0;left:0;width:32px;height:2px;background:var(--accent); }
.footer-links { list-style:none;padding:0;margin:0; }
.footer-links li { margin-bottom:8px; }
.footer-links a { color:rgba(255,255,255,.6);font-size:14px;transition:var(--transition); }
.footer-links a:hover { color:var(--accent);padding-left:4px; }
.footer-desc { font-size:13px;color:rgba(255,255,255,.6);line-height:1.7;margin-bottom:12px; }
.footer-contact div { font-size:13px;margin-bottom:6px; }
.footer-social .social-btn { width:36px;height:36px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff !important;transition:var(--transition);border:none;font-size:18px;text-decoration:none; }
.footer-social .social-btn:hover { transform:scale(1.15);opacity:.85;color:#fff !important; }
.footer-social .social-btn.social-fb { background:#1877f2; }
.footer-social .social-btn.social-yt { background:#ff0000; }
.footer-social .social-btn.social-ln { background:#06c755; }
.footer-news { list-style:none;padding:0;margin:0; }
.footer-news li { margin-bottom:10px; }
.footer-news a { color:rgba(255,255,255,.6);font-size:13px;line-height:1.4;transition:var(--transition); }
.footer-news a:hover { color:var(--accent); }
.footer-bottom { padding:16px 0;border-top:1px solid rgba(255,255,255,.08);font-size:13px;color:rgba(255,255,255,.4); }

/* Back to Top */
.back-to-top {
  position:fixed; bottom:24px;right:24px; width:40px;height:40px;
  background:var(--accent);color:#fff;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  box-shadow:var(--shadow); z-index:999; font-size:16px;
  opacity:0;pointer-events:none;transition:var(--transition);
}
.back-to-top.show { opacity:1;pointer-events:all; }
.back-to-top:hover { background:var(--accent-dark);color:#fff;transform:translateY(-3px); }

/* ซ่อนปุ่มปิด drawer บน desktop */
.navmenu-close { display: none; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
/* nav-overlay — JS จัดการ display และ z-index ทั้งหมดแล้ว */
#nav-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9998;
  cursor: pointer;
}

/* ซ่อนเมนูและแสดงปุ่ม hamburger เมื่อจอเล็กกว่า 1200px */
@media (max-width: 1199px) {
  .mobile-nav-toggle { display:flex !important; align-items:center; justify-content:center; }

  .navmenu {
    position: fixed; top: 0; right: -300px; width: 280px; height: 100vh;
    background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.15);
    z-index: 9999; padding: 0; overflow-y: auto; overflow-x: hidden; transition: right .3s ease;
  }
  .navmenu.active { right: 0; }

  /* ปุ่มปิด drawer บน mobile */
  .navmenu-close {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 14px; right: 14px;
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: rgba(255,255,255,.9); color: var(--heading);
    font-size: 18px; cursor: pointer; z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: background .2s;
    visibility: hidden;
  }
  .navmenu-close.visible {
    visibility: visible;
  }
  .navmenu-close:hover { background: var(--accent-light); color: var(--accent); }

  /* Header ด้านบนของ drawer — ใช้ nav::before แทน ul เพื่อไม่ให้ขัดกับปุ่ม X */
  .navmenu::before {
    content: 'เมนูหลัก';
    display: block;
    padding: 18px 56px 10px 20px;
    font-weight: 800;
    font-size: 14px;
    color: var(--heading);
    border-bottom: 2px solid var(--accent);
    margin-bottom: 0;
  }

  .navmenu ul { flex-direction: column; padding: 8px 0; }
  .navmenu ul li a { padding: 10px 20px; border-radius: 0; }

  .navmenu .dropdown ul {
    position: static; box-shadow: none; border: none; border-left: 3px solid var(--accent);
    background: var(--bg-light); display: none; flex-direction: column;
    padding: 4px 0; margin: 0 0 0 16px; z-index: auto;
  }
  .navmenu .dropdown.open > ul { display: flex; }
  .navmenu .dropdown.open > a > .toggle-dropdown { transform: rotate(180deg); }
  .toggle-dropdown { transition: transform .2s; }
  /* Mobile: has-sub แสดงเยื้องซ้าย แทนออกด้านขวา */
  .navmenu .dropdown ul li.has-sub > ul {
    position: static; left: auto; top: auto;
    border-left: 3px solid var(--accent); border-top: none;
    margin: 0 0 0 16px; box-shadow: none;
  }
  .navmenu .dropdown ul li.has-sub.open > ul { display: flex; }

  .header-search { display: none !important; }
  .journal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .section { padding: 40px 0; }
  .hero-title { font-size: 1.5rem !important; line-height: 1.3; }
  .hero-desc { font-size: 14px; }
  .hero-badge { font-size: 11px; padding: 4px 12px; }
  .hero-actions .btn { padding: 10px 18px; font-size: 14px; }
  .min-vh-hero { min-height: auto; padding: 40px 0 120px; }
  /* ความสูง swiper บนมือถือ */
  .hero-swiper, #hero { min-height: unset; }
  .hero-swiper .swiper-slide img { max-height: 220px; }
}

/* ===== NEW Badge กระพริบ ===== */
.badge-new {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 2px 7px;
    border-radius: 20px;
    background: #e63946;
    color: #fff;
    animation: blink-new 1.2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes blink-new {
    0%, 100% { opacity: 1; }
    50%       { opacity: .25; }
}

/* เวลาโพสต์ + views ใน ann-item (หน้าแรก) */
.ann-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ===== Journal Photo Grid (หน้าแรก) ===== */
.journal-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.journal-photo-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    overflow: hidden;
    transition: var(--transition);
}
.journal-photo-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--accent);
    transform: translateY(-3px);
}
.journal-photo-lightbox,
.journal-photo-placeholder {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.41;
    overflow: hidden;
    background: #f4f4f4;
    text-decoration: none;
}
.journal-photo-lightbox img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform .35s ease;
}
.journal-photo-card:hover .journal-photo-lightbox img {
    transform: scale(1.05);
}
.journal-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s;
}
.journal-photo-overlay i {
    color: #fff;
    font-size: 1.8rem;
    opacity: 0;
    transform: scale(.7);
    transition: opacity .25s, transform .25s;
}
.journal-photo-card:hover .journal-photo-overlay {
    background: rgba(0,0,0,.35);
}
.journal-photo-card:hover .journal-photo-overlay i {
    opacity: 1;
    transform: scale(1);
}
.journal-photo-placeholder {
    align-items: center;
    justify-content: center;
    display: flex;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-size: 3rem;
}
.journal-photo-caption {
    padding: 10px 12px 12px;
}
.journal-photo-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
    text-decoration: none;
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.journal-photo-title:hover { color: var(--accent); }
.journal-photo-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

@media (max-width: 576px) {
  .journal-photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero-title { font-size: 1.3rem !important; }
  .hero-desc { font-size: 13px; }
  .min-vh-hero { padding: 32px 0 110px; }
  .hero-actions { gap: 8px !important; }
  .hero-actions .btn { padding: 8px 14px; font-size: 13px; }
}
/* =====================================================
   MOBILE FIX — แก้ปัญหาตัวหนังสือทับบนจอมือถือ
   ===================================================== */

/* --- Topbar บน mobile: ซ่อน text, ให้ปุ่มไม่ล้น --- */
@media (max-width: 575px) {
  .topbar .btn {
    font-size: 11px;
    padding: 3px 8px;
  }
  .topbar .btn i {
    margin-right: 0 !important;
  }
  .topbar .btn span,
  .topbar .btn-sm .text-label {
    display: none;
  }
  .divider-v {
    display: none;
  }
}

/* --- Header บน mobile: ป้องกันโลโก้ + hamburger ทับกัน --- */
@media (max-width: 575px) {
  #header .container-fluid {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .logo {
    min-width: 0;
    flex: 1 1 auto;
  }
  .logo-text {
    min-width: 0;
  }
  .logo-text .logo-sub {
    display: block;
    font-size: 9.5px;
    line-height: 1.25;
    white-space: normal;
    color: var(--text-muted);
  }
  .logo-title {
    font-size: 13px;
  }
  .logo-icon,
  #header .logo img {
    width: 36px !important;
    height: 36px !important;
  }
  .mobile-nav-toggle {
    font-size: 24px;
    padding: 2px 6px;
    flex-shrink: 0;
  }
}
/* ===== Icon สีขาวเมื่ออยู่ใน dark widget ===== */
[style*="background:linear-gradient(135deg,#0d2248"] .text-accent,
[style*="background: linear-gradient(135deg, #0d2248"] .text-accent {
  color: rgba(255,255,255,.85) !important;
}
[style*="background:linear-gradient(135deg,#0d2248"] a,
[style*="background: linear-gradient(135deg, #0d2248"] a {
  color: rgba(255,255,255,.8);
}
[style*="background:linear-gradient(135deg,#0d2248"] a:hover,
[style*="background: linear-gradient(135deg, #0d2248"] a:hover {
  color: #fff;
}

/* ============================================================
   styles_reports_innovations.css
   วางต่อท้ายไฟล์ assets/css/main.css
   ============================================================ */

/* ===== REPORT CARDS ===== */
.report-card {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    transition: transform .25s ease, box-shadow .25s ease;
    background: #fff;
}
.report-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(26,79,168,.18);
    color: inherit;
}
.report-card-cover {
    position: relative;
    width: 100%;
    padding-top: 133%; /* สัดส่วน A4 */
    background: #f0f4ff;
    overflow: hidden;
}
.report-card-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.report-card:hover .report-card-cover img {
    transform: scale(1.05);
}
.report-no-cover {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #dce8f8 0%, #f0f4ff 100%);
    padding: 16px;
    text-align: center;
}
.report-no-cover i {
    font-size: 3rem;
    color: #1a4fa8;
    opacity: .6;
}
.report-no-cover span {
    font-size: 12px;
    color: #1a4fa8;
    font-weight: 600;
    line-height: 1.4;
}
.report-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26,79,168,.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity .25s ease;
    color: #fff;
}
.report-card-overlay i { font-size: 2rem; }
.report-card-overlay span { font-size: 14px; font-weight: 700; }
.report-card:hover .report-card-overlay { opacity: 1; }
.report-year-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(26,79,168,.9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}
.report-card-body {
    padding: 12px;
}
.report-cat {
    font-size: 11px;
    font-weight: 600;
    color: #1a4fa8;
    margin-bottom: 4px;
}
.report-title {
    font-size: 13px;
    font-weight: 700;
    color: #0d2248;
    line-height: 1.45;
    margin-bottom: 6px;
    min-height: 2.9em;
}
.report-dl {
    font-size: 11px;
    color: #888;
}

/* ===== INNOVATION CARDS ===== */
.inno-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0,0,0,.07);
    transition: transform .25s ease, box-shadow .25s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.inno-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 36px rgba(0,0,0,.14);
}
.inno-cover {
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
    flex-shrink: 0;
}
.inno-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.inno-card:hover .inno-cover img { transform: scale(1.06); }
.inno-no-cover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inno-cat-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}
.inno-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.inno-title {
    font-size: 13px;
    font-weight: 700;
    color: #0d2248;
    line-height: 1.5;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.inno-author {
    font-size: 12px;
    color: #1a4fa8;
    font-weight: 600;
    margin-bottom: 2px;
}
.inno-school {
    font-size: 11px;
    color: #666;
    font-weight: 400;
    margin-top: 2px;
}
.inno-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
    font-size: 11px;
    color: #888;
}
.inno-meta span {
    background: #f3f4f6;
    border-radius: 20px;
    padding: 2px 8px;
}
.inno-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}
.inno-hits {
    font-size: 11px;
    color: #aaa;
}
.inno-btn-dl {
    font-size: 12px;
    font-weight: 700;
    color: #e8520a;
    text-decoration: none;
    padding: 4px 12px;
    border: 1.5px solid #e8520a;
    border-radius: 20px;
    transition: background .2s, color .2s;
}
.inno-btn-dl:hover {
    background: #e8520a;
    color: #fff;
}

/* ===== Responsive ===== */
@media (max-width: 576px) {
    .report-card-body { padding: 8px; }
    .report-title { font-size: 12px; }
    .inno-body { padding: 10px; }
    .inno-title { font-size: 12px; }
}

/* ===== ป้าย NEW กระพริบ (ใช้ร่วมกันทั้งเว็บ: หน้าแรก, ประกาศ, ข่าว) ===== */
.badge-new-blink{display:inline-block;background:#e63946;color:#fff;font-size:10px;font-weight:800;padding:2px 8px;border-radius:50px;margin-left:6px;letter-spacing:.5px;animation:newBlink 1.1s ease-in-out infinite;}
@keyframes newBlink{0%,100%{opacity:1;}50%{opacity:.35;}}

/* ===== ป้าย "สำคัญ" สีแดง (ใช้ร่วมกัน: หน้าแรก, ประกาศ) ===== */
.badge-important{display:inline-block;background:#e63946;color:#fff;font-size:11px;font-weight:700;padding:3px 10px;border-radius:50px;margin-left:4px;}

/* ===== ข่าววิ่ง (Marquee) ประกาศ หน้าแรก ===== */
.marquee-bar { background: var(--accent-light); border-bottom: 2px solid var(--accent); overflow: hidden; }
.marquee-label { background: var(--accent); color: #fff; padding: 10px 20px; font-size: 13px; font-weight: 700; flex-shrink: 0; white-space: nowrap; }
.marquee-content { overflow: hidden; flex: 1; }
.marquee-inner { display: inline-flex; white-space: nowrap; animation: marqueeScroll 40s linear infinite; padding: 10px 0; }
.marquee-inner a { color: var(--text); font-size: 13px; padding: 0 8px; white-space: nowrap; text-decoration: none; }
.marquee-inner a:hover { color: var(--accent); }
.marquee-inner:hover { animation-play-state: paused; }
@keyframes marqueeScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-inner.marquee-static { animation: none; }
