/* 
 * KunKruHub - Premium Classroom Management CSS Design System
 * Designed with modern HSL tokens, glassmorphism, responsive grids, and clean interactions.
 */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Color System - Calm Slate, Clean Snow & Wild Orchid Accent */
  --primary-color: hsl(219, 80%, 28%); /* Navy Blue (#0C2E6B) */
  --primary-gradient: linear-gradient(135deg, hsl(219, 80%, 32%) 0%, hsl(219, 85%, 22%) 100%);
  --secondary-color: hsl(1, 75%, 49%); /* Cherry Red (#DD211F) */
  --secondary-gradient: linear-gradient(135deg, hsl(1, 75%, 52%) 0%, hsl(1, 85%, 43%) 100%);
  
  --accent-color: hsl(1, 75%, 49%);
  --accent-gradient: linear-gradient(135deg, hsl(1, 75%, 52%) 0%, hsl(1, 85%, 43%) 100%);
  
  --bg-app: #f8fafc; /* Clean Snow */
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a; /* Slate Dark */
  --bg-sidebar-active: rgba(255, 255, 255, 0.06);
  
  --text-main: #0f172a; /* Dark Slate */
  --text-muted: #64748b; /* Smoky Gray */
  --text-on-primary: #ffffff;
  --text-on-sidebar: #f8fafc;
  
  /* Status Colors */
  --color-present: hsl(142, 71%, 45%);
  --color-present-light: hsl(142, 69%, 96%);
  
  --color-late: hsl(25, 95%, 53%);
  --color-late-light: hsl(25, 95%, 95%);
  
  --color-leave: hsl(199, 89%, 48%);
  --color-leave-light: hsl(199, 89%, 95%);
  
  --color-sick: hsl(300, 60%, 45%); /* Sick - Magenta */
  --color-sick-light: hsl(300, 60%, 96%);
  
  --color-absent: hsl(346, 84%, 61%);
  --color-absent-light: hsl(346, 84%, 96%);
  
  /* Border & Shadows - Subtle Sub-Pixel */
  --border-color: rgba(15, 23, 42, 0.06);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.03), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.03), 0 2px 4px -1px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.04), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
  --shadow-button: 0 4px 14px rgba(12, 46, 107, 0.25);
  
  /* Layout */
  --sidebar-width: 280px;
  --transition-speed: 0.3s;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Premium Ambient Glow Blobs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.14;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: multiply;
  animation: driftAmbient 30s infinite alternate ease-in-out;
}
.glow-1 {
  width: 550px;
  height: 550px;
  background: var(--primary-color);
  top: -100px;
  left: 20%;
  animation-duration: 25s;
}
.glow-2 {
  width: 600px;
  height: 600px;
  background: hsl(25, 95%, 53%); /* Golden Orange */
  bottom: -150px;
  right: 15%;
  animation-duration: 35s;
}
.glow-3 {
  width: 400px;
  height: 400px;
  background: hsl(199, 89%, 48%); /* Sky Blue */
  top: 40%;
  right: 25%;
  animation-duration: 28s;
  opacity: 0.1;
}

@keyframes driftAmbient {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, -60px) scale(1.15); }
  100% { transform: translate(-40px, 80px) scale(0.9); }
}

body {
  font-family: 'Outfit', 'Kanit', 'Sarabun', sans-serif;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(at 0% 0%, rgba(12, 46, 107, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(249, 115, 22, 0.04) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  position: relative;
}

/* Safety rule to prevent AI-generated justified text bugs in Thai */
h1, h2, h3, h4, h5, h6, p, span, div, td, th {
  text-align: left;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Application Layout */
.app-container {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-on-sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-speed) ease;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.system-logo-wrapper {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  box-sizing: border-box;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.system-logo-wrapper:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(12, 46, 107, 0.3);
}

.system-logo {
  width: 100%;
  height: auto;
  max-height: 38px;
  object-fit: contain;
  display: block;
}

.logo-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--secondary-gradient);
  border-radius: 50% !important; /* Force a sleek circular badge */
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.logo-text {
  flex-grow: 1;
  min-width: 0;
}

.logo-text span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  display: block;
  font-family: 'Kanit', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: rotate(90deg);
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
}

/* Custom Scrollbar for sidebar navigation list */
.nav-links::-webkit-scrollbar {
  width: 4px;
}
.nav-links::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Sidebar Nav Category Header & Groups */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  outline: none;
  font-family: 'Kanit', sans-serif;
  text-align: left;
  user-select: none;
  transition: all 0.2s ease;
}

.nav-category-header:hover {
  color: white;
}

.nav-category-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-category-icon {
  font-size: 0.9rem;
}

.nav-category-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.chevron-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  opacity: 0.5;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.nav-category-header:hover .chevron-icon {
  opacity: 0.85;
}

.nav-group.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.nav-group-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transform: scaleY(1);
  transform-origin: top;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-group.collapsed .nav-group-items {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: scaleY(0.95);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Kanit', sans-serif;
  font-weight: 400;
  font-size: 0.82rem;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--primary-gradient);
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
}

.nav-item.active:hover {
  transform: translateX(0); /* Lock slide animation when active */
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.teacher-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #a5b4fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #312e81;
}

.teacher-info {
  display: flex;
  flex-direction: column;
}

.teacher-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

.teacher-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Main Viewport Content */
.main-viewport {
  margin-left: var(--sidebar-width);
  padding: 40px;
  flex-grow: 1;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  /* Removed janky margin/width transition to prevent layout reflow thrashing */
}

/* Main Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.header-title h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.date-badge {
  background: white;
  padding: 10px 18px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--primary-color);
  font-family: 'Outfit', 'Kanit', sans-serif;
  box-shadow: var(--shadow-sm);
}

/* Dynamic Modules Container */
.module-section {
  display: none;
  animation: fadeIn var(--transition-speed) ease forwards;
}

.module-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Base Component: Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--border-radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 768px) {
  .stat-card {
    padding: 20px;
  }
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-family: 'Kanit', sans-serif;
  font-size: 0.9rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: hsl(243, 75%, 96%);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.success {
  background: var(--color-present-light);
  color: var(--color-present);
}

.stat-icon.warning {
  background: var(--color-late-light);
  color: var(--color-late);
}

.stat-icon.danger {
  background: var(--color-absent-light);
  color: var(--color-absent);
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 16px;
  font-family: 'Outfit', 'Kanit', sans-serif;
  line-height: 1.1;
}

.stat-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Secondary Dashboard Grid */
.dashboard-details-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

@media (max-width: 1024px) {
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--border-radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .panel-card {
    padding: 20px;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 14px 16px;
  background-color: hsl(210, 40%, 96%);
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
  font-size: 0.9rem;
  font-family: 'Kanit', sans-serif;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.95rem;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: hsl(210, 40%, 98%);
}

/* Student Profiles & Badges */
.student-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.student-info-cell h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.student-info-cell span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Badges for status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
}

.badge.present { background: var(--color-present-light); color: var(--color-present); }
.badge.late { background: var(--color-late-light); color: var(--color-late); }
.badge.leave { background: var(--color-leave-light); color: var(--color-leave); }
.badge.sick { background: var(--color-sick-light); color: var(--color-sick); }
.badge.absent { background: var(--color-absent-light); color: var(--color-absent); }

/* Quick Actions Cards */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.btn-action-tile {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main);
  text-decoration: none;
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
}

.btn-action-tile:hover {
  background: white;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-action-tile svg {
  width: 24px;
  height: 24px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: 'Kanit', sans-serif;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: var(--shadow-button);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: hsl(210, 40%, 96%);
}

.btn-danger {
  background: var(--color-absent);
  color: white;
}

.btn-danger:hover {
  opacity: 0.95;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-family: 'Kanit', sans-serif;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: white;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Flex rows/columns utilities */
.flex-row-spaced {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-gap-12 {
  display: flex;
  gap: 12px;
}

/* Modals Dialog styling */
dialog {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--border-radius-md);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
  margin: auto;
  max-width: 520px;
  width: 90%;
  padding: 32px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: backdrop-filter 0.3s ease;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.dialog-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
}

.dialog-close-btn {
  background: rgba(15, 23, 42, 0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dialog-close-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  transform: rotate(90deg);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Attendance Styling */
.attendance-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.attendance-row {
  display: grid;
  grid-template-columns: 2fr 3fr;
  align-items: center;
  background: white;
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .attendance-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.attendance-options {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .attendance-options {
    justify-content: space-between;
  }
}

.attendance-btn-radio {
  flex-grow: 1;
  position: relative;
}

.attendance-btn-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.attendance-btn-label {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 8px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: 'Kanit', sans-serif;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.attendance-btn-radio.present input[type="radio"]:checked + .attendance-btn-label {
  background: var(--color-present);
  border-color: var(--color-present);
  color: white;
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}

.attendance-btn-radio.late input[type="radio"]:checked + .attendance-btn-label {
  background: var(--color-late);
  border-color: var(--color-late);
  color: white;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.attendance-btn-radio.leave input[type="radio"]:checked + .attendance-btn-label {
  background: var(--color-leave);
  border-color: var(--color-leave);
  color: white;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.attendance-btn-radio.sick input[type="radio"]:checked + .attendance-btn-label {
  background: var(--color-sick);
  border-color: var(--color-sick);
  color: white;
  box-shadow: 0 4px 10px rgba(168, 85, 247, 0.3);
}

.attendance-btn-radio.absent input[type="radio"]:checked + .attendance-btn-label {
  background: var(--color-absent);
  border-color: var(--color-absent);
  color: white;
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
}

/* Savings Ledgers */
.savings-info-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.savings-info-tile {
  background: hsl(210, 40%, 96%);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  text-align: center;
}

.savings-info-tile.savings-total {
  background: var(--primary-gradient);
  color: white;
}

.savings-info-tile h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
}

.savings-info-tile.savings-total h4 {
  color: rgba(255, 255, 255, 0.8);
}

.savings-info-tile .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 4px;
  font-family: 'Outfit', sans-serif;
}

/* Savings Modal Toggle Button Style (Deposit vs Withdraw) */
.transaction-toggle-container {
  display: flex;
  background: hsl(210, 40%, 96%);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.transaction-toggle-btn {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 4px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.transaction-toggle-btn.active {
  background: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.transaction-toggle-btn.deposit.active {
  color: var(--color-present);
}

.transaction-toggle-btn.withdraw.active {
  color: var(--color-absent);
}

/* Score Management Grades */
.score-header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}

.score-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.score-stat-tile {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.score-stat-tile h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Kanit', sans-serif;
}

.score-stat-tile .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 4px;
  font-family: 'Outfit', sans-serif;
}

/* Health (Weight / Height / BMI) */
.health-bmi-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-weight: bold;
  font-size: 0.85rem;
  color: white;
}

.health-bmi-badge.thin { background: hsl(199, 89%, 48%); }
.health-bmi-badge.normal { background: hsl(142, 71%, 45%); }
.health-bmi-badge.overweight { background: hsl(38, 92%, 50%); }
.health-bmi-badge.obese { background: hsl(346, 84%, 61%); }

/* Good Deeds Stars */
.star-indicator {
  display: flex;
  gap: 2px;
  color: #fbbf24;
}

.star-indicator svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.star-rating-input {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 20px;
}

.star-rating-input input {
  display: none;
}

.star-rating-input label {
  cursor: pointer;
  color: #cbd5e1;
  font-size: 1.75rem;
  transition: color 0.1s ease;
}

.star-rating-input label:hover,
.star-rating-input label:hover ~ label,
.star-rating-input input:checked ~ label {
  color: #fbbf24;
}

/* Daily Checklist Grid (Uniform, Milk, Lunch) */
.daily-checks-flex {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.daily-check-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  align-items: center;
  background: white;
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .daily-check-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.daily-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
}

.daily-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* Lesson Planner & Reflections card list */
.lesson-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.lesson-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.lesson-card-header h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
}

.lesson-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

.lesson-subject-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: hsl(243, 75%, 96%);
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  align-self: flex-start;
}

.lesson-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
}

.lesson-details-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Responsive sidebar drawer for mobile devices */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 10000 !important;
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-viewport {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 16px;
    box-sizing: border-box;
  }
  
  .logo-container {
    justify-content: space-between;
  }
  
  .sidebar-close-btn {
    display: block;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
  }
}

@media (min-width: 993px) {
  .sidebar-close-btn {
    display: none;
  }
}

.mobile-nav-toggle {
  display: none;
  background: white;
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 992px) {
  .mobile-nav-toggle {
    display: flex;
  }
}

.mobile-nav-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-main);
}

/* Alert Notification Banner (Toast) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999;
}

.toast {
  background: white;
  color: var(--text-main);
  border-radius: var(--border-radius-sm);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  min-width: 300px;
  max-width: 450px;
}

.toast.success { border-color: var(--color-present); background-color: var(--color-present-light); }
.toast.warning { border-color: var(--color-late); background-color: var(--color-late-light); }
.toast.error { border-color: var(--color-absent); background-color: var(--color-absent-light); }

@keyframes slideInToast {
  from {
    transform: translateX(120%);
  }
  to {
    transform: translateX(0);
  }
}

.toast-message {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Kanit', sans-serif;
  flex-grow: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

/* ==========================================================================
   SECTION 11: TEACHING CALENDAR & GROWTH STYLING
   ========================================================================== */

.calendar-card-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

@media (max-width: 992px) {
  .calendar-card-layout {
    grid-template-columns: 1fr;
  }
}

.calendar-widget {
  width: 100%;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.calendar-month-title {
  font-family: 'Kanit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

.calendar-nav-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  font-family: 'Kanit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-main);
}

.calendar-nav-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-cell {
  aspect-ratio: 1.1;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  background: white;
  transition: all 0.2s ease;
  min-height: 72px;
}

.calendar-day-cell:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
}

.calendar-day-cell.inactive {
  background: #f8fafc;
  color: #cbd5e1;
  cursor: not-allowed;
  border-color: #f1f5f9;
}

.calendar-day-cell.today {
  border: 2px solid var(--primary-color);
  background: var(--bg-hover);
}

.calendar-day-cell.selected {
  border: 2px solid var(--text-main);
  background: #f1f5f9;
}

.calendar-day-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

.calendar-day-cell.inactive .calendar-day-num {
  color: #cbd5e1;
}

.calendar-event-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.event-dot.lesson { background-color: var(--color-present); } /* green */
.event-dot.activity { background-color: var(--color-late); } /* orange */
.event-dot.meeting { background-color: var(--primary-color); } /* indigo */
.event-dot.exam { background-color: var(--color-absent); } /* red */

/* Events List */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 4px;
}

.events-list::-webkit-scrollbar {
  width: 5px;
}
.events-list::-webkit-scrollbar-track {
  background: transparent;
}
.events-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.event-pill-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  border-left: 2px solid var(--border-color);
}

.event-pill-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.event-pill-card.lesson { border-left-color: var(--color-present); }
.event-pill-card.activity { border-left-color: var(--color-late); }
.event-pill-card.meeting { border-left-color: var(--primary-color); }
.event-pill-card.exam { border-left-color: var(--color-absent); }

.event-pill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 18px; /* space for delete button */
}

.event-pill-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
}

.event-pill-type.lesson { background: var(--color-present-light); color: var(--color-present); }
.event-pill-type.activity { background: var(--color-late-light); color: var(--color-late); }
.event-pill-type.meeting { background: #e0e7ff; color: var(--primary-color); }
.event-pill-type.exam { background: var(--color-absent-light); color: var(--color-absent); }

.event-pill-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

.event-pill-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
  margin: 0;
}

.event-pill-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.event-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.event-delete-btn:hover {
  background: #fee2e2;
  color: var(--color-absent);
}

.no-events-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--text-muted);
  text-align: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-app);
}

.no-events-placeholder svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-muted);
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Growth Standards (กรมอนามัย) */
.national-growth-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.national-growth-badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.national-growth-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  font-family: 'Kanit', sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Badge specific themes */
.national-growth-badge.height {
  background: var(--primary-color);
}
.national-growth-badge.weight {
  background: #475569; /* Slate gray */
}

/* Status colors mapping */
.growth-status-thin { background-color: hsl(199, 89%, 48%) !important; color: white !important; }
.growth-status-normal { background-color: hsl(142, 71%, 45%) !important; color: white !important; }
.growth-status-chubby { background-color: hsl(38, 92%, 50%) !important; color: white !important; }
.growth-status-obese { background-color: hsl(346, 84%, 61%) !important; color: white !important; }
.growth-status-short { background-color: hsl(346, 84%, 61%) !important; color: white !important; }
.growth-status-tall { background-color: #8b5cf6 !important; color: white !important; } /* Violet */
.growth-status-light { background-color: #d97706 !important; color: white !important; } /* Amber */
.growth-status-heavy { background-color: #ea580c !important; color: white !important; } /* Orange */

.national-advice-box {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: #f8fafc;
  border: 1px solid rgba(12, 46, 107, 0.15);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  line-height: 1.4;
  margin-top: 4px;
}

/* ==========================================================================
   PRINT ENGINE (ระบบพิมพ์รายงานทางการ)
   ========================================================================== */

@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .sidebar,
  .sidebar-toggle,
  .mobile-nav-toggle,
  .btn,
  .dialog-close-btn,
  button,
  form,
  .panel-header button,
  .events-list svg,
  .transaction-toggle-container,
  #dragDropArea,
  .dialog-footer,
  #importMethodFileDiv,
  .score-stat-tile .value {
    display: none !important;
  }
  
  .main-viewport {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }
  
  .module-section {
    display: none !important;
  }
  
  .module-section.active {
    display: block !important;
  }
  
  .panel-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .data-table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  
  .data-table th,
  .data-table td {
    border: 1px solid #000 !important;
    color: #000 !important;
    padding: 8px !important;
    font-size: 0.85rem !important;
    background: transparent !important;
  }
  
  input[type="number"],
  input[type="text"],
  select {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto !important;
    font-size: 0.9rem !important;
    color: black !important;
    pointer-events: none !important;
    -moz-appearance: textfield !important;
  }
  
  input::-webkit-outer-spin-button,
  input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
  }
  
  /* Print titles and metadata header */
  .panel-header h3 {
    font-size: 1.5rem !important;
    border-bottom: 2px solid black !important;
    padding-bottom: 6px !important;
    margin-bottom: 15px !important;
    color: black !important;
  }
}

/* --- 25. TIMETABLE DRAG & DROP CUSTOM EFFECTS --- */

/* Palette item hover scale & transition */
.palette-drag-item {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.palette-drag-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  border-color: var(--primary-color) !important;
}

.palette-drag-item:active {
  cursor: grabbing !important;
  transform: scale(0.97);
}

/* Dropping hover highlight for table cells */
.timetable-drag-hover {
  background-color: hsl(226, 70%, 96%) !important;
  border: 2px dashed var(--primary-color) !important;
  box-shadow: inset 0 0 10px rgba(37, 99, 235, 0.06);
  transition: all 0.2s ease;
  animation: dragPulse 1.5s infinite ease-in-out;
}

@keyframes dragPulse {
  0% { border-color: var(--primary-color); }
  50% { border-color: var(--secondary-color); }
  100% { border-color: var(--primary-color); }
}

/* Draggable slot indicators */
.slot-draggable-element {
  cursor: grab;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.18s ease;
}

.slot-draggable-element:hover {
  background: var(--bg-app);
  box-shadow: var(--shadow-sm);
}

.slot-draggable-element:active {
  cursor: grabbing;
}

/* Responsive workspace adjustment */
@media (max-width: 992px) {
  .timetable-workspace-layout {
    grid-template-columns: 1fr !important;
  }
}

/* --- 26. SUBJECT MANAGEMENT CARD STYLES --- */
.subject-manage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.subject-manage-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
  opacity: 0.8;
}

.subject-manage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.subject-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.subject-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  background: hsl(226, 70%, 95%);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.subject-delete-btn {
  background: transparent;
  border: none;
  color: var(--color-absent);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subject-delete-btn:hover {
  background: var(--color-absent-light);
  transform: scale(1.1);
}

/* ==========================================================================
   NATIONAL-GRADE UX/UI ELEVATION AND MICRO-INTERACTIONS
   ========================================================================== */

/* 1. Thin Custom Scrollbar for Sleek Navigation */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.15);
  border-radius: 10px;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.3);
}

/* 2. Focused Inputs Premium Indigo Outline Rings */
.form-control:focus, select.form-control:focus, textarea.form-control:focus {
  outline: none !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
  background-color: #fff !important;
}

/* 3. Deep Stat Card Physical Lift & Border Glows */
.stat-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease !important;
}
.stat-card:hover {
  transform: translateY(-5px) !important;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.2) !important;
}

/* 4. Panel Cards Subtle Borders & Elevate Hover */
.panel-card {
  transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}
.panel-card:hover {
  box-shadow: var(--shadow-md) !important;
  border-color: rgba(37, 99, 235, 0.15) !important;
}

/* 5. Responsive Data Table Interactive Scale & Hovers */
.data-table tbody tr {
  transition: background-color 0.2s ease, transform 0.15s ease !important;
}
.data-table tbody tr:hover {
  background-color: hsl(210, 50%, 98%) !important;
}

/* 6. Pulsing Glowing Indicator Dots for Badges */
.badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-weight: 600 !important;
}
.badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Prepend Green Pulsing Dot for Present Status */
.badge.present::before {
  background-color: var(--color-present);
  box-shadow: 0 0 8px var(--color-present);
  animation: badgePulseGreen 1.8s infinite ease-in-out;
}
/* Prepend Red Pulsing Dot for Absent Status */
.badge.absent::before {
  background-color: var(--color-absent);
  box-shadow: 0 0 8px var(--color-absent);
  animation: badgePulseRed 1.8s infinite ease-in-out;
}
/* Prepend Orange Pulsing Dot for Late Status */
.badge.late::before {
  background-color: var(--color-late);
  box-shadow: 0 0 8px var(--color-late);
  animation: badgePulseOrange 1.8s infinite ease-in-out;
}
/* Prepend Blue Pulsing Dot for Leave Status */
.badge.leave::before {
  background-color: var(--color-leave);
  box-shadow: 0 0 8px var(--color-leave);
  animation: badgePulseBlue 1.8s infinite ease-in-out;
}
/* Prepend Purple Pulsing Dot for Sick Status */
.badge.sick::before {
  background-color: var(--color-sick);
  box-shadow: 0 0 8px var(--color-sick);
  animation: badgePulsePurple 1.8s infinite ease-in-out;
}

/* Keyframes for Badge Status Pulses */
@keyframes badgePulseGreen {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 12px var(--color-present); }
}
@keyframes badgePulseRed {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 12px var(--color-absent); }
}
@keyframes badgePulseOrange {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 12px var(--color-late); }
}
@keyframes badgePulseBlue {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 12px var(--color-leave); }
}
@keyframes badgePulsePurple {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.25); box-shadow: 0 0 12px var(--color-sick); }
}

/* 7. Beautiful Glassmorphic Tab Fade-In */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.module-section {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* ==========================================================================
   SECTION 22: CLASSROOM ACTIVITIES & TIMER STYLING (KRUTOOLS)
   ========================================================================== */
.activity-subpanel {
  display: none;
}
.activity-subpanel.active {
  display: block;
}

@keyframes winningGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(79, 70, 229, 0.4); border-color: var(--primary-color); }
  50% { box-shadow: 0 0 45px rgba(249, 115, 22, 0.85); border-color: var(--secondary-color); }
}

.winning-flash {
  animation: winningGlow 0.4s ease infinite;
}

/* Group columns representing interactive kanban cards */
.group-column {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--box-shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.group-column:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.group-header-badge {
  padding: 6px 14px;
  border-radius: var(--border-radius-sm);
  color: white;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: 'Kanit', sans-serif;
  text-align: center;
}

.group-student-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}
.group-student-item:hover {
  border-color: var(--primary-color);
  background: hsl(243, 75%, 99%);
}

.group-gender-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.group-gender-tag.boy {
  background: #eff6ff;
  color: #2563eb;
}
.group-gender-tag.girl {
  background: #fdf2f8;
  color: #db2777;
}

@keyframes slotSpin {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Tier Academic Badges */
.tier-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.tier-badge.tier-a {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}
.tier-badge.tier-b {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.tier-badge.tier-c {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
}

/* Timetable Palette Sticky and Compact Optimization */
.timetable-palette-container {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}

.timetable-palette-container::-webkit-scrollbar {
  width: 4px;
}

.timetable-palette-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.palette-group {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.palette-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.palette-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--text-main);
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  user-select: none;
  margin-bottom: 8px;
}

.palette-group-header:hover {
  color: var(--primary-color);
}

.palette-group-header .chevron {
  font-size: 0.65rem;
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.palette-group.collapsed .palette-group-header .chevron {
  transform: rotate(-90deg);
}

.palette-group-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 450px;
  opacity: 1;
  overflow: hidden;
  transform: scaleY(1);
  transform-origin: top;
}

.palette-group.collapsed .palette-group-items {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: scaleY(0.95);
}

/* Make palette items compact inside grid */
.palette-group-items .palette-drag-item {
  padding: 10px 12px !important;
  font-size: 0.86rem !important;
}

/* Manage locations list styling */
#manageLocationsList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   A4 BOOKLET REPORT PRINT STYLES
   ========================================================================== */
#printReportContainer {
  display: none;
}

@media print {
  /* Force exact color adjust for formal booklet printing */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body.printing-a4-report {
    display: block !important;
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    overflow: visible !important;
  }
  
  body.printing-a4-report .app-container {
    display: none !important;
  }
  
  body.printing-a4-report .main-viewport,
  body.printing-a4-report .sidebar,
  body.printing-a4-report .sidebar-toggle,
  body.printing-a4-report .mobile-nav-toggle,
  body.printing-a4-report .header-actions,
  body.printing-a4-report header,
  body.printing-a4-report .module-section,
  body.printing-a4-report button,
  body.printing-a4-report dialog {
    display: none !important;
  }
  
  body.printing-a4-report #printReportContainer {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    color: black !important;
    font-family: 'Sarabun', 'Kanit', sans-serif !important;
  }
  
  @page {
    size: A4 portrait;
    margin: 15mm 12mm 15mm 12mm !important;
  }
  
  body.printing-a4-landscape .print-table th {
    padding: 8px 4px !important;
    font-size: 0.8rem !important;
  }
  
  body.printing-a4-landscape .print-table td {
    height: 18mm !important;
    vertical-align: middle !important;
  }
  
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 15px !important;
    margin-bottom: 25px !important;
  }
  
  /* Force table header group repetition on multi-page printouts */
  .print-table thead {
    display: table-header-group !important;
  }
  
  /* Prevent table rows and cells from splitting awkwardly across pages */
  .print-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  
  .print-table th,
  .print-table td {
    border: 1px solid #000 !important;
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    color: #000 !important;
    line-height: 1.4 !important;
    background: transparent !important;
  }
  
  .print-table th {
    background-color: #f2f2f2 !important;
    font-weight: bold !important;
    text-align: center !important;
  }
}

/* ==========================================================================
   SECTION 33: PREMIUM CUSTOM CONFIRM DIALOG & GLASSMORPHIC LOADING OVERLAY
   ========================================================================== */
@keyframes kruhubSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes kruhubPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.08); opacity: 1; box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4); }
}

#btnConfirmCancel:hover {
  background: var(--bg-hover) !important;
  color: var(--text-color) !important;
}

#btnConfirmProceed:hover {
  background: rgb(220, 38, 38) !important;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35) !important;
}

#kruhubConfirmDialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* =============================================================================
   DESIRABLE TRAITS MODULE (คุณลักษณะอันพึงประสงค์ 8 ข้อ)
   ============================================================================= */

/* Column Headers */
.trait-col-header {
  text-align: center;
  min-width: 95px;
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 12px 8px !important;
}

/* Trait Pill Buttons Group */
.trait-cell {
  padding: 6px 4px !important;
  text-align: center;
}

.trait-pill-group {
  display: inline-flex;
  background-color: hsl(210, 20%, 96%);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid hsl(210, 14%, 88%);
  gap: 2px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

/* Focused cell styling for keyboard navigation */
.trait-pill-group:focus-within,
.trait-pill-group:focus {
  border-color: hsl(280, 70%, 55%);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
  background-color: hsl(210, 20%, 93%);
}

.trait-pill-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.trait-pill-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

.trait-pill-btn:focus {
  outline: none;
}

/* Active Level Styles */
.trait-pill-btn.active.trait-excellent {
  background-color: hsl(280, 70%, 55%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.trait-pill-btn.active.trait-good {
  background-color: hsl(142, 60%, 45%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.3);
}

.trait-pill-btn.active.trait-pass {
  background-color: hsl(199, 70%, 50%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.3);
}

.trait-pill-btn.active.trait-fail {
  background-color: hsl(346, 70%, 55%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(225, 29, 72, 0.3);
}

/* Legend Badges */
.trait-legend-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  letter-spacing: 0.01em;
}

.trait-legend-badge.trait-excellent {
  background: hsl(280, 80%, 95%);
  color: hsl(280, 70%, 40%);
  border: 1px solid hsl(280, 60%, 82%);
}

.trait-legend-badge.trait-good {
  background: hsl(142, 70%, 94%);
  color: hsl(142, 60%, 32%);
  border: 1px solid hsl(142, 50%, 78%);
}

.trait-legend-badge.trait-pass {
  background: hsl(199, 80%, 94%);
  color: hsl(199, 70%, 32%);
  border: 1px solid hsl(199, 60%, 78%);
}

.trait-legend-badge.trait-fail {
  background: hsl(346, 84%, 95%);
  color: hsl(346, 70%, 40%);
  border: 1px solid hsl(346, 60%, 82%);
}

/* Overall Result Badge */
.trait-overall-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.trait-overall-badge.trait-excellent {
  background: linear-gradient(135deg, hsl(280, 80%, 94%), hsl(280, 70%, 90%));
  color: hsl(280, 70%, 35%);
  border: 1.5px solid hsl(280, 60%, 78%);
  box-shadow: 0 2px 8px hsla(280, 70%, 55%, 0.15);
}

.trait-overall-badge.trait-good {
  background: linear-gradient(135deg, hsl(142, 70%, 93%), hsl(142, 60%, 89%));
  color: hsl(142, 60%, 28%);
  border: 1.5px solid hsl(142, 50%, 72%);
  box-shadow: 0 2px 8px hsla(142, 60%, 45%, 0.12);
}

.trait-overall-badge.trait-pass {
  background: linear-gradient(135deg, hsl(199, 80%, 93%), hsl(199, 70%, 89%));
  color: hsl(199, 70%, 28%);
  border: 1.5px solid hsl(199, 60%, 72%);
  box-shadow: 0 2px 8px hsla(199, 70%, 48%, 0.12);
}

.trait-overall-badge.trait-fail {
  background: linear-gradient(135deg, hsl(346, 84%, 94%), hsl(346, 70%, 90%));
  color: hsl(346, 70%, 35%);
  border: 1.5px solid hsl(346, 60%, 75%);
  box-shadow: 0 2px 8px hsla(346, 70%, 55%, 0.15);
}

/* Summary Stats Chips */
.trait-stat-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
}

.trait-stat-chip.trait-excellent {
  background: hsl(280, 80%, 96%);
  color: hsl(280, 70%, 40%);
}

.trait-stat-chip.trait-good {
  background: hsl(142, 70%, 95%);
  color: hsl(142, 60%, 32%);
}

.trait-stat-chip.trait-pass {
  background: hsl(199, 80%, 95%);
  color: hsl(199, 70%, 32%);
}

.trait-stat-chip.trait-fail {
  background: hsl(346, 84%, 96%);
  color: hsl(346, 70%, 40%);
}

/* Traits Table Responsive */
#traitsEvalTable {
  min-width: 1000px;
}

#traitsEvalTable th {
  position: sticky;
  top: 0;
  z-index: 1;
}

#traitsEvalTable tbody tr {
  transition: background-color 0.15s ease;
}

#traitsEvalTable tbody tr:hover {
  background-color: hsl(280, 60%, 98%);
}

/* Sticky first two columns for horizontal scroll */
#traitsEvalTable td:first-child {
  position: sticky;
  left: 0;
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  background: white;
  z-index: 1;
  text-align: center;
}

#traitsEvalTable td:nth-child(2) {
  position: sticky;
  left: 60px;
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  background: white;
  z-index: 1;
  border-right: 2px solid hsl(210, 14%, 88%);
}

#traitsEvalTable tbody tr:hover td:first-child,
#traitsEvalTable tbody tr:hover td:nth-child(2) {
  background: hsl(280, 60%, 98%);
}

/* Reading Table Styles & Sticky Columns */
.reading-col-header {
  text-align: center;
  min-width: 130px;
  font-size: 0.78rem;
  white-space: nowrap;
  padding: 12px 8px !important;
}

#readingEvalTable {
  min-width: 800px;
}

#readingEvalTable th {
  position: sticky;
  top: 0;
  z-index: 1;
}

#readingEvalTable tbody tr {
  transition: background-color 0.15s ease;
}

#readingEvalTable tbody tr:hover {
  background-color: hsl(280, 60%, 98%);
}

#readingEvalTable td:first-child {
  position: sticky;
  left: 0;
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  background: white;
  z-index: 1;
  text-align: center;
}

#readingEvalTable td:nth-child(2) {
  position: sticky;
  left: 60px;
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  background: white;
  z-index: 1;
  border-right: 2px solid hsl(210, 14%, 88%);
}

#readingEvalTable tbody tr:hover td:first-child,
#readingEvalTable tbody tr:hover td:nth-child(2) {
  background: hsl(280, 60%, 98%);
}

/* MOE Certification Summary Table & Sticky Columns */
#pap5SummaryTable {
  min-width: 900px;
}

#pap5SummaryTable th {
  position: sticky;
  top: 0;
  z-index: 1;
}

#pap5SummaryTable tbody tr {
  transition: background-color 0.15s ease;
}

#pap5SummaryTable tbody tr:hover {
  background-color: hsl(280, 60%, 98%);
}

#pap5SummaryTable td:first-child {
  position: sticky;
  left: 0;
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  background: white;
  z-index: 1;
  text-align: center;
}

#pap5SummaryTable td:nth-child(2) {
  position: sticky;
  left: 60px;
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  background: white;
  z-index: 1;
  border-right: 2px solid hsl(210, 14%, 88%);
}

#pap5SummaryTable tbody tr:hover td:first-child,
#pap5SummaryTable tbody tr:hover td:nth-child(2) {
  background: hsl(280, 60%, 98%);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .trait-pill-btn {
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
  }

  .trait-pill-group {
    padding: 1px;
    gap: 1px;
  }

  .trait-col-header {
    font-size: 0.7rem;
    min-width: 80px;
  }

  .trait-legend-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
}

/* =============================================================================
   --- PRINT MEDIA OVERRIDES FOR FORMAL A4 ปพ.5 REPORT ---
   ============================================================================= */
@media print {
  /* Enforce exact color adjust so backgrounds, gradients, and statuses render perfectly */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt !important;
    font-family: 'Sarabun', 'Kanit', sans-serif !important;
  }

  .sidebar,
  .app-header,
  .btn,
  .form-group,
  .panel-card:not(#pap5SummaryTablePanel),
  .module-section:not(#pap5SummaryModule),
  .transaction-toggle-container,
  #pap5SummaryHighlights,
  .savings-info-summary {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .print-only-header {
    display: block !important;
  }

  .print-only-footer {
    display: flex !important;
    margin-top: 50px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  #pap5SummaryModule {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }

  #pap5SummaryTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 20px !important;
    font-size: 10pt !important;
  }

  /* Force table header group repetition on multi-page printouts */
  #pap5SummaryTable thead,
  .print-table thead {
    display: table-header-group !important;
  }

  /* Prevent table rows and cells from splitting awkwardly across pages */
  #pap5SummaryTable tr,
  .print-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  #pap5SummaryTable th,
  #pap5SummaryTable td {
    border: 1px solid #000 !important;
    color: #000 !important;
    padding: 8px 4px !important;
    background: transparent !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }

  #pap5SummaryTable th:first-child,
  #pap5SummaryTable th:nth-child(2),
  #pap5SummaryTable td:first-child,
  #pap5SummaryTable td:nth-child(2) {
    position: static !important;
    background: transparent !important;
    border-right: 1px solid #000 !important;
  }

  @page {
    size: A4 portrait;
    margin: 15mm 12mm 15mm 12mm !important;
  }
}

/* =============================================================================
   --- PREMIUM MOBILE UX: CARD-ACCORDION SYSTEM ---
   ============================================================================= */
.mobile-accordion-view {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.mobile-accordion-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-accordion-card.open {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.95);
}

.accordion-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.accordion-header:hover {
  background: rgba(15, 23, 42, 0.02);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
}

.accordion-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  border-top: 0 solid var(--border-color);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-top 0.2s ease;
}

.mobile-accordion-card.open .accordion-body {
  max-height: 800px; /* High enough to contain content */
  padding: 16px 18px;
  border-top: 1px solid var(--border-color);
  opacity: 1;
  transform: translateY(0);
}

.chevron-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-accordion-card.open .chevron-icon {
  transform: rotate(180deg);
  color: var(--primary-color);
}

/* Mobile responsive selector switches */
@media (max-width: 768px) {
  /* Hide standard wide responsive tables in specific sections */
  #studentsModule .table-responsive,
  #attendanceModule #attendanceSummaryView .table-responsive,
  #attendanceModule #attendanceDailyView #attendanceCheckContainer,
  #scoresModule .table-responsive,
  #desirableTraitsModule .table-responsive,
  #analyticalReadingModule .table-responsive {
    display: none !important;
  }
  
  /* Show accordion layouts */
  .mobile-accordion-view {
    display: flex !important;
  }
  
  /* Giant touch buttons inside accordions */
  .mobile-grade-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
  }
  
  #pdfExportGrid {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    max-height: calc(85vh - 70px) !important;
    overflow-y: auto !important;
    padding: 16px !important;
    gap: 16px !important;
    box-sizing: border-box !important;
  }
  
  #pdfExportGrid > div:first-child {
    display: none !important;
  }
  
  .pdf-preview-outer {
    display: none !important;
  }
}

/* PDF Preview Window scaling */
.pdf-preview-outer {
  position: relative;
}

#pdfPreviewFrame {
  width: 210mm; /* A4 standard size width */
  min-height: 297mm; /* A4 standard height */
  transform: scale(0.48); /* scale down to fit preview container */
  transform-origin: top center;
  box-sizing: border-box;
}

#pdfOrientationSelect {
  cursor: pointer;
}

/* --- 27. PREMIUM BILLING & 3D CREDIT CARD FLIPPING STYLES --- */
.billing-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.billing-plan-card {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  background: white;
}

.billing-plan-card.active {
  border-color: var(--secondary-color);
  background: hsl(20, 100%, 98%);
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.1);
}

.billing-plan-card.active::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--secondary-color);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.billing-benefits-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 15px 0;
  padding: 12px;
  background: rgba(15, 23, 42, 0.03);
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  color: var(--text-color);
}

.billing-benefit-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.payment-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.payment-tab-btn {
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  border-radius: var(--border-radius-sm);
  transition: all 0.2s;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.payment-tab-btn.active {
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

/* 3D Flipping Card CSS */
.credit-card-container {
  perspective: 1000px;
  width: 100%;
  max-width: 340px;
  height: 200px;
  margin: 0 auto 24px auto;
}

.credit-card-3d-box {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.credit-card-container.flipped .credit-card-3d-box {
  transform: rotateY(180deg);
}

.credit-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 15px;
  padding: 20px;
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.credit-card-front {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.credit-card-back {
  background: linear-gradient(135deg, #0f172a, #020617);
  transform: rotateY(180deg);
  padding: 20px 0;
}

.card-chip {
  width: 45px;
  height: 35px;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  border-radius: 6px;
  position: relative;
}

.card-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.card-number-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.25rem;
  letter-spacing: 2px;
  word-spacing: 4px;
  margin: 20px 0 10px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.card-holder-wrapper {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.card-holder-label {
  opacity: 0.7;
  font-size: 0.6rem;
  margin-bottom: 2px;
}

.card-holder-name {
  font-weight: bold;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.card-exp-date {
  font-weight: bold;
  letter-spacing: 1px;
}

/* Card Back specifics */
.card-magnetic-strip {
  width: 100%;
  height: 40px;
  background: #000;
  margin-bottom: 15px;
}

.card-signature-strip {
  width: 80%;
  height: 35px;
  background: #f1f5f9;
  margin-left: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  color: #334155;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 0.95rem;
  border-radius: 4px;
  box-sizing: border-box;
}

.card-signature-strip::before {
  content: 'CVV';
  font-size: 0.55rem;
  color: #94a3b8;
  margin-right: 10px;
  text-transform: uppercase;
}

/* ==========================================================================
   --- 34. PREMIUM MOBILE OPTIMIZATIONS (BOTTOM NAV & BOTTOM SHEETS) ---
   ========================================================================== */

@media (max-width: 768px) {
  /* Prevent content clipping by bottom app bar */
  .main-viewport {
    padding-bottom: calc(85px + env(safe-area-inset-bottom)) !important;
  }

  /* Fixed Bottom Nav Container */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(66px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    justify-content: space-around;
    align-items: center;
    z-index: 9998;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.03);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'Kanit', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    gap: 4px;
    width: 20%;
    height: 100%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Active State Styling */
  .mobile-nav-item.active {
    color: var(--primary-color);
    font-weight: 700;
  }

  .mobile-nav-item.active svg {
    transform: translateY(-2px) scale(1.1);
    color: var(--primary-color);
  }

  /* iOS Native-style Bottom Sheets for Popups */
  dialog, dialog.premium-dialog {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 85vh !important;
    animation: mobileSlideUp 0.38s cubic-bezier(0.32, 0.94, 0.6, 1) !important;
    border: none !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.12) !important;
    overflow-y: auto !important;
    padding-bottom: calc(30px + env(safe-area-inset-bottom)) !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
  }

  dialog::backdrop {
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  @keyframes mobileSlideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* --- WORLD-CLASS MOBILE STYLING OVERRIDES --- */
  
  /* World-Class Sticky Mobile Header */
  .main-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    z-index: 999 !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.02) !important;
  }

  .main-header > div:first-of-type {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    gap: 12px !important;
  }

  .header-title h2 {
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    color: var(--primary-color) !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .header-title p,
  #mainHeaderSubtitle {
    display: none !important;
  }

  .header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  .classroom-switcher-header {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .classroom-switcher-header label {
    display: none !important;
  }

  #classroomSwitcherSelect {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 6px 20px 6px 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: var(--shadow-sm) !important;
    font-family: 'Kanit', sans-serif !important;
    color: var(--text-main) !important;
  }

  .date-badge {
    flex: 1 !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: var(--shadow-sm) !important;
    white-space: nowrap !important;
    color: var(--primary-color) !important;
  }

  #btnPrintA4Report {
    flex: 1.2 !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(12, 46, 107, 0.15) !important;
  }

  /* World-Class SaaS Jewel Metrics Cards */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 0 4px !important;
  }

  .stat-card {
    border: none !important;
    border-radius: 20px !important;
    padding: 20px !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease !important;
  }

  .stat-card:active {
    transform: scale(0.97) !important;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.02) !important;
  }

  /* Orchid Violet Purple Gradient */
  .stat-card[style*="var(--primary-color)"], 
  .stat-card[style*="hsl(210, 80%, 98%)"] {
    background: linear-gradient(135deg, hsl(275, 90%, 98%) 0%, hsl(275, 80%, 94%) 100%) !important;
    border: 1px solid rgba(12, 46, 107, 0.15) !important;
  }

  /* Emerald Green Gradient */
  .stat-card[style*="var(--color-present)"],
  .stat-card[style*="hsl(150, 80%, 98%)"] {
    background: linear-gradient(135deg, hsl(145, 90%, 98%) 0%, hsl(145, 80%, 93%) 100%) !important;
    border: 1px solid rgba(16, 185, 129, 0.15) !important;
  }

  /* Honey Amber Gradient */
  .stat-card[style*="var(--color-late)"],
  .stat-card[style*="hsl(38, 80%, 98%)"] {
    background: linear-gradient(135deg, hsl(38, 90%, 97%) 0%, hsl(38, 80%, 92%) 100%) !important;
    border: 1px solid rgba(245, 158, 11, 0.15) !important;
  }

  /* Touch-Friendly Targets Overhaul */
  .btn, button, a.btn {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Kanit', sans-serif !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .btn:active, button:active {
    transform: scale(0.95) !important;
  }

  /* Large Touch Pill selectors (e.g. 3-2-1 checkings) */
  .attendance-options, .traits-options, .reading-options {
    gap: 10px !important;
    margin-top: 8px !important;
  }

  .attendance-btn-label, .traits-btn-label {
    padding: 12px 10px !important;
    font-size: 0.9rem !important;
    border-radius: 14px !important;
    border: 1px solid var(--border-color) !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--shadow-sm) !important;
  }

  /* Input Form enhancements */
  input, select, textarea, .form-control {
    min-height: 46px !important;
    border-radius: 12px !important;
    border: 1.5px solid var(--border-color) !important;
    padding: 10px 14px !important;
    font-size: 0.95rem !important;
    background-color: #fafafa !important;
    transition: all 0.25s ease !important;
    box-sizing: border-box !important;
  }

  input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color) !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(12, 46, 107, 0.1) !important;
    outline: none !important;
  }

  /* Premium Mobile Panel Card */
  .panel-card {
    border-radius: 24px !important;
    border: 1px solid var(--border-color) !important;
    padding: 18px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.02) !important;
    margin-bottom: 20px !important;
  }

  .panel-header h3 {
    font-size: 1.18rem !important;
    font-weight: 700 !important;
  }

  /* Soft Glassmorphism Mobile Accordions */
  .mobile-accordion-card {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: 18px !important;
    padding: 16px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.02) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  }

  .mobile-accordion-card.active-card {
    border-color: var(--primary-color) !important;
    box-shadow: 0 8px 25px rgba(12, 46, 107, 0.08) !important;
  }

  /* Calm Design Mobile Grids Overrides to Prevent Side Overflow */
  .savings-info-summary {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .score-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .billing-plans-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .billing-benefits-list {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* Timetable & Dashboard Panel Mobile Overrides to Prevent Side Overflow */
  .dashboard-details-grid .panel-card {
    grid-column: span 1 !important;
  }

  #dashTodayScheduleContainer {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Base style fallback for desktop */
.mobile-bottom-nav {
  display: none;
}

/* ==========================================================================
   --- 35. STUDENTS ASSIGNMENT AND HOMEWORK MANAGEMENT STYLING ---
   ========================================================================== */

.assignments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.assignment-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  background: white;
}

.assignment-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(15, 23, 42, 0.15), 0 4px 12px -5px rgba(15, 23, 42, 0.05) !important;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

@media (max-width: 768px) {
  .assignments-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}






/* ==========================================================================
   LANDING PAGE STYLING (หน้าแรกก่อนเข้าใช้ระบบ - White Theme)
   ========================================================================== */
.landing-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #0f172a;
  font-family: 'Sarabun', 'Kanit', sans-serif;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  overflow-x: hidden;
  overflow-y: auto;
  animation: fadeIn 0.5s ease-out;
}

.landing-container.fade-out {
  opacity: 0;
  transform: scale(0.97) translateY(10px);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

body:not(.landing-disabled) {
  overflow: hidden; /* Lock body scrolling when landing page is active */
}

body:not(.landing-disabled) .app-container {
  display: none !important;
}

body.landing-disabled .landing-container {
  display: none !important;
}

body.landing-disabled .app-container {
  display: flex;
}

/* Landing Header */
.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 5%;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 1001;
}

.landing-logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.landing-logo {
  height: 38px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
}

.landing-logo-text {
  font-family: 'Kanit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, #0C2E6B 0%, #081F47 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Landing Main Layout */
.landing-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 5% 80px 5%;
  gap: 80px;
}

/* Hero Section */
.landing-hero {
  text-align: center;
  max-width: 850px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.landing-title {
  font-family: 'Kanit', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
}

@media (max-width: 768px) {
  .landing-title {
    font-size: 2.2rem;
  }
}

.landing-title .gradient-text {
  background: linear-gradient(135deg, #0C2E6B 0%, #dd211f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.landing-subtitle {
  font-size: 1.15rem;
  color: #475569;
  line-height: 1.7;
  max-width: 700px;
}

/* Buttons and Pulse */
.landing-hero-actions {
  margin-top: 12px;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.05rem;
  border-radius: 50px;
  font-weight: 700;
  font-family: 'Kanit', sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pulse-animation {
  box-shadow: 0 0 0 0 rgba(12, 46, 107, 0.2);
  animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(12, 46, 107, 0.3);
  }
  70% {
    transform: scale(1.02);
    box-shadow: 0 0 0 15px rgba(12, 46, 107, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(12, 46, 107, 0);
  }
}

/* Dashboard Mockup Display */
.landing-preview {
  width: 100%;
  max-width: 1000px;
  perspective: 1000px;
}

.landing-mockup {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 520px;
  transform: rotateX(5deg);
  transition: transform 0.5s ease;
}

.landing-mockup:hover {
  transform: rotateX(0deg) scale(1.01);
}

.mockup-header {
  background: #f8fafc;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
}

.mockup-dots {
  display: flex;
  gap: 6px;
  margin-right: 20px;
}

.mockup-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }

.mockup-title {
  color: #64748b;
  font-size: 0.75rem;
  font-family: monospace;
  letter-spacing: 0.5px;
}

.mockup-body {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
}

.mockup-sidebar {
  width: 180px;
  background: #f1f5f9;
  border-right: 1px solid rgba(15, 23, 42, 0.05);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mockup-sidebar-logo {
  font-family: 'Kanit', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  padding: 0 8px 12px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
}

.mockup-sidebar-item {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 6px;
  color: #475569;
}

.mockup-sidebar-item.active {
  background: rgba(12, 46, 107, 0.08);
  color: #0c2e6b;
  font-weight: bold;
}

.mockup-content {
  flex-grow: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #fafafa;
  overflow-y: auto;
}

.mockup-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mockup-stat-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.mstat-title {
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 6px;
}

.mstat-val {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #0c2e6b;
}

.mockup-chart-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.mchart-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.mchart-bar-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mchart-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
}

.mbar-label {
  width: 80px;
  color: #475569;
}

.mbar-track {
  flex-grow: 1;
  height: 8px;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.mbar-fill {
  height: 100%;
  background: linear-gradient(to right, #0C2E6B, #3b82f6);
  border-radius: 4px;
}

.mbar-val {
  width: 32px;
  text-align: right;
  font-weight: bold;
  color: #0f172a;
}

/* Feature Grid */
.landing-features {
  width: 100%;
  max-width: 1000px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.section-title {
  font-family: 'Kanit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  width: 100%;
}

.feature-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 24px;
  border-radius: 12px;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.02);
}

.feature-card:hover {
  transform: translateY(-5px);
  background: #ffffff;
  border-color: rgba(12, 46, 107, 0.25);
  box-shadow: 0 12px 24px -10px rgba(12, 46, 107, 0.12);
}

.feature-icon {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.feature-title {
  font-family: 'Kanit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.feature-desc {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.6;
}

/* Cloud / Security Banner */
.landing-banner {
  width: 100%;
  max-width: 900px;
  background: radial-gradient(circle at top left, rgba(12, 46, 107, 0.05) 0%, rgba(241, 245, 249, 0.95) 100%);
  border: 1px solid rgba(12, 46, 107, 0.15);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.banner-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #0c2e6b;
  background: rgba(12, 46, 107, 0.08);
  padding: 6px 14px;
  border-radius: 50px;
  border: 1px solid rgba(12, 46, 107, 0.2);
}

.banner-title {
  font-family: 'Kanit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #0c2e6b;
}

.banner-desc {
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.6;
  max-width: 700px;
}

/* Bottom CTA and Footer */
.landing-cta-bottom {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 700px;
}

.cta-title {
  font-family: 'Kanit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #0f172a;
}

.cta-desc {
  font-size: 1.05rem;
  color: #475569;
  line-height: 1.6;
}

.landing-footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  width: 100%;
}

.landing-footer p {
  font-size: 0.78rem;
  color: #64748b;
}

/* Fix mobile mockup sizing */
@media (max-width: 992px) {
  .landing-mockup {
    height: 400px;
  }
  .mockup-sidebar {
    width: 60px;
    padding: 20px 4px;
  }
  .mockup-sidebar-logo, .mockup-sidebar-item {
    text-indent: -9999px;
    white-space: nowrap;
    overflow: hidden;
    padding: 8px;
    text-align: center;
  }
  .mockup-sidebar-logo::before {
    content: "ครู";
    text-indent: 0;
    display: block;
    color: #0f172a;
  }
  .mockup-sidebar-item:nth-child(2)::before { content: "🏫"; text-indent: 0; display: block; }
  .mockup-sidebar-item:nth-child(3)::before { content: "👥"; text-indent: 0; display: block; }
  .mockup-sidebar-item:nth-child(4)::before { content: "📝"; text-indent: 0; display: block; }
  .mockup-sidebar-item:nth-child(5)::before { content: "💰"; text-indent: 0; display: block; }
}
