@import url("https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,600&display=swap");

:root {
  --font-family-base: "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #64748b;
  --accent: #f59e0b;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --info: #06b6d4;
  --info-bg: #ecfeff;
  --dark: #0f172a;
  --card-bg: #ffffff;
  --body-bg: #f1f5f9;
  --border-color: #e2e8f0;
  --card-radius: 14px;
  --btn-radius: 10px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 20px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
  --shadow-hover: 0 15px 22px -4px rgba(15, 23, 42, 0.09), 0 6px 8px -4px rgba(15, 23, 42, 0.03);
}

* {
  box-sizing: border-box;
}

html, body {
  font-size: 15.5px; /* Slightly increased for better readability */
}

body {
  font-family: var(--font-family-base) !important;
  font-weight: 400 !important; /* Regular text 400 */
  background-color: var(--body-bg);
  color: #334155;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
}

/* Headings scaled & weight 600 */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-family-base) !important;
  font-weight: 600 !important; /* Bold is 600 */
  color: #0f172a;
  letter-spacing: -0.01em;
}

h1, .h1 { font-size: 1.75rem !important; }
h2, .h2 { font-size: 1.5rem !important; }
h3, .h3 { font-size: 1.32rem !important; }
h4, .h4 { font-size: 1.18rem !important; }
h5, .h5 { font-size: 1.05rem !important; }
h6, .h6 { font-size: 0.95rem !important; }

/* Override strong / b / fw-bold / fw-semibold to 600 */
strong, b, .fw-bold, .fw-semibold, .fw-bolder {
  font-weight: 600 !important;
}

/* Override regular / normal / fw-normal / text-muted to 400 */
p, span, div, td, th, li, a, label, input, select, textarea, .fw-normal, .fw-light {
  font-weight: 400;
}

/* Navbar */
.navbar-school {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #0284c7 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.15);
}

.navbar-brand {
  font-weight: 600 !important;
  font-size: 1.1rem;
}

.navbar-brand small {
  font-weight: 400 !important;
  font-size: 0.74rem;
  opacity: 0.85;
}

.nav-link {
  font-weight: 400 !important;
  border-radius: 8px;
  padding: 6px 12px !important;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88) !important;
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff !important;
  font-weight: 600 !important;
  background: rgba(255, 255, 255, 0.18);
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: #ffffff;
  border-radius: var(--card-radius);
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow: 0 10px 24px -6px rgba(37, 99, 235, 0.28);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

@media (max-width: 767.98px) {
  .hero-banner {
    padding: 16px;
    margin-bottom: 16px;
  }
}

.hero-banner h1, .hero-banner .display-6 {
  font-size: 1.55rem !important;
  font-weight: 600 !important;
}

.hero-banner .display-4 {
  font-size: 2rem !important;
  font-weight: 600 !important;
}

/* Stat Cards */
.stat-card {
  background: var(--card-bg);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

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

.stat-card .fs-2 {
  font-size: 1.45rem !important;
  font-weight: 600 !important;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Custom Cards */
.card-custom {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: all 0.25s ease;
  overflow: hidden;
}

.card-custom:hover, .hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.12) !important;
}

.transition-all {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern Gradient Login Cards */
.login-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.35), transparent 70%);
  pointer-events: none;
}

.login-card-student {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 50%, #bfdbfe 100%) !important;
  border-left: 5px solid #2563eb !important;
}
.login-card-student:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 60%, #93c5fd 100%) !important;
}

.login-card-teacher {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%) !important;
  border-left: 5px solid #059669 !important;
}
.login-card-teacher:hover {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 60%, #6ee7b7 100%) !important;
}

.login-card-admin {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%) !important;
  border-left: 5px solid #0f172a !important;
}
.login-card-admin:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 60%, #cbd5e1 100%) !important;
}

.card-custom .card-header {
  background-color: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: 14px 18px;
  font-weight: 600 !important;
  font-size: 0.98rem;
}

.card-custom .card-body {
  padding: 18px;
}

/* Badges */
.badge {
  font-family: var(--font-family-base) !important;
  font-weight: 600 !important;
  font-size: 0.82rem;
  padding: 5px 11px;
  border-radius: 6px;
}

.badge-pill, .rounded-pill {
  border-radius: 50rem !important;
}

.bg-primary-subtle { background-color: #eff6ff !important; color: #1d4ed8 !important; }
.bg-success-subtle { background-color: #ecfdf5 !important; color: #047857 !important; }
.bg-danger-subtle { background-color: #fef2f2 !important; color: #b91c1c !important; }
.bg-warning-subtle { background-color: #fffbeb !important; color: #b45309 !important; }
.bg-info-subtle { background-color: #ecfeff !important; color: #0e7490 !important; }

/* Buttons */
.btn {
  font-family: var(--font-family-base) !important;
  font-weight: 600 !important;
  font-size: 0.9rem;
  border-radius: var(--btn-radius);
  padding: 7px 15px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-sm {
  font-size: 0.84rem;
  padding: 5px 12px;
}

.btn-lg {
  font-size: 1rem;
  padding: 9px 22px;
}

.btn-pill {
  border-radius: 50rem;
  padding: 6px 18px;
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Progress Bars */
.progress {
  background-color: #e2e8f0;
  border-radius: 50rem;
  overflow: hidden;
}

.progress-thin {
  height: 6px;
}

.progress-medium {
  height: 9px;
}

.progress-bar {
  border-radius: 50rem;
  transition: width 0.6s ease;
}

/* Form Controls */
.form-control, .form-select {
  font-family: var(--font-family-base) !important;
  font-weight: 400 !important;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  font-size: 0.92rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-label {
  font-weight: 600 !important;
  font-size: 0.88rem;
  margin-bottom: 5px;
}

/* Tables */
.table-custom {
  font-family: var(--font-family-base) !important;
  font-size: 0.9rem;
}

.table-custom th {
  background-color: #f8fafc !important;
  color: #475569;
  font-weight: 600 !important;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 11px 14px;
  border-bottom: 2px solid #e2e8f0;
}

.table-custom td {
  padding: 11px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 400;
}

.table-hover tbody tr:hover {
  background-color: #f8fafc;
}

/* Font sizes helpers */
.fs-7 { font-size: 0.85rem !important; }
.fs-8 { font-size: 0.78rem !important; }

/* DataTables elements */
.dataTables_wrapper {
  font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  font-size: 0.85rem !important;
  padding: 5px 12px !important;
  border-radius: 6px !important;
  font-family: var(--font-family-base) !important;
  font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_filter input {
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 5px 12px;
}

/* Footer */
footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  color: #64748b;
  padding: 20px 0;
  margin-top: auto;
  font-size: 0.85rem;
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background-color: #ffffff !important;
    font-size: 12px;
  }
}

/* Registration Status Badges & Blinking Animation */
@keyframes pulse-dot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    opacity: 1;
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 9px rgba(16, 185, 129, 0);
    opacity: 0.85;
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    opacity: 1;
  }
}

@keyframes blink-glow {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.6));
  }
  50% {
    opacity: 0.55;
    filter: drop-shadow(0 0 1px rgba(16, 185, 129, 0.2));
  }
}

.status-badge-open {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #6ee7b7 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
}

.status-badge-open-hero {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #a7f3d0 !important;
  border: 1px solid rgba(52, 211, 153, 0.5) !important;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
}

.status-dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  animation: pulse-dot 1.5s infinite cubic-bezier(0.45, 0, 0.55, 1), blink-glow 1.5s infinite ease-in-out;
}

.status-badge-closed {
  background-color: #fef2f2 !important;
  color: #991b1b !important;
  border: 1px solid #fca5a5 !important;
  display: inline-flex;
  align-items: center;
}

.status-badge-closed-hero {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(248, 113, 113, 0.5) !important;
  backdrop-filter: blur(6px);
  display: inline-flex;
  align-items: center;
}

.status-dot-closed {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ef4444;
  display: inline-block;
  opacity: 0.85;
}