@import url('fonts.css');

/* ============================================================
   assets/css/style.css
   กลุ่มส่งเสริมการศึกษาทางไกล เทคโนโลยีสารสนเทศและการสื่อสาร
   โทนสี: ราชการไทย – น้ำเงิน/ทอง
============================================================ */

:root {
  --font-body:    'Tahoma', 'Arial', sans-serif;
  --font-heading: 'Tahoma', 'Arial', sans-serif;
}

/* ──── CSS Variables ──── */
:root {
  --primary:       #0d3b7a;
  --primary-dark:  #092a5a;
  --primary-light: #1a5bb8;
  --accent:        #c8a84b;
  --accent-light:  #e8c96d;
  --secondary:     #e8f0fb;
  --text-main:     #1a1a2e;
  --text-muted:    #6b7280;
  --bg-body:       #f4f6fb;
  --bg-card:       #ffffff;
  --border:        #dde3ef;
  --shadow-sm:     0 2px 8px rgba(13,59,122,.08);
  --shadow-md:     0 4px 20px rgba(13,59,122,.13);
  --shadow-lg:     0 8px 40px rgba(13,59,122,.18);
  --radius:        10px;
  --radius-lg:     16px;
  --transition:    .25s ease;
  --font-body:     'Sarabun', 'TH Sarabun New', 'Tahoma', sans-serif;
  --font-heading:  'Prompt', 'TH Sarabun New', 'Tahoma', sans-serif;
}

/* ──── Reset & Base ──── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-main);
  background: var(--bg-body);
  line-height: 1.7;
}
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); font-weight: 600; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; height: auto; }

/* ──── Top Bar ──── */
.topbar {
  background: var(--primary-dark);
  color: rgba(255,255,255,.82);
  font-size: .82rem;
  padding: 6px 0;
  border-bottom: 2px solid var(--accent);
}
.topbar a { color: rgba(255,255,255,.82); }
.topbar a:hover { color: var(--accent-light); }
.topbar .divider { margin: 0 8px; opacity: .4; }

/* ──── Header ──── */
.site-header {
  background: var(--primary);
  padding: 14px 0;
  box-shadow: 0 3px 12px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-logo { display: flex; align-items: center; gap: 14px; }
.site-logo img { width: 56px; height: 56px; object-fit: contain; }
.logo-placeholder {
  width: 56px; height: 56px;
  background: rgba(255,255,255,.15);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 22px;
}
.logo-text { color: #fff; }
.logo-text .title { font-size: 1rem; font-weight: 600; font-family: var(--font-heading); line-height: 1.3; }
.logo-text .subtitle { font-size: .75rem; opacity: .8; }

/* ──── Navbar ──── */
.main-nav { background: var(--primary-dark); }
.main-nav .navbar { padding: 0; }
.main-nav .nav-link {
  color: rgba(255,255,255,.88) !important;
  font-weight: 500;
  font-size: .92rem;
  padding: 13px 18px !important;
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
}
.main-nav .nav-link:hover,
.main-nav .nav-link.active {
  color: var(--accent-light) !important;
  border-bottom-color: var(--accent);
  background: rgba(255,255,255,.07);
}
.main-nav .navbar-toggler { border-color: rgba(255,255,255,.3); }
.main-nav .navbar-toggler-icon { filter: invert(1); }

/* ──── Hero / Slider ──── */
.hero-slider { position: relative; overflow: hidden; }
.hero-slider .carousel-item {
  height: 440px;
  min-height: 440px; /* ← IIS fix: บังคับให้มี height เสมอ */
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  position: relative;
  display: block !important; /* ← ป้องกัน display:none จาก Bootstrap ขณะ init */
}
.hero-slider .carousel-item.active { display: block !important; }
.hero-slider .slide-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; opacity: .35;
}
.slide-pattern {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 80% 50%, rgba(200,168,75,.12) 0%, transparent 60%),
    linear-gradient(45deg, transparent 40%, rgba(255,255,255,.03) 41%, rgba(255,255,255,.03) 50%, transparent 51%);
  background-size: auto, 30px 30px;
  z-index: 1;
}
/* Decorative geometric shape (แสดงแม้ไม่มีรูปภาพ) */
.slide-deco {
  position: absolute;
  right: -40px; top: -40px;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  border: 60px solid rgba(255,255,255,.04);
  z-index: 1;
}
.slide-deco::after {
  content: '';
  position: absolute;
  right: -80px; bottom: -80px;
  width: 250px; height: 250px;
  border-radius: 50%;
  border: 40px solid rgba(200,168,75,.1);
}
.hero-slider .carousel-caption {
  position: absolute; top: 50%; transform: translateY(-50%);
  left: 6%; right: 42%; text-align: left;
  bottom: unset;
  z-index: 5;
}
.hero-slider .carousel-caption h2 {
  font-size: 2rem; font-weight: 700; color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  margin-bottom: 12px; line-height: 1.35;
}
.hero-slider .carousel-caption p {
  font-size: 1.05rem; color: rgba(255,255,255,.88);
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.hero-slider .carousel-caption .btn {
  margin-top: 16px;
  background: var(--accent); color: var(--primary-dark);
  border: none; font-weight: 600; padding: 9px 26px;
  border-radius: 50px;
}
.hero-slider .carousel-indicators [data-bs-target] {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255,255,255,.5);
}
.hero-slider .carousel-indicators .active { background: var(--accent); }
.hero-slider .carousel-control-prev,
.hero-slider .carousel-control-next { width: 50px; z-index: 10; }
.hero-slider .carousel-control-prev-icon,
.hero-slider .carousel-control-next-icon {
  background-color: rgba(13,59,122,.55);
  border-radius: 50%;
  padding: 18px;
  background-size: 50%;
}

/* ──── Section Titles ──── */
.section-title {
  font-size: 1.5rem; color: var(--primary);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}
.section-title i { color: var(--accent); }
.section-title .view-all {
  font-size: .85rem; font-weight: 400;
  margin-left: auto; color: var(--primary-light);
}
.section-title .view-all:hover { color: var(--accent); }

/* ──── Cards ──── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  overflow: hidden;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.card-img-top {
  height: 190px; object-fit: cover;
  background: var(--secondary);
}
.card-img-placeholder {
  height: 190px;
  background: linear-gradient(135deg, var(--secondary) 0%, #c8d9f0 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--primary); opacity: .4;
}
.card .card-body { padding: 18px; }
.card .card-title {
  font-size: 1rem; font-weight: 600;
  color: var(--primary-dark); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card .card-text { font-size: .88rem; color: var(--text-muted); }
.card .card-date { font-size: .8rem; color: var(--text-muted); }

/* Badges */
.badge-news     { background: #e3f0ff; color: #0a5292; }
.badge-announce { background: #fff3cd; color: #856404; }
.badge-activity { background: #d1fae5; color: #065f46; }
.badge-cat {
  display: inline-block; padding: 3px 10px;
  border-radius: 50px; font-size: .75rem; font-weight: 600;
  margin-bottom: 8px;
}

/* ──── News List (sidebar style) ──── */
.news-list-item {
  display: flex; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}
.news-list-item:last-child { border-bottom: none; }
.news-list-item:hover .news-list-title { color: var(--primary-light); }
.news-list-thumb {
  width: 80px; height: 70px; flex-shrink: 0;
  object-fit: cover; border-radius: 8px;
  background: var(--secondary);
}
.news-list-placeholder {
  width: 80px; height: 70px; flex-shrink: 0;
  border-radius: 8px;
  background: var(--secondary);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); opacity: .5; font-size: 1.5rem;
}
.news-list-title {
  font-size: .92rem; font-weight: 600; color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
}
.news-list-meta { font-size: .78rem; color: var(--text-muted); }

/* ──── Quick Links / Stats ──── */
.quick-links { background: var(--primary); padding: 28px 0; }
.quick-link-item {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  color: rgba(255,255,255,.9);
  padding: 18px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,.12);
}
.quick-link-item:hover {
  background: rgba(255,255,255,.2);
  color: var(--accent-light);
  transform: translateY(-3px);
  text-decoration: none;
}
.quick-link-item i { font-size: 2rem; margin-bottom: 8px; }
.quick-link-item span { font-size: .88rem; font-weight: 500; }

/* ──── Download Table ──── */
.download-table tbody tr:hover { background: var(--secondary); }
.download-table .file-icon { font-size: 1.4rem; }
.file-icon.pdf   { color: #e53e3e; }
.file-icon.docx,
.file-icon.doc   { color: #2b6cb0; }
.file-icon.xlsx,
.file-icon.xls   { color: #276749; }
.file-icon.pptx,
.file-icon.ppt   { color: #c05621; }
.file-icon.zip,
.file-icon.rar   { color: #744210; }

/* ──── Contact ──── */
.contact-info-card {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 30px;
}
.contact-info-card h5 { color: var(--accent-light); margin-bottom: 20px; font-size: 1.1rem; }
.contact-info-item { display: flex; gap: 14px; margin-bottom: 16px; align-items: flex-start; }
.contact-info-item i { font-size: 1.1rem; color: var(--accent); margin-top: 3px; width: 20px; }
.contact-info-item span { font-size: .92rem; opacity: .9; }

/* ──── Page Hero ──── */
.page-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 40px 0 30px;
  position: relative; overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.page-hero h1 { color: #fff; font-size: 1.7rem; margin-bottom: 6px; }
.page-hero .breadcrumb { background: none; padding: 0; margin: 0; }
.page-hero .breadcrumb-item,
.page-hero .breadcrumb-item a,
.page-hero .breadcrumb-item.active { color: rgba(255,255,255,.75); font-size: .85rem; }
.page-hero .breadcrumb-item.active { color: var(--accent-light); }
.page-hero .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.4); }

/* ──── Pagination ──── */
.pagination .page-link {
  color: var(--primary);
  border-color: var(--border);
}
.pagination .page-link:hover { background: var(--secondary); border-color: var(--primary); }
.pagination .page-item.active .page-link {
  background: var(--primary); border-color: var(--primary);
}

/* ──── Buttons ──── */
.btn-primary {
  background: var(--primary); border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent {
  background: var(--accent); color: var(--primary-dark);
  border-color: var(--accent); font-weight: 600;
}
.btn-accent:hover { background: var(--accent-light); border-color: var(--accent-light); color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); }

/* ──── Forms ──── */
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 .2rem rgba(13,59,122,.18);
}
.form-label { font-weight: 500; font-size: .92rem; color: var(--primary-dark); }

/* ──── About Page ──── */
.mission-card {
  border-left: 4px solid var(--accent);
  background: var(--secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.vision-box {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 30px;
  position: relative; overflow: hidden;
  text-align: center;
}
.vision-box::before {
  content: '"';
  position: absolute; top: -20px; left: 20px;
  font-size: 120px; color: rgba(255,255,255,.06);
  font-family: Georgia, serif; line-height: 1;
}
.vision-box p { font-size: 1.1rem; line-height: 1.8; opacity: .95; }

/* ──── News Detail ──── */
.news-detail-img { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius-lg); margin-bottom: 24px; }
.news-detail-content { font-size: .97rem; line-height: 1.9; color: #333; }
.news-detail-content h2,h3,h4 { color: var(--primary); margin: 20px 0 10px; }
.news-detail-content ul,ol { padding-left: 24px; margin-bottom: 16px; }
.news-detail-content p { margin-bottom: 14px; }

/* ──── Footer ──── */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.8);
  padding: 50px 0 0;
  margin-top: 60px;
}
.footer-title {
  color: var(--accent-light);
  font-size: 1rem; font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(255,255,255,.72); font-size: .9rem; }
.footer-links a:hover { color: var(--accent-light); }
.footer-links i { margin-right: 6px; font-size: .8rem; color: var(--accent); }
.footer-contact li { margin-bottom: 10px; font-size: .88rem; display: flex; gap: 10px; }
.footer-contact li i { color: var(--accent); width: 16px; margin-top: 3px; }
.footer-social a {
  display: inline-flex; width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
  color: rgba(255,255,255,.8);
  margin-right: 8px; margin-bottom: 8px;
  font-size: .95rem;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,.12);
}
.footer-social a:hover { background: var(--accent); color: var(--primary-dark); }
.footer-bottom {
  background: rgba(0,0,0,.25);
  text-align: center;
  padding: 14px;
  margin-top: 36px;
  font-size: .83rem; color: rgba(255,255,255,.6);
}

/* ──── Admin Styles ──── */
.admin-sidebar {
  min-height: 100vh;
  background: var(--primary-dark);
  width: 250px;
  position: fixed; left: 0; top: 0;
  z-index: 100;
  display: flex; flex-direction: column;
}
.admin-sidebar .brand {
  padding: 20px;
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: #fff;
}
.admin-sidebar .brand h6 { font-size: .88rem; color: var(--accent-light); margin: 0; }
.admin-sidebar .brand p { font-size: .75rem; color: rgba(255,255,255,.5); margin: 0; }
.admin-nav { padding: 12px 0; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: rgba(255,255,255,.78);
  font-size: .9rem; transition: all var(--transition);
  border-left: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
  background: rgba(255,255,255,.1);
  color: var(--accent-light);
  border-left-color: var(--accent);
  text-decoration: none;
}
.admin-nav .nav-group { padding: 8px 20px 4px; font-size: .7rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; }
.admin-main { margin-left: 250px; min-height: 100vh; background: #f0f2f8; }
.admin-topbar {
  background: #fff; height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: sticky; top: 0; z-index: 50;
}
.admin-topbar .page-title { font-size: 1.1rem; font-weight: 600; color: var(--primary); }
.admin-content { padding: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
  display: flex; gap: 18px; align-items: center;
  border-left: 4px solid var(--primary);
}
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.stat-card .stat-val { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .85rem; color: var(--text-muted); }
.admin-table th { background: var(--secondary); color: var(--primary-dark); font-weight: 600; font-size: .88rem; }
.admin-table td { vertical-align: middle; font-size: .9rem; }

/* ──── Animations ──── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(20px); }
  to   { opacity:1; transform:translateY(0); }
}
.fade-up { animation: fadeUp .5s ease forwards; }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }

/* ──── Responsive ──── */
@media (max-width: 991px) {
  .hero-slider .carousel-item { height: 300px; }
  .hero-slider .carousel-caption { right: 5%; }
  .hero-slider .carousel-caption h2 { font-size: 1.4rem; }
  .main-nav .nav-link { padding: 10px 14px !important; }
}
@media (max-width: 767px) {
  .hero-slider .carousel-item { height: 240px; }
  .hero-slider .carousel-caption h2 { font-size: 1.1rem; }
  .hero-slider .carousel-caption p { display: none; }
  .logo-text .title { font-size: .85rem; }
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .topbar .topbar-right { display: none !important; }
}
@media (max-width: 575px) {
  .section-title { font-size: 1.25rem; }
  .page-hero h1 { font-size: 1.3rem; }
}

/* ──── Scrollbar ──── */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
