/* ============================================================
   ITA / OIT — สำนักงานส่งเสริมการเรียนรู้ประจำจังหวัดน่าน
   style.css
   ============================================================ */

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

:root {
  --blue-dark:   #0C447C;
  --blue-mid:    #185FA5;
  --blue-light:  #378ADD;
  --blue-bg:     #E6F1FB;
  --blue-bg2:    #B5D4F4;
  --green-dark:  #27500A;
  --green-mid:   #3B6D11;
  --green-light: #639922;
  --green-bg:    #EAF3DE;
  --green-bg2:   #C0DD97;
  --gray-900:    #1a1a2e;
  --gray-800:    #2c2c3a;
  --gray-600:    #6b6b80;
  --gray-200:    #e8e8f0;
  --gray-100:    #f4f4f8;
  --white:       #ffffff;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --font:        'Sarabun', 'TH Sarabun New', sans-serif;
  --font-serif:  'Noto Serif Thai', serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--gray-900);
  background: var(--gray-100);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── HEADER ── */
.site-header {
  background: linear-gradient(135deg, #0C447C 0%, #185FA5 50%, #1A6FBD 100%);
  color: white;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(12,68,124,0.3);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-abbr { font-family: var(--font-serif); font-size: 16px; font-weight: 700; line-height: 1.1; }
.brand-full { font-size: 11px; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.year-chip {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  white-space: nowrap;
}

/* ── HERO ── */
.hero {
  background: linear-gradient(160deg, #0a3258 0%, #185FA5 45%, #1a7abf 100%);
  color: white;
  padding: 3rem 1.5rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero-bg-pattern {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.04) 0%, transparent 40%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 30px;
  background: var(--gray-100);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.hero-content {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}
.hero-badges { display: flex; gap: 8px; justify-content: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.badge-pill {
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.badge-pill.blue { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35); }
.badge-pill.green { background: rgba(99,200,34,0.2); border: 1px solid rgba(99,200,34,0.4); }
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}
.hero-sub { font-size: 14px; opacity: 0.75; margin-bottom: 2rem; letter-spacing: 0.5px; }
.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}
.hstat { padding: 12px 24px; text-align: center; }
.hstat-div { width: 1px; height: 40px; background: rgba(255,255,255,0.2); }
.hstat-n { display: block; font-family: var(--font-serif); font-size: 24px; font-weight: 700; line-height: 1; }
.hstat-l { display: block; font-size: 11px; opacity: 0.75; margin-top: 2px; }

/* ── NAV ── */
.main-nav {
  background: var(--white);
  border-bottom: 1.5px solid var(--gray-200);
  position: sticky;
  top: 60px;
  z-index: 99;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  padding: 0 1rem;
  overflow-x: auto;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--gray-600);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav-btn:hover { color: var(--blue-mid); background: var(--blue-bg); }
.nav-btn.active { color: var(--blue-mid); border-bottom-color: var(--blue-mid); font-weight: 500; }

/* ── MAIN ── */
.page-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── ANNOUNCE ── */
.announce-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #EAF3DE;
  border: 1px solid #C0DD97;
  border-left: 4px solid var(--green-mid);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--green-dark);
  margin-bottom: 1.75rem;
}

/* ── SECTION GROUP ── */
.section-group { margin-bottom: 2.5rem; }
.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}
.blue-head { background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%); color: white; }
.green-head { background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%); color: white; }
.section-num {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.section-heading { font-size: 18px; font-weight: 600; margin-bottom: 2px; }
.section-desc { font-size: 13px; opacity: 0.8; }

/* ── CARD ROW ── */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.cat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.cat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cat-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.blue-top { background: var(--blue-bg); border-bottom: 1px solid var(--blue-bg2); }
.green-top { background: var(--green-bg); border-bottom: 1px solid var(--green-bg2); }
.cat-code { font-weight: 600; font-size: 14px; color: var(--blue-dark); min-width: 28px; }
.green-top .cat-code { color: var(--green-dark); }
.cat-name { font-size: 14px; font-weight: 500; color: var(--blue-dark); line-height: 1.3; }
.green-top .cat-name { color: var(--green-dark); }
.link-list { list-style: none; padding: 6px 0; }
.link-list li + li { border-top: 1px solid var(--gray-100); }
.doc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--gray-800);
  transition: background 0.12s, color 0.12s;
}
.doc-link:hover { background: var(--gray-100); color: var(--blue-mid); }
.doc-icon { font-size: 13px; flex-shrink: 0; }
.tag-year {
  display: inline-block;
  background: var(--blue-bg);
  color: var(--blue-dark);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.tag-online {
  display: inline-block;
  background: var(--green-bg);
  color: var(--green-dark);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}

/* ── DETAIL TAB ── */
.detail-search {
  position: relative;
  margin-bottom: 1.5rem;
}
.detail-search input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s;
}
.detail-search input:focus { outline: none; border-color: var(--blue-light); }
.detail-search svg {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gray-600); pointer-events: none;
}
.detail-group { margin-bottom: 2rem; }
.detail-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--gray-200);
}
.dg-badge {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.blue-badge { background: var(--blue-bg); color: var(--blue-dark); }
.green-badge { background: var(--green-bg); color: var(--green-dark); }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.detail-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
.detail-card:hover {
  border-color: var(--blue-light);
  box-shadow: 0 2px 12px rgba(24,95,165,0.12);
  transform: translateY(-1px);
}
.dc-code {
  width: 38px; height: 38px;
  background: var(--blue-bg);
  color: var(--blue-dark);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.green-code { background: var(--green-bg); color: var(--green-dark); }
.dc-body { flex: 1; min-width: 0; }
.dc-title { font-size: 13.5px; font-weight: 500; color: var(--gray-900); line-height: 1.35; }
.dc-desc { font-size: 11.5px; color: var(--gray-600); margin-top: 2px; line-height: 1.4; }
.dc-arrow { color: var(--blue-light); font-size: 16px; flex-shrink: 0; opacity: 0.6; transition: opacity 0.15s; }
.detail-card:hover .dc-arrow { opacity: 1; }
.no-result { text-align: center; padding: 3rem; color: var(--gray-600); font-size: 14px; }

/* ── CONTACT ── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.contact-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.contact-icon { font-size: 32px; margin-bottom: 12px; }
.contact-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.contact-card > p { font-size: 13px; color: var(--gray-600); margin-bottom: 16px; }
.contact-info { display: flex; flex-direction: column; gap: 8px; }
.ci-row { display: flex; gap: 12px; font-size: 13.5px; }
.ci-label { color: var(--gray-600); min-width: 64px; flex-shrink: 0; }
.ci-row a { color: var(--blue-mid); }
.ci-row a:hover { text-decoration: underline; }
.contact-btn {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 8px 20px;
  background: var(--blue-mid);
  color: white;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}
.contact-btn:hover { background: var(--blue-dark); }

/* ── FOOTER ── */
.site-footer {
  background: var(--gray-800);
  color: rgba(255,255,255,0.75);
  padding: 1.5rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.footer-brand strong { color: white; font-size: 14px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { font-size: 12.5px; color: rgba(255,255,255,0.6); transition: color 0.15s; }
.footer-links a:hover { color: white; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .brand-full { display: none; }
  .hero { padding: 2rem 1rem 2rem; }
  .hero-stats { flex-direction: column; align-items: stretch; width: 100%; }
  .hstat-div { width: 80%; height: 1px; margin: 0 auto; }
  .hstat { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; }
  .hstat-n { font-size: 20px; }
  .page-main { padding: 1.25rem 1rem 2.5rem; }
  .cards-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
}
