:root {
  --app-bg: #eef3f9;
  --app-surface: #ffffff;
  --app-ink: #1f2937;
  --app-muted: #5f6b7a;
  --app-primary: #0f4c81;
  --app-primary-soft: #e2edf9;
  --app-accent: #0d6efd;
  --app-border: #d8e0ea;
  --app-shadow: 0 16px 32px rgba(18, 40, 74, 0.08);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Noto Sans Thai", sans-serif;
  color: var(--app-ink);
  background: radial-gradient(circle at top right, #dcecff 0%, #f3f7fc 40%, #eaf0f7 100%);
  padding-top: 88px;
}

a {
  color: var(--app-primary);
}

a:hover {
  color: #0b3d69;
}

.app-navbar {
  background: linear-gradient(135deg, #ffffff 0%, #f6faff 100%);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 8px 20px rgba(10, 27, 53, 0.08);
}

.app-navbar .navbar-brand {
  color: #0b2d52;
  letter-spacing: 0.1px;
}

.app-navbar .nav-link {
  color: #29455f;
  font-weight: 500;
  border-radius: 0.55rem;
  padding: 0.45rem 0.85rem;
  transition: all 0.2s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  color: #0f4c81;
  background: var(--app-primary-soft);
}

.hero-card {
  background: linear-gradient(140deg, #113b63 0%, #195286 50%, #3b7db5 100%);
  border-radius: 1rem;
  padding: 2.2rem;
  color: #fff;
  box-shadow: var(--app-shadow);
}

.hero-card__eyebrow {
  font-size: 0.96rem;
  opacity: 0.95;
  letter-spacing: 0.3px;
}

.hero-card__title {
  margin: 0.55rem 0 0.8rem;
  font-size: clamp(1.7rem, 2.5vw, 2.3rem);
  line-height: 1.3;
  font-weight: 700;
}

.hero-card__text {
  margin-bottom: 1.2rem;
  color: rgba(255, 255, 255, 0.93);
}

.section-title {
  margin: 0;
  font-family: "Noto Sans Thai", sans-serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  color: #183657;
}

.news-card {
  border: 1px solid var(--app-border);
  border-radius: 0.95rem;
  overflow: hidden;
  background: var(--app-surface);
  box-shadow: 0 10px 20px rgba(18, 40, 74, 0.06);
}

.news-card__image {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.news-card__body {
  padding: 1.1rem 1.1rem 1.2rem;
}

.news-card__title {
  font-size: 1.06rem;
  font-weight: 700;
  color: #163a63;
  margin-bottom: 0.5rem;
}

.news-card__text {
  color: var(--app-muted);
  margin-bottom: 0.7rem;
}

.news-card__meta {
  color: #768395;
  font-size: 0.9rem;
}

.card,
.table,
.list-group-item {
  border-color: var(--app-border);
}

.card {
  border-radius: 0.9rem;
  box-shadow: 0 8px 18px rgba(20, 42, 70, 0.06);
}

.table {
  background: #fff;
  border-radius: 0.8rem;
  overflow: hidden;
}

.table thead th {
  background: #edf4fc;
  color: #12375f;
  border-bottom: 1px solid #d4deea;
}

.btn {
  border-radius: 0.6rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  line-height: 1.35;
}

.btn.btn-sm {
  padding: 0.35rem 0.75rem;
}

.btn.btn-lg {
  padding: 0.66rem 1.25rem;
}

.btn-primary {
  background: linear-gradient(130deg, #0f4c81 0%, #2167a5 100%);
  border-color: #0f4c81;
}

.btn-success {
  background: linear-gradient(130deg, #116b57 0%, #1b8a70 100%);
  border-color: #116b57;
}

.btn-outline-light:hover {
  color: #0f3f6b;
}

.form-control,
.form-select,
.custom-select {
  border-radius: 0.6rem;
  border: 1px solid #cdd8e6;
  padding: 0.58rem 0.8rem;
}

.form-control:focus,
.form-select:focus,
.custom-select:focus {
  border-color: #7ea6cc;
  box-shadow: 0 0 0 0.2rem rgba(33, 103, 165, 0.16);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.2rem 1rem;
  background: radial-gradient(circle at top left, #dcecff 0%, #edf4fb 50%, #f6f9fd 100%);
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
}

.form-signin {
  width: 100%;
  max-width: 100%;
  padding: 1.65rem;
  margin: 0;
  border-radius: 1rem;
  border: 1px solid var(--app-border);
  background: #fff;
  box-shadow: var(--app-shadow);
}

.form-signin .brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 0.8rem;
  background: linear-gradient(140deg, #0f4c81 0%, #2f72ae 100%);
  color: #fff;
  font-size: 1.25rem;
}

.form-signin .form-control {
  margin-bottom: 0.72rem;
}

.form-signin .btn + .btn,
.form-signin .btn + a.btn,
.form-signin a.btn + .btn {
  margin-top: 0.55rem;
}

.jumbotron {
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  background: linear-gradient(140deg, #f9fcff 0%, #eef4fb 100%);
  box-shadow: 0 8px 18px rgba(20, 42, 70, 0.06);
  margin: 0 1rem 1.2rem;
}

.jumbotron .display-4 {
  color: #153e69;
  font-weight: 700;
}

.list-group-item.active {
  background: var(--app-primary);
  border-color: var(--app-primary);
}

.admin-nav-panel {
  border: 1px solid var(--app-border);
  border-radius: 0.95rem;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(16, 34, 60, 0.08);
  overflow: hidden;
}

.admin-nav-head {
  padding: 0.78rem 0.95rem;
  background: linear-gradient(130deg, #0f4c81 0%, #1c6ab0 100%);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.admin-nav-links {
  padding: 0.55rem;
}

.admin-nav-links .nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.68rem;
  border: 1px solid transparent;
  color: #1c405f;
  padding: 0.54rem 0.68rem;
  font-weight: 500;
  margin-bottom: 0.26rem;
  transition: all 0.18s ease;
}

.admin-nav-links .nav-link:hover {
  background: #f3f8fe;
  border-color: #d4e3f3;
  color: #0d4b81;
}

.admin-nav-links .nav-link.active {
  color: #ffffff;
  background: linear-gradient(130deg, #0f4c81 0%, #236fae 100%);
  border-color: #0f4c81;
  box-shadow: 0 8px 15px rgba(15, 76, 129, 0.28);
}

.admin-nav-icon {
  width: 1rem;
  text-align: center;
  opacity: 0.95;
}

.admin-filter-panel {
  border: 1px solid var(--app-border);
  border-radius: 0.95rem;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(16, 34, 60, 0.06);
  padding: 0.85rem;
}

.admin-top-tools {
  margin-bottom: 1rem;
}

.admin-top-nav-panel {
  border: 1px solid var(--app-border);
  border-radius: 0.95rem;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(16, 34, 60, 0.08);
  overflow: hidden;
}

.admin-top-nav-head {
  padding: 0.76rem 0.95rem;
  background: linear-gradient(130deg, #0f4c81 0%, #1c6ab0 100%);
  color: #ffffff;
  font-weight: 700;
}

.admin-top-nav-scroll {
  overflow-x: auto;
}

.admin-top-nav-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  padding: 0.6rem;
  min-width: max-content;
}

.admin-top-nav-links .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  color: #1c405f;
  padding: 0.48rem 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.admin-top-nav-links .nav-link:hover {
  background: #f3f8fe;
  border-color: #d4e3f3;
  color: #0d4b81;
}

.admin-top-nav-links .nav-link.active {
  color: #ffffff;
  background: linear-gradient(130deg, #0f4c81 0%, #236fae 100%);
  border-color: #0f4c81;
  box-shadow: 0 8px 15px rgba(15, 76, 129, 0.28);
}

.admin-top-filter-panel {
  border: 1px solid var(--app-border);
  border-radius: 0.95rem;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(16, 34, 60, 0.06);
  padding: 0.85rem;
  margin-top: 0.8rem;
}

.card-header h2,
.card-header h3,
.card-header h4 {
  margin: 0;
}

.jumbotron .btn {
  margin-top: 0.5rem;
}

.student-page .student-hero-actions {
  margin-top: 0.7rem;
}

.student-page .student-logout-btn {
  min-width: 130px;
}

.student-page .student-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0.65rem;
  margin-top: 0.8rem;
}

.student-page .student-action-btn {
  min-width: 172px;
  padding: 0.5rem 1rem;
}

.student-form-page .student-form-meta {
  margin-top: 0.25rem;
}

.student-form-page .form-meta-item {
  border: 1px solid #d4deea;
  border-radius: 0.7rem;
  background: #f6f9fd;
  padding: 0.55rem 0.75rem;
}

.student-form-page .form-meta-label {
  font-size: 0.9rem;
  color: #4f647a;
  margin-bottom: 0.2rem;
}

.student-form-page .form-meta-value {
  font-weight: 600;
  color: #163a63;
  word-break: break-word;
}

.table-responsive {
  border: 1px solid var(--app-border);
  border-radius: 0.8rem;
}

.table-responsive .table {
  margin-bottom: 0;
}

.dataTables_wrapper .row {
  margin-left: 0;
  margin-right: 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  padding-top: 0.65rem;
  padding-bottom: 0.35rem;
}

.dataTables_wrapper .dataTables_filter input {
  margin-left: 0.45rem;
  border: 1px solid #cdd8e6;
  border-radius: 0.55rem;
  padding: 0.3rem 0.55rem;
}

.dataTables_wrapper .paginate_button {
  border-radius: 0.45rem !important;
}

.alert {
  border-radius: 0.65rem;
}

/* Bootstrap 4 compatibility helpers */
.btn-block {
  display: block;
  width: 100%;
}

.font-weight-normal {
  font-weight: 400 !important;
}

.text-left {
  text-align: left !important;
}

.text-right {
  text-align: right !important;
}

.float-left {
  float: left !important;
}

.float-right {
  float: right !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.5rem;
  margin-left: -0.5rem;
}

.form-row > .col,
.form-row > [class*="col-"] {
  padding-right: 0.5rem;
  padding-left: 0.5rem;
}

.custom-select {
  display: block;
  width: 100%;
  appearance: auto;
}

.input-group-prepend,
.input-group-append {
  display: flex;
  align-items: stretch;
}

.input-group-prepend .input-group-text,
.input-group-append .input-group-text {
  border-radius: 0.6rem;
}

.btn-default {
  color: #fff;
  background-color: #6c757d;
  border-color: #6c757d;
}

.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }

.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }

.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }

.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pr-5 { padding-right: 3rem !important; }

@media (max-width: 991.98px) {
  body {
    padding-top: 76px;
  }

  .hero-card {
    padding: 1.35rem;
  }

  .news-card__image {
    height: 190px;
  }
}

@media (min-width: 992px) {
  .student-page .student-action-buttons {
    gap: 0.8rem 0.95rem;
  }

  .student-page .student-action-btn {
    min-width: 190px;
  }
}

@media (max-width: 767.98px) {
  .jumbotron {
    margin: 0 0.65rem 1rem;
    padding: 1.2rem;
  }

  .student-page .student-action-btn {
    min-width: 0;
  }

  .ml-5,
  .ml-4,
  .ml-3 {
    margin-left: 1rem !important;
  }
}
