/* ============================================================
   ระบบเว็บไซต์โรงเรียน - Modern CSS Design System
   Version: 1.0.0
   Font: Noto Sans Thai + Sarabun
   Color Scheme: Red (#C0392B) + Yellow (#F39C12)
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800&family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════
   1. CSS Variables (Design Tokens)
══════════════════════════════════════════════════════════ */
:root {
  /* Primary Colors */
  --primary-red:     #C0392B;
  --primary-red-dark:#922B21;
  --primary-red-light:#E74C3C;
  --primary-yellow:  #F39C12;
  --primary-yellow-dark:#D68910;
  --primary-yellow-light:#F1C40F;

  /* Gradient */
  --gradient-primary:    linear-gradient(135deg, #C0392B 0%, #F39C12 100%);
  --gradient-dark:       linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  --gradient-glass:      linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
  --gradient-card:       linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);

  /* Neutrals */
  --dark:            #1a1a2e;
  --dark-secondary:  #16213e;
  --dark-tertiary:   #0f3460;
  --gray-900:        #212529;
  --gray-700:        #495057;
  --gray-500:        #adb5bd;
  --gray-200:        #e9ecef;
  --gray-100:        #f8f9fa;
  --white:           #ffffff;

  /* Text */
  --text-primary:    #1a1a2e;
  --text-secondary:  #495057;
  --text-muted:      #6c757d;
  --text-light:      #f8f9fa;

  /* Backgrounds */
  --bg-primary:      #f8f9fa;
  --bg-secondary:    #ffffff;
  --bg-card:         #ffffff;
  --bg-navbar:       #C0392B;

  /* Glassmorphism */
  --glass-bg:        rgba(255, 255, 255, 0.1);
  --glass-border:    rgba(255, 255, 255, 0.2);
  --glass-blur:      blur(20px);

  /* Shadows */
  --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md:       0 4px 20px rgba(0, 0, 0, 0.10);
  --shadow-lg:       0 8px 40px rgba(0, 0, 0, 0.15);
  --shadow-xl:       0 20px 60px rgba(0, 0, 0, 0.20);
  --shadow-colored:  0 8px 30px rgba(192, 57, 43, 0.30);
  --shadow-yellow:   0 8px 30px rgba(243, 156, 18, 0.30);

  /* Border Radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow:   0.5s ease;

  /* Z-index Layers */
  --z-navbar: 1000;
  --z-modal:  1050;
  --z-toast:  1100;

  /* Typography */
  --font-thai: 'Noto Sans Thai', 'Sarabun', sans-serif;
}

/* ══════════════════════════════════════════════════════════
   2. Dark Mode Variables
══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --text-primary:   #e9ecef;
  --text-secondary: #adb5bd;
  --text-muted:     #6c757d;
  --bg-primary:     #0d1117;
  --bg-secondary:   #161b22;
  --bg-card:        #1c2128;
  --bg-navbar:      #161b22;
  --glass-bg:       rgba(255, 255, 255, 0.05);
  --glass-border:   rgba(255, 255, 255, 0.10);
  --shadow-md:      0 4px 20px rgba(0, 0, 0, 0.40);
  --shadow-lg:      0 8px 40px rgba(0, 0, 0, 0.50);
  --gradient-card:  linear-gradient(145deg, #1c2128 0%, #161b22 100%);
}

/* ══════════════════════════════════════════════════════════
   3. Base Reset & Typography
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-thai);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.7;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

/* Thai font fix */
p, li, td, th, label, input, textarea, select, span, a, button {
  font-family: var(--font-thai);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-thai);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

a { 
  color: var(--primary-red);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-red-dark); }

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

/* ══════════════════════════════════════════════════════════
   4. Loading Screen
══════════════════════════════════════════════════════════ */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--gradient-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-ring {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-logo {
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 1rem;
  letter-spacing: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════
   5. Navbar
══════════════════════════════════════════════════════════ */
.school-navbar {
  background: var(--gradient-primary) !important;
  box-shadow: 0 4px 20px rgba(192, 57, 43, 0.4);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  backdrop-filter: blur(10px);
}

.school-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.school-navbar .brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  object-fit: cover;
}

.school-navbar .brand-logo-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
}

.school-navbar .brand-text .school-name {
  color: white;
  font-size: 1rem;
  font-weight: 800;
  display: block;
  line-height: 1.2;
}

.school-navbar .brand-text .school-sub {
  color: rgba(255,255,255,0.8);
  font-size: 0.72rem;
  display: block;
}

.school-navbar .nav-link {
  color: rgba(255,255,255,0.9) !important;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 1.2rem 0.9rem !important;
  position: relative;
  transition: color var(--transition-fast);
}

.school-navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary-yellow);
  border-radius: 3px 3px 0 0;
  transition: width var(--transition-normal);
}

.school-navbar .nav-link:hover::after,
.school-navbar .nav-link.active::after {
  width: 70%;
}

.school-navbar .nav-link:hover,
.school-navbar .nav-link.active {
  color: var(--primary-yellow-light) !important;
}

.school-navbar .navbar-toggler {
  border: none;
  color: white;
  padding: 6px 10px;
}

.school-navbar .navbar-toggler:focus { box-shadow: none; }

/* Top Info Bar */
.top-info-bar {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  padding: 6px 0;
  font-size: 0.8rem;
}

.top-info-bar a { color: rgba(255,255,255,0.7); }
.top-info-bar a:hover { color: var(--primary-yellow); }

/* Dark Mode Toggle */
.dark-mode-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dark-mode-toggle:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

/* ══════════════════════════════════════════════════════════
   6. Hero Section / Banner Slider
══════════════════════════════════════════════════════════ */
.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-carousel .carousel-item {
  height: 580px;
}

@media (max-width: 768px) {
  .hero-carousel .carousel-item { height: 350px; }
}

.hero-carousel .carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-carousel .carousel-caption {
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 100%);
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4rem 2rem 2.5rem;
  text-align: left;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  color: white;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: rgba(255,255,255,0.85);
  margin-bottom: 1.5rem;
  max-width: 600px;
}

.hero-btn {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-colored);
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(192, 57, 43, 0.5);
  color: white;
}

/* ══════════════════════════════════════════════════════════
   7. Section Styles
══════════════════════════════════════════════════════════ */
.section {
  padding: 80px 0;
}

.section-sm { padding: 50px 0; }

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  position: relative;
}

.section-title-wrapper {
  margin-bottom: 3rem;
  text-align: center;
}

.section-title-wrapper .divider {
  width: 80px;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  margin: 1rem auto;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Alt Background */
.bg-section-alt {
  background: var(--bg-primary);
}

[data-theme="dark"] .bg-section-alt {
  background: var(--dark-secondary);
}

/* ══════════════════════════════════════════════════════════
   8. Cards
══════════════════════════════════════════════════════════ */
.school-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all var(--transition-normal);
}

[data-theme="dark"] .school-card {
  border-color: rgba(255,255,255,0.08);
}

.school-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

/* News Card */
.news-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all var(--transition-normal);
  height: 100%;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .news-card {
  border-color: rgba(255,255,255,0.08);
  background: var(--bg-card);
}

.news-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.news-card .card-img-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.news-card .card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.news-card:hover .card-img-wrapper img {
  transform: scale(1.08);
}

.news-card .card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--gradient-primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.news-card .card-body {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-card .card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.news-card .card-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.news-card .card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.news-card .card-meta i {
  color: var(--primary-red);
}

/* Glassmorphism Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* ══════════════════════════════════════════════════════════
   9. Stats Counter Section
══════════════════════════════════════════════════════════ */
.stats-section {
  background: var(--gradient-primary);
  padding: 60px 0;
  position: relative;
  overflow: hidden;
}

.stats-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.stat-item {
  text-align: center;
  color: white;
  padding: 20px;
  position: relative;
}

.stat-item::after {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(255,255,255,0.2);
}

.stat-item:last-child::after { display: none; }

.stat-number {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: white;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-unit {
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  margin-top: 0.3rem;
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  color: rgba(255,255,255,0.6);
}

/* ══════════════════════════════════════════════════════════
   10. Management Section (ผู้บริหาร)
══════════════════════════════════════════════════════════ */
.management-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  border: 2px solid transparent;
}

.management-card:hover {
  border-color: var(--primary-red);
  transform: translateY(-5px);
  box-shadow: var(--shadow-colored);
}

.management-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-red);
  box-shadow: 0 5px 20px rgba(192, 57, 43, 0.3);
  margin: 0 auto 1rem;
}

.management-avatar-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: 4px solid var(--primary-red);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
}

.management-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.management-position {
  font-size: 0.85rem;
  color: var(--primary-red);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════
   11. Gallery Grid
══════════════════════════════════════════════════════════ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(192,57,43,0.85) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  color: white;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════
   12. Teacher / Personnel Cards
══════════════════════════════════════════════════════════ */
.teacher-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: all var(--transition-normal);
  border: 1px solid var(--gray-200);
}

[data-theme="dark"] .teacher-card {
  border-color: rgba(255,255,255,0.08);
}

.teacher-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.teacher-card-header {
  background: var(--gradient-primary);
  height: 80px;
  position: relative;
}

.teacher-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
}

.teacher-avatar-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 4px solid white;
  box-shadow: var(--shadow-md);
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 2.5rem;
}

.teacher-card-body {
  padding: 3.5rem 1.5rem 1.5rem;
}

.teacher-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.teacher-position {
  font-size: 0.8rem;
  color: var(--primary-red);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.teacher-dept {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════
   13. Buttons
══════════════════════════════════════════════════════════ */
.btn-school-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 24px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-colored);
}

.btn-school-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(192, 57, 43, 0.45);
  color: white;
}

.btn-school-outline {
  background: transparent;
  color: var(--primary-red);
  border: 2px solid var(--primary-red);
  border-radius: var(--radius-full);
  padding: 9px 24px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--transition-normal);
}

.btn-school-outline:hover {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  transform: translateY(-3px);
}

.btn-yellow {
  background: var(--primary-yellow);
  color: var(--dark);
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 24px;
  font-weight: 700;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-yellow);
}

.btn-yellow:hover {
  background: var(--primary-yellow-dark);
  transform: translateY(-3px);
  color: var(--dark);
}

/* ══════════════════════════════════════════════════════════
   14. Download Section
══════════════════════════════════════════════════════════ */
.download-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all var(--transition-normal);
  margin-bottom: 0.8rem;
}

[data-theme="dark"] .download-item {
  border-color: rgba(255,255,255,0.08);
}

.download-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary-red);
}

.download-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.download-icon.pdf   { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.download-icon.word  { background: linear-gradient(135deg, #2980b9, #1a5276); }
.download-icon.excel { background: linear-gradient(135deg, #27ae60, #1e8449); }

.download-info { flex: 1; min-width: 0; }
.download-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   15. Contact Section
══════════════════════════════════════════════════════════ */
.contact-info-card {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  color: white;
  height: 100%;
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-info-icon {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

/* ══════════════════════════════════════════════════════════
   16. Form Styles
══════════════════════════════════════════════════════════ */
.form-control, .form-select {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-thai);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
  outline: none;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--dark-secondary);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   17. Footer
══════════════════════════════════════════════════════════ */
.school-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  padding: 60px 0 0;
  position: relative;
  overflow: hidden;
}

.school-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.footer-brand-name {
  color: white;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.footer-description {
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem;
  line-height: 1.8;
}

.footer-heading {
  color: white;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid rgba(192,57,43,0.5);
}

.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 0.6rem; }
.footer-links a {
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary-yellow);
  padding-left: 5px;
}

.footer-links a i { color: var(--primary-red); font-size: 0.75rem; }

.social-links { display: flex; gap: 10px; margin-top: 1rem; }
.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  transition: all var(--transition-normal);
}

.social-link:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  transform: translateY(-3px);
}

.footer-bottom {
  background: rgba(0,0,0,0.3);
  margin-top: 40px;
  padding: 18px 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
}

/* ══════════════════════════════════════════════════════════
   18. Pagination
══════════════════════════════════════════════════════════ */
.pagination .page-link {
  color: var(--primary-red);
  border-radius: var(--radius-sm) !important;
  margin: 0 3px;
  border: 2px solid var(--gray-200);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.pagination .page-item.active .page-link {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-colored);
}

.pagination .page-link:hover {
  background: var(--primary-red);
  color: white;
  border-color: var(--primary-red);
}

/* ══════════════════════════════════════════════════════════
   19. Breadcrumb
══════════════════════════════════════════════════════════ */
.school-breadcrumb {
  background: var(--gradient-primary);
  padding: 30px 0;
  color: white;
}

.school-breadcrumb h1 {
  color: white;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.school-breadcrumb .breadcrumb-item a { color: rgba(255,255,255,0.7); }
.school-breadcrumb .breadcrumb-item.active { color: rgba(255,255,255,0.9); }
.school-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,0.5); }

/* ══════════════════════════════════════════════════════════
   20. Quick Links
══════════════════════════════════════════════════════════ */
.quick-links-section {
  background: var(--gradient-dark);
  padding: 60px 0;
}

.quick-link-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  color: white;
  transition: all var(--transition-normal);
  text-decoration: none;
  display: block;
}

.quick-link-card:hover {
  background: rgba(192, 57, 43, 0.3);
  border-color: var(--primary-red);
  transform: translateY(-5px);
  color: white;
}

.quick-link-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-yellow);
}

.quick-link-label {
  font-size: 0.9rem;
  font-weight: 700;
}

/* ══════════════════════════════════════════════════════════
   21. AI Chatbot Widget
══════════════════════════════════════════════════════════ */
#ai-chatbot-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
}

.chatbot-toggle-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chatbot-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 40px rgba(192, 57, 43, 0.5);
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--primary-yellow);
  color: var(--dark);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  max-height: 500px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.chatbot-window.open { display: flex; }

.chatbot-header {
  background: var(--gradient-primary);
  color: white;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chatbot-info .name { font-weight: 700; font-size: 0.9rem; }
.chatbot-info .status { font-size: 0.75rem; color: rgba(255,255,255,0.8); }

.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 320px;
}

.chat-message {
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.chat-message.user { flex-direction: row-reverse; margin-left: auto; }

.chat-bubble {
  background: var(--gray-100);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.chat-message.user .chat-bubble {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-md);
  border-bottom-right-radius: 4px;
}

.chatbot-input-area {
  padding: 0.8rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-family: var(--font-thai);
  outline: none;
  transition: border-color var(--transition-fast);
}

.chatbot-input:focus { border-color: var(--primary-red); }

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chatbot-send-btn:hover { transform: scale(1.1); }

/* ══════════════════════════════════════════════════════════
   22. Back to Top
══════════════════════════════════════════════════════════ */
#back-to-top {
  position: fixed;
  bottom: 110px;
  right: 30px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-colored);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: 999;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover { transform: translateY(-3px) scale(1.1); }

/* ══════════════════════════════════════════════════════════
   23. Badge / Tag Styles
══════════════════════════════════════════════════════════ */
.badge-school {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-red    { background: rgba(192,57,43,0.1); color: var(--primary-red); }
.badge-yellow { background: rgba(243,156,18,0.1); color: var(--primary-yellow-dark); }
.badge-green  { background: rgba(39,174,96,0.1); color: #27ae60; }
.badge-blue   { background: rgba(41,128,185,0.1); color: #2980b9; }

/* ══════════════════════════════════════════════════════════
   24. Event Calendar Preview
══════════════════════════════════════════════════════════ */
.event-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 0.8rem;
  transition: all var(--transition-normal);
}

[data-theme="dark"] .event-item {
  border-color: rgba(255,255,255,0.08);
}

.event-item:hover {
  border-left: 4px solid var(--primary-red);
  transform: translateX(4px);
}

.event-date-box {
  min-width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.event-date-day { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.event-date-month { font-size: 0.65rem; font-weight: 600; }

.event-info h6 { font-size: 0.9rem; font-weight: 700; margin-bottom: 2px; }
.event-info p { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

/* ══════════════════════════════════════════════════════════
   25. Search Bar
══════════════════════════════════════════════════════════ */
.search-bar {
  position: relative;
}

.search-bar .form-control {
  padding-right: 50px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 2px solid var(--gray-200);
}

.search-bar .search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   26. Animations
══════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-ring {
  0%   { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
  70%  { transform: scale(1); box-shadow: 0 0 0 15px rgba(192,57,43,0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}

.animate-fadeInUp { animation: fadeInUp 0.7s ease both; }
.animate-fadeInLeft { animation: fadeInLeft 0.7s ease both; }
.animate-fadeInRight { animation: fadeInRight 0.7s ease both; }

/* Intersection Observer classes */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ══════════════════════════════════════════════════════════
   27. Toast Notification
══════════════════════════════════════════════════════════ */
.toast-container { z-index: var(--z-toast); }

/* ══════════════════════════════════════════════════════════
   28. Responsive
══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  .school-navbar .nav-link::after { display: none; }
  .school-navbar .navbar-collapse {
    background: rgba(0,0,0,0.3);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1rem;
  }
  .stat-item::after { display: none; }
}

@media (max-width: 768px) {
  .section { padding: 50px 0; }
  .quick-link-card { padding: 1.5rem 1rem; }
  .chatbot-window { width: 300px; }
  #ai-chatbot-widget { bottom: 20px; right: 15px; }
  #back-to-top { right: 15px; bottom: 90px; }
}

@media (max-width: 576px) {
  .hero-carousel .carousel-caption { padding: 3rem 1.5rem 1.5rem; }
  .hero-title { font-size: 1.4rem; }
  .stat-number { font-size: 2rem; }
  .management-card { margin-bottom: 1rem; }
}

/* ══════════════════════════════════════════════════════════
   29. Utility Classes
══════════════════════════════════════════════════════════ */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-gradient-primary { background: var(--gradient-primary); }
.bg-gradient-dark { background: var(--gradient-dark); }

.border-gradient {
  border: 3px solid transparent;
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              var(--gradient-primary) border-box;
}

.rounded-school { border-radius: var(--radius-lg); }
.shadow-school { box-shadow: var(--shadow-md); }

.hover-lift { transition: transform var(--transition-normal); }
.hover-lift:hover { transform: translateY(-6px); }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
