/* ==========================================================================
   ระบบข้อมูลสารสนเทศด้านการศึกษาจังหวัดอุบลราชธานี ปีการศึกษา 2569
   Official Government Educational Dashboard Stylesheet
   Theme: Left Sidebar Layout, Deep Royal Navy Blue, Regal Thai Gold, Clean Crisp White
   ========================================================================== */

:root {
  /* Brand Colors */
  --primary-dark: #0a192f;
  --primary: #102a43;
  --primary-light: #1e3a8a;
  --primary-hover: #234e9e;
  --accent-gold: #c59b27;
  --accent-gold-light: #dfb843;
  --accent-gold-gradient: linear-gradient(135deg, #c59b27 0%, #f6d365 50%, #c59b27 100%);
  --accent-navy-gradient: linear-gradient(135deg, #0a192f 0%, #102a43 60%, #1e3a8a 100%);

  /* Neutrals & UI */
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --border-highlight: rgba(197, 155, 39, 0.35);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  --text-gold: #b45309;

  /* Metric & Chart Accents */
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --indigo: #4f46e5;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --green: #10b981;
  --green-light: #d1fae5;
  --teal: #0d9488;
  --cyan: #06b6d4;
  --cyan-light: #cffafe;
  --pink: #ec4899;
  --pink-light: #fce7f3;
  --rose: #e11d48;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06);

  /* Dimensions */
  --sidebar-width: 270px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-page: #0b1322;
  --bg-card: #131f33;
  --bg-card-subtle: #192740;
  --border-color: #203352;
  --border-highlight: rgba(246, 211, 101, 0.3);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-gold: #fcd34d;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

/* Base Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Prompt', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* App Shell Layout (Sidebar + Main Content) */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- LEFT SIDEBAR STYLES --- */
.sidebar-wrapper {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  border-right: 2px solid rgba(197, 155, 39, 0.3);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.sidebar-brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 0 10px rgba(197, 155, 39, 0.5);
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.sidebar-brand-text p {
  font-size: 0.76rem;
  color: var(--accent-gold-light);
  margin-top: 2px;
}

.sidebar-year-badge {
  margin: 14px 18px 8px;
  background: rgba(197, 155, 39, 0.15);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold-light);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.nav-tab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-tab-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  color: #94a3b8;
  transition: var(--transition);
}

.nav-tab-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-tab-item:hover i {
  color: var(--accent-gold-light);
}

.nav-tab-item.active {
  background: rgba(197, 155, 39, 0.15);
  color: var(--accent-gold-light);
  font-weight: 600;
  border-left-color: var(--accent-gold);
}

.nav-tab-item.active i {
  color: var(--accent-gold);
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.84rem;
  font-family: inherit;
  transition: var(--transition);
  width: 100%;
}

.theme-toggle-btn:hover {
  background: var(--accent-gold);
  color: var(--primary-dark);
}

.sidebar-credit {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
}

/* --- MAIN WORKSPACE STYLES --- */
.main-content-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Workspace Top Header */
.workspace-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 990;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title-box h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-title-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px 8px;
}

/* Main Container Layout */
.main-wrapper {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 28px 48px;
  flex: 1;
}

/* Hero Section */
.hero-banner {
  background: var(--accent-navy-gradient);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(10, 25, 47, 0.2);
  border: 1px solid rgba(197, 155, 39, 0.3);
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(197, 155, 39, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(197, 155, 39, 0.25);
  border: 1px solid var(--accent-gold);
  color: #fef08a;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.hero-title {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
  color: #cbd5e1;
  font-size: 0.92rem;
  max-width: 950px;
  line-height: 1.5;
}

.hero-meta-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #94a3b8;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-meta-item i {
  color: var(--accent-gold-light);
}

/* Interactive Filter Bar */
.filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

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

.filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.filter-title i {
  color: var(--primary-light);
}

[data-theme="dark"] .filter-title i {
  color: var(--accent-gold-light);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
}

.filter-select, .filter-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.filter-select:focus, .filter-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-btn-reset {
  padding: 9px 16px;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  height: 42px;
}

.filter-btn-reset:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Stat Grid (KPI Tiles) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.stat-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -3px rgba(15, 23, 42, 0.1);
}

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

.stat-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--tile-bg, var(--blue-light));
  color: var(--tile-color, var(--blue));
}

.stat-tile-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.stat-tile-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-tile-value {
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat-tile-sub {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Gender Proportion Banner */
.gender-ratio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.gender-bar-wrapper {
  margin: 12px 0 10px;
}

.gender-bar-track {
  height: 22px;
  border-radius: 11px;
  display: flex;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gender-segment-male {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  transition: width 0.4s ease;
}

.gender-segment-female {
  background: linear-gradient(90deg, #db2777, #f43f5e);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  transition: width 0.4s ease;
}

.gender-legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.88rem;
}

.gender-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-male { background: #2563eb; }
.dot-female { background: #db2777; }

/* Dashboard Grids */
.dashboard-row {
  display: grid !important;
  grid-template-columns: repeat(12, 1fr) !important;
  gap: 20px;
  margin-bottom: 24px;
  width: 100% !important;
}

.dashboard-row > [class*="col-"] {
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
  min-width: 0 !important;
  padding: 0 !important;
}

.dashboard-row > .col-12 { grid-column: span 12 !important; }
.dashboard-row > .col-8  { grid-column: span 8 !important; }
.dashboard-row > .col-7  { grid-column: span 7 !important; }
.dashboard-row > .col-6  { grid-column: span 6 !important; }
.dashboard-row > .col-5  { grid-column: span 5 !important; }
.dashboard-row > .col-4  { grid-column: span 4 !important; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header h3 i {
  color: var(--accent-gold);
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm-action {
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.btn-sm-action:hover, .btn-sm-action.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.chart-container-relative {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 320px;
}

/* District Grid Cards */
.district-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.district-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.district-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.district-card.active-filter {
  border: 2px solid var(--accent-gold);
  background: rgba(197, 155, 39, 0.05);
}

.district-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.district-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
}

.district-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--blue);
}

.district-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.district-schools {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.district-students {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-light);
}

[data-theme="dark"] .district-students {
  color: var(--accent-gold-light);
}

.district-progress {
  height: 6px;
  background: var(--bg-card-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.district-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--accent-gold));
  border-radius: 3px;
}

/* --- DISTRICT DETAIL MODAL --- */
.gov-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gov-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 47, 0.7);
  backdrop-filter: blur(4px);
}

.gov-modal-content {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.gov-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-subtle);
}

.gov-modal-header h3 {
  font-size: 1.2rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

[data-theme="dark"] .gov-modal-header h3 {
  color: var(--accent-gold-light);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #dc2626;
}

.gov-modal-body {
  padding: 24px;
}

.modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.modal-kpi-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.modal-kpi-box .val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-light);
}

[data-theme="dark"] .modal-kpi-box .val {
  color: var(--accent-gold-light);
}

.modal-kpi-box .lbl {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-school-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.modal-school-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.modal-school-item:last-child {
  border-bottom: none;
}

.modal-school-item:nth-child(even) {
  background: var(--bg-card-subtle);
}

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

/* --- DATA TABLE & STICKY COLUMNS STYLES --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  max-height: 680px;
}

.gov-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.86rem;
}

.gov-table th {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 5;
}

.gov-table th:hover {
  background: rgba(197, 155, 39, 0.1);
}

.gov-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.gov-table tr:hover td {
  background: rgba(37, 99, 235, 0.04);
}

/* Sticky Left Columns for School Directory Table */
.gov-table th.sticky-col-1, .gov-table td.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
}

.gov-table th.sticky-col-2, .gov-table td.sticky-col-2 {
  position: sticky;
  left: 50px;
  z-index: 10;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
}

.gov-table th.sticky-col-3, .gov-table td.sticky-col-3 {
  position: sticky;
  left: 145px;
  z-index: 10;
  background: var(--bg-card);
  border-right: 2px solid var(--border-color);
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.gov-table th.sticky-col-1, .gov-table th.sticky-col-2, .gov-table th.sticky-col-3 {
  z-index: 15;
  background: var(--bg-card-subtle);
}

.gov-table .text-center { text-align: center; }
.gov-table .text-right { text-align: right; }

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 4px;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

.pagination-btn {
  padding: 5px 11px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.84rem;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #ffffff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--primary-light);
  color: #ffffff;
  border-color: var(--primary-light);
}

/* Booklet / Pamphlet Section */
.pamphlet-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.pamphlet-header {
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--accent-gold);
  margin-bottom: 22px;
}

.pamphlet-header h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 6px;
}

[data-theme="dark"] .pamphlet-header h2 {
  color: var(--accent-gold-light);
}

.pamphlet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.pamphlet-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.pamphlet-box h4 {
  font-size: 1rem;
  color: var(--primary-light);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .pamphlet-box h4 {
  color: var(--accent-gold-light);
}

.pamphlet-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.86rem;
}

.pamphlet-row:last-child {
  border-bottom: none;
  font-weight: 600;
}

/* Section Title */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.section-heading h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading h2 i {
  color: var(--accent-gold);
}

/* Footer */
.gov-footer {
  background: var(--primary-dark);
  color: #94a3b8;
  padding: 32px 20px 20px;
  border-top: 3px solid var(--accent-gold);
  margin-top: 40px;
  font-size: 0.85rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.footer-logo-row img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  padding: 2px;
}

.footer-title {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.98rem;
}

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

/* Print Styles */
@media print {
  .sidebar-wrapper, .workspace-header, .filter-card, .btn-sm-action, .theme-toggle-btn, .sidebar-backdrop, .toast-container {
    display: none !important;
  }
  .main-content-wrapper {
    margin-left: 0 !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .chart-card, .stat-tile, .pamphlet-card, .feedback-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   MOBILE OFFCANVAS SIDEBAR & RESPONSIVE DESIGN
   ========================================================================== */

/* Mobile Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 47, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1045;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Mobile Sidebar Close Button */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 1.15rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.sidebar-close-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

/* Header Badges */
.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-stat-header {
  font-size: 0.82rem;
  background: rgba(10, 25, 47, 0.85);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.3);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.badge-stat-header strong {
  color: #ffffff;
}

[data-theme="dark"] .badge-stat-header {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(147, 197, 253, 0.2);
}

.badge-rating-header {
  font-size: 0.82rem;
  background: rgba(197, 155, 39, 0.15);
  color: var(--text-gold);
  border: 1px solid var(--accent-gold);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: var(--transition);
  text-decoration: none;
}

.badge-rating-header:hover {
  background: var(--accent-gold);
  color: #0a192f;
  transform: translateY(-1px);
}

/* Mobile Table Hint */
.mobile-table-hint {
  display: block;
  line-height: 1.5;
  background: rgba(197, 155, 39, 0.12);
  border: 1px dashed var(--accent-gold);
  color: var(--text-gold);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.82rem;
}

/* Touch Scrolling for 38-Column Table */
.table-responsive {
  width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 70vh !important;
  min-height: 380px;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  position: relative;
  background: var(--bg-card);
}

.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(197, 155, 39, 0.45);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-card-subtle);
}

/* ==========================================================================
   FEEDBACK & SATISFACTION EVALUATION COMPONENT
   ========================================================================== */

.feedback-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.feedback-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.feedback-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-header-title i {
  font-size: 1.6rem;
  color: var(--accent-gold);
}

.feedback-header-title h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.feedback-header-title p {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin: 0;
}

.feedback-header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Summary Score Section (2 Columns) */
.feedback-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  margin-bottom: 28px;
}

.score-box-left {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.score-big-num {
  font-size: 3.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -1px;
}

.score-stars-display {
  color: #f59e0b;
  font-size: 1.35rem;
  margin: 10px 0 8px;
  display: flex;
  gap: 4px;
}

.score-satisfaction-desc {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-light);
}

[data-theme="dark"] .score-satisfaction-desc {
  color: var(--accent-gold-light);
}

.score-box-right {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.rating-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.rating-bar-label {
  width: 48px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}

.rating-bar-track {
  flex: 1;
  height: 9px;
  background: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.rating-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  border-radius: 6px;
  transition: width 0.5s ease-in-out;
}

.rating-bar-pct {
  width: 42px;
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Evaluation Form Box */
.feedback-form-box {
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.stars-picker-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stars-picker-wrap label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.interactive-stars {
  display: flex;
  gap: 6px;
  font-size: 1.6rem;
  color: #cbd5e1;
  cursor: pointer;
}

.interactive-stars i {
  transition: transform 0.15s ease, color 0.15s ease;
}

.interactive-stars i:hover {
  transform: scale(1.2);
}

.interactive-stars i.active {
  color: #f59e0b;
}

.star-rating-hint {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f59e0b;
}

/* Highlights / Features Tag Pills */
.form-tags-section {
  margin-bottom: 20px;
}

.form-tags-section label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.feature-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-pill {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.feature-pill:hover {
  border-color: var(--accent-gold);
  background: rgba(197, 155, 39, 0.08);
}

.feature-pill.selected {
  background: rgba(197, 155, 39, 0.18);
  border-color: var(--accent-gold);
  color: var(--text-gold);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(197, 155, 39, 0.15);
}

/* Comments Textarea */
.form-comment-section {
  margin-bottom: 20px;
}

.feedback-textarea {
  width: 100%;
  min-height: 85px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.feedback-textarea:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.15);
}

.form-submit-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.btn-feedback-submit {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--accent-gold);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(10, 25, 47, 0.2);
}

.btn-feedback-submit:hover {
  background: var(--accent-navy-gradient);
  border-color: var(--accent-gold);
  box-shadow: 0 6px 16px rgba(197, 155, 39, 0.3);
  transform: translateY(-1px);
}

/* Recent Reviews Feed */
.recent-reviews-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.recent-reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.recent-reviews-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-item-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.review-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.review-role-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-light);
}

.review-time {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.review-stars {
  color: #f59e0b;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.review-comment-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 8px;
}

.review-tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-tag-chip {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* Online Database Status & Google Sheets Setting */
.online-db-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 24px;
  font-size: 0.86rem;
  color: var(--text-main);
}

/* ==========================================================================
   TOAST NOTIFICATION COMPONENT
   ========================================================================== */

.gov-toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--accent-gold);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  margin-top: 10px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 320px;
  max-width: 420px;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.gov-toast i.toast-icon {
  font-size: 1.3rem;
  color: var(--accent-gold);
}

.gov-toast.toast-success i.toast-icon {
  color: #10b981;
}

.gov-toast-content {
  flex: 1;
}

.gov-toast-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.gov-toast-msg {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (BOOTSTRAP & MOBILE TUNING)
   ========================================================================== */

@media (max-width: 1024px) {
  .sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar-wrapper.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .main-content-wrapper {
    margin-left: 0 !important;
  }

  .mobile-menu-toggle {
    display: block !important;
  }

  .dashboard-row > [class*="col-"] {
    grid-column: span 12 !important;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .feedback-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-wrapper {
    padding: 14px 16px;
  }

  .hero-banner {
    padding: 16px 18px;
  }

  .hero-title {
    font-size: 1.25rem;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-tile {
    padding: 14px;
  }

  .stat-tile-value {
    font-size: 1.55rem;
  }

  .district-grid {
    grid-template-columns: 1fr;
  }

  /* Sticky columns for 38-column table on Mobile touch */
  .gov-table th.sticky-col-1, .gov-table td.sticky-col-1 {
    left: 0;
    min-width: 32px;
    width: 32px;
    font-size: 0.74rem;
    padding: 8px 4px;
    text-align: center;
  }

  .gov-table th.sticky-col-2, .gov-table td.sticky-col-2 {
    position: static !important;
    box-shadow: none !important;
  }

  .gov-table th.sticky-col-3, .gov-table td.sticky-col-3 {
    left: 32px;
    min-width: 105px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
    font-size: 0.76rem;
    padding: 8px 6px;
  }

  .table-responsive {
    max-height: 62vh !important;
  }

  .form-rating-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .score-big-num {
    font-size: 3rem;
  }

  .workspace-header {
    padding: 10px 14px;
  }

  .header-badges {
    display: none; /* Hidden on very small screens to fit title */
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MOBILE TOP HORIZONTAL SCROLL NAV BAR
   ========================================================================== */
.mobile-top-nav-bar {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  position: sticky;
  top: 0;
  z-index: 990;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-nav-scroll-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}

.mobile-nav-scroll-container::-webkit-scrollbar {
  display: none;
}

.mobile-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-nav-pill i {
  color: var(--accent-gold);
  font-size: 0.85rem;
}

.mobile-nav-pill.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--accent-gold) !important;
  box-shadow: 0 2px 8px rgba(10, 25, 47, 0.25);
  font-weight: 600;
}

.mobile-nav-pill.active i {
  color: var(--accent-gold-light) !important;
}

/* ==========================================================================
   MOBILE BOTTOM QUICK NAV BAR (THUMB ZONE)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(10, 25, 47, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(197, 155, 39, 0.4);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1040;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s ease;
  min-width: 58px;
}

.bottom-nav-item i {
  font-size: 1.18rem;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.bottom-nav-item.active {
  color: var(--accent-gold-light);
  font-weight: 700;
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
  color: var(--accent-gold-light);
}

@media (max-width: 1024px) {
  .mobile-top-nav-bar {
    display: block;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .main-content-wrapper {
    padding-bottom: 74px !important;
  }
}

/* ==========================================================================
   SCHOOL DETAIL MODAL & MOBILE COMPACT TABLE STYLES
   ========================================================================== */
.school-modal-content {
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.school-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.school-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.school-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 650px) {
  .school-stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.school-stat-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.school-stat-card .val {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--primary-light);
  line-height: 1.2;
}

.school-stat-card .lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.level-card-section {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}

.level-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.level-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-light);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.level-pills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.level-pill-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.level-pill-box:hover {
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

.level-pill-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.level-pill-row-top .name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

.level-pill-row-top .count {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-light);
}

.level-pill-gender {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding-top: 4px;
  border-top: 1px dashed var(--border-color);
}

.pill-gender-m {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pill-gender-f {
  color: var(--pink);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.level-header-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.level-total-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-light);
}

.level-gender-sub {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-school-view-detail {
  background: var(--primary);
  color: #ffffff !important;
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.btn-school-view-detail:hover {
  background: var(--accent-gold);
  color: var(--primary-dark) !important;
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

/* Mobile Table Compact Mode (Fits 100% width on mobile without horizontal scroll) */
.gov-table.table-compact-mobile {
  table-layout: fixed;
  width: 100%;
}

.gov-table.table-compact-mobile th,
.gov-table.table-compact-mobile td {
  padding: 8px 3px;
  white-space: normal;
  vertical-align: middle;
}

.gov-table.table-compact-mobile th:nth-child(1),
.gov-table.table-compact-mobile td:nth-child(1) {
  width: 26px;
  text-align: center;
  position: static !important;
  box-shadow: none !important;
  padding-left: 2px;
  padding-right: 2px;
}

.gov-table.table-compact-mobile th:nth-child(2),
.gov-table.table-compact-mobile td:nth-child(2) {
  width: auto;
  position: static !important;
  box-shadow: none !important;
}

.gov-table.table-compact-mobile th:nth-child(3),
.gov-table.table-compact-mobile td:nth-child(3) {
  width: 74px;
  text-align: right;
  white-space: nowrap;
  position: static !important;
  box-shadow: none !important;
}

.gov-table.table-compact-mobile th:nth-child(4),
.gov-table.table-compact-mobile td:nth-child(4) {
  width: 78px;
  text-align: center;
  white-space: nowrap;
  position: static !important;
  box-shadow: none !important;
  padding-right: 4px;
}

/* Mobile School Compact Table styling */
.mobile-school-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.35;
}

.mobile-school-subtags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.school-tag-amphoe {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(197, 155, 39, 0.15);
  color: var(--text-gold);
  font-weight: 600;
}

.school-tag-khet {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-card-subtle);
  color: var(--text-muted);
}

.school-tag-gcode {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}

.mobile-school-total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-light);
  line-height: 1.2;
}

.mobile-school-mf {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.school-row-clickable {
  cursor: pointer;
}

.school-row-clickable:hover {
  background: rgba(197, 155, 39, 0.08) !important;
}


