/* ==========================================================================
   SCIT Personnel System - Modern theme (ทับบน AdminLTE)
   ใช้ร่วมกันทุกหน้าผ่าน component/head.php
   ========================================================================== */

:root {
  --ps-primary: #1d4ed8;
  --ps-primary-dark: #1e40af;
  --ps-primary-soft: rgba(29, 78, 216, .10);
  --ps-navy: #0f172a;
  --ps-accent: #f59e0b;
  --ps-text: #0f172a;
  --ps-muted: #64748b;
  --ps-border: #e2e8f0;
  --ps-bg: #f1f5f9;
  --ps-radius: 14px;
  --ps-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px -2px rgba(15, 23, 42, .06);
  --ps-shadow-hover: 0 12px 28px -8px rgba(15, 23, 42, .25);
}

body {
  font-size: 1.05rem;
  color: var(--ps-text);
}

.content-wrapper {
  background: var(--ps-bg);
}

/* ---------- Navbar ---------- */
.main-header.navbar {
  background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 100%) !important;
  border-bottom: 0;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .25);
}

.main-header .nav-link { transition: opacity .2s; }
.main-header .nav-link:hover { opacity: .8; }

.main-header .btn.btn-sm {
  width: auto;
  padding: .35rem .9rem;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
}

.main-header .btn-info    { background: rgba(255, 255, 255, .15); }
.main-header .btn-info:hover { background: rgba(255, 255, 255, .28); }
.main-header .btn-success { background: rgba(255, 255, 255, .12); color: #fff; opacity: 1; }
.main-header .btn-success.disabled { opacity: 1; cursor: default; }
.main-header .btn-success.disabled::before {
  content: "\f007";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  margin-right: 8px;
  color: var(--ps-accent);
}
.main-header .btn-danger  { background: #ef4444; }
.main-header .btn-danger:hover { background: #dc2626; }

/* ---------- Sidebar ---------- */
.main-sidebar {
  background: #fff;
  border-right: 1px solid var(--ps-border);
  box-shadow: 4px 0 24px -12px rgba(15, 23, 42, .18) !important;
}

.brand-link {
  border-bottom: 1px solid var(--ps-border) !important;
  padding: .9rem 1rem;
}

.brand-link .brand-text { font-size: 1.25rem; color: var(--ps-navy); }

.form-control-sidebar,
.form-control-sidebar + .input-group-append .btn-sidebar {
  background: var(--ps-bg);
  border-color: var(--ps-border);
}

.form-control-sidebar { border-radius: 10px 0 0 10px; }
.form-control-sidebar + .input-group-append .btn-sidebar { border-radius: 0 10px 10px 0; }

.nav-sidebar > .nav-item { margin-bottom: 2px; }

.nav-sidebar .nav-link {
  border-radius: 10px !important;
  color: #334155;
  transition: background .2s, color .2s, transform .2s;
}

.nav-sidebar .nav-link:hover {
  background: var(--ps-primary-soft);
  color: var(--ps-primary);
}

.nav-sidebar .nav-link > .fas,
.nav-sidebar .nav-link > .far,
.nav-sidebar .nav-link > .nav-icon {
  width: 1.6rem;
  margin-right: .4rem;
  text-align: center;
  color: var(--ps-primary);
}

.nav-sidebar .nav-link.active,
.nav-sidebar > .nav-item.menu-open > .nav-link {
  background: var(--ps-primary-soft) !important;
  color: var(--ps-primary) !important;
  font-weight: 600;
  box-shadow: none !important;
}

.nav-treeview > .nav-item > .nav-link { color: var(--ps-muted); }

/* ---------- Content header / breadcrumb (component/page_header.php) ---------- */
.content-header h1,
.content-header .page-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.2px;
}

.page-title .fas {
  margin-right: .5rem;
  font-size: 1.2rem;
  color: var(--ps-primary);
}

.page-breadcrumb {
  margin: 0;
  padding: 0;
  font-size: .95rem;
  background: transparent;
}

.page-breadcrumb .breadcrumb-item a { color: var(--ps-primary); }
.page-breadcrumb .breadcrumb-item.active { color: var(--ps-muted); }

@media (max-width: 767.98px) {
  .page-breadcrumb { margin-top: .25rem; }
}

/* ---------- Cards (ทั่วไป) ---------- */
.card {
  border: 0;
  border-radius: var(--ps-radius);
  box-shadow: var(--ps-shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ps-border);
  padding: 1rem 1.25rem;
}

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { background: var(--ps-primary); border-color: var(--ps-primary); }
.btn-primary:hover { background: var(--ps-primary-dark); border-color: var(--ps-primary-dark); }

.form-control { border-radius: 10px; }
.form-control:focus {
  border-color: var(--ps-primary);
  box-shadow: 0 0 0 .2rem var(--ps-primary-soft);
}

.main-footer {
  background: transparent;
  border-top: 1px solid var(--ps-border);
  color: var(--ps-muted);
}

/* ==========================================================================
   หน้าแรก (index.php)
   ========================================================================== */

/* --- Hero --- */
.home-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding: 32px 36px;
  color: #fff;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(15, 23, 42, .92) 0%, rgba(29, 78, 216, .85) 100%),
    url('../../assets/img/template/psu-surat.jpeg') center / cover no-repeat;
  box-shadow: 0 16px 32px -16px rgba(29, 78, 216, .6);
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(245, 158, 11, .25);
  filter: blur(2px);
}

.home-hero > * { position: relative; z-index: 1; }

.home-hero h2 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  font-weight: 700;
}

.home-hero p {
  margin: 0;
  max-width: 560px;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, .85);
}

.home-hero .hero-stat {
  flex-shrink: 0;
  min-width: 120px;
  padding: 14px 22px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 16px;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
}

.home-hero .hero-stat b { display: block; font-size: 2rem; line-height: 1.1; }
.home-hero .hero-stat span { font-size: .9rem; opacity: .85; }

/* --- Section title --- */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 1.3rem;
  font-weight: 700;
}

.section-title .icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  color: var(--ps-primary);
  border-radius: 12px;
  background: var(--ps-primary-soft);
}

/* --- News grid --- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.news-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--ps-shadow);
  transition: transform .25s, box-shadow .25s;
}

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

.news-card .news-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #e0e7ff);
}

.news-card .news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}

.news-card:hover .news-thumb img { transform: scale(1.06); }

.news-card .news-thumb .no-pic {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 2.5rem;
  color: #93a4d8;
}

.news-card .news-date {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 5px 12px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ps-navy);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .15);
}

.news-card .news-date i { margin-right: 6px; color: var(--ps-primary); }

.news-card .news-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.news-card .news-title {
  display: -webkit-box;
  margin: 0 0 8px;
  overflow: hidden;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ps-text);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-card .news-title:hover { color: var(--ps-primary); text-decoration: none; }

.news-card .news-dt {
  display: -webkit-box;
  margin: 0 0 16px;
  overflow: hidden;
  line-height: 1.55;
  color: var(--ps-muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-card .news-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: auto;
  padding: .45rem 1rem;
  font-weight: 600;
  color: var(--ps-primary);
  border-radius: 999px;
  background: var(--ps-primary-soft);
  transition: background .2s, color .2s;
}

.news-card .news-link:hover {
  color: #fff;
  background: var(--ps-primary);
  text-decoration: none;
}

.news-card .news-link i { font-size: .8rem; transition: transform .2s; }
.news-card .news-link:hover i { transform: translateX(3px); }

.news-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--ps-muted);
  border: 2px dashed var(--ps-border);
  border-radius: 18px;
  background: #fff;
}

.news-empty i { display: block; margin-bottom: 10px; font-size: 2.5rem; opacity: .5; }

@media (max-width: 767.98px) {
  .home-hero { flex-direction: column; align-items: flex-start; padding: 24px; }
  .home-hero h2 { font-size: 1.5rem; }
  .news-grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   หน้าโปรไฟล์บุคลากร (personal_profile.php)
   ========================================================================== */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px 28px;
  margin-bottom: 24px;
  border-radius: 18px;
  background: linear-gradient(120deg, #eff6ff 0%, #ffffff 70%);
  border: 1px solid var(--ps-border);
}

.profile-avatar {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, .35);
  background: #e2e8f0;
}

.profile-main { min-width: 0; }

.profile-name {
  margin: 0 0 2px;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ps-navy);
}

.profile-name-en {
  margin-bottom: 12px;
  font-size: 1.1rem;
  color: var(--ps-muted);
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-tag,
.profile-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: .95rem;
  font-weight: 500;
  border-radius: 999px;
}

.profile-tag {
  color: #334155;
  background: #fff;
  border: 1px solid var(--ps-border);
}

.profile-tag .fas { color: var(--ps-primary); }

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

.info-section {
  padding: 20px 22px;
  border: 1px solid var(--ps-border);
  border-radius: 16px;
  background: #fff;
}

.info-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ps-navy);
  border-bottom: 1px solid var(--ps-border);
}

.info-section h3 .fas {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: .9rem;
  color: var(--ps-primary);
  border-radius: 10px;
  background: var(--ps-primary-soft);
}

.info-grid { margin: 0; }

.info-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--ps-border);
}

.info-item:last-child { border-bottom: 0; }

.info-item dt {
  font-weight: 500;
  color: var(--ps-muted);
}

.info-item dd {
  margin: 0;
  font-weight: 600;
  color: var(--ps-text);
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .profile-hero { flex-direction: column; text-align: center; padding: 20px; }
  .profile-tags { justify-content: center; }
  .profile-avatar { width: 120px; height: 120px; }
  .info-sections { grid-template-columns: 1fr; }
  .info-item { grid-template-columns: 1fr; gap: 2px; }
}

/* ==========================================================================
   หน้ารายละเอียดข่าว (news.php)
   ========================================================================== */
.news-article {
  max-width: 880px;
  margin: 0 auto 8px;
  padding: 32px 36px 36px;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--ps-shadow);
}

.news-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 500;
  color: var(--ps-muted);
}

.news-back:hover { color: var(--ps-primary); text-decoration: none; }

.news-article-title {
  margin: 0 0 12px;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ps-navy);
}

.news-article-meta {
  margin-bottom: 22px;
  padding-bottom: 18px;
  color: var(--ps-muted);
  border-bottom: 1px solid var(--ps-border);
}

.news-article-meta .fas { margin-right: 6px; color: var(--ps-primary); }

.news-article-pic {
  display: block;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--ps-bg);
  text-align: center;
}

.news-article-pic img {
  display: block;
  max-width: 100%;
  max-height: 560px;
  margin: 0 auto;
  object-fit: contain;
}

.news-article-body {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #1e293b;
  overflow-wrap: anywhere;
}

.news-article-link { margin-top: 26px; padding: .6rem 1.4rem; border-radius: 999px; }
.news-article-link .fas { margin-left: 6px; font-size: .8rem; }

.news-article + .section-title { max-width: 1100px; }

@media (max-width: 767.98px) {
  .news-article { padding: 22px 18px 26px; }
  .news-article-title { font-size: 1.5rem; }
}


/* ==========================================================================
   รายชื่ออาจารย์ประจำหลักสูตร (mng_instructor.php)
   ========================================================================== */
.inst-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.inst-search {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
}

.inst-search .fa-search {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.inst-search input { padding-left: 38px; }

.inst-toolbar select.form-control { flex: 0 1 200px; width: auto; min-width: 150px; }

.inst-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.inst-summary {
  margin-bottom: 14px;
  font-size: .95rem;
  color: var(--ps-muted);
}

.inst-group {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--ps-border);
  border-radius: 14px;
  background: #fff;
}

.inst-group.is-hidden { display: none; }

.inst-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  width: 100%;
  padding: 14px 18px;
  text-align: left;
  font: inherit;
  color: var(--ps-navy);
  background: #eff6ff;
  border: 0;
  cursor: pointer;
  transition: background .2s;
}

.inst-group-head:hover { background: #dbeafe; }
.inst-group-head:focus-visible { outline: 2px solid var(--ps-primary); outline-offset: -2px; }

.inst-chevron {
  width: 14px;
  font-size: .8rem;
  color: var(--ps-primary);
  transition: transform .2s;
}

.inst-group.is-open .inst-chevron { transform: rotate(90deg); }

.inst-group-name { font-weight: 700; font-size: 1.1rem; }
.inst-group-name .fas { margin-right: 6px; color: var(--ps-primary); }

.inst-group-count {
  padding: 2px 12px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ps-primary);
  border-radius: 999px;
  background: #fff;
}

.inst-group-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.inst-group-stats .badge { padding: 4px 10px; font-weight: 500; border-radius: 999px; }

.inst-group.is-warning { border-color: #fcd34d; }
.inst-group.is-warning .inst-group-head { background: #fffbeb; }
.inst-group.is-warning .inst-group-head:hover { background: #fef3c7; }
.inst-group.is-warning .inst-group-name .fas,
.inst-group.is-warning .inst-chevron { color: #d97706; }
.inst-group.is-warning .inst-group-count { color: #b45309; }

.inst-group-body { display: none; border-top: 1px solid var(--ps-border); }
.inst-group.is-open .inst-group-body { display: block; }

.inst-table { margin: 0; }

.inst-table thead th {
  padding: 10px 14px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ps-muted);
  white-space: nowrap;
  background: #f8fafc;
  border-top: 0;
  border-bottom: 1px solid var(--ps-border);
}

.inst-table tbody td {
  padding: 12px 14px;
  vertical-align: top;
  border-top: 1px solid #f1f5f9;
}

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

.inst-actions { white-space: nowrap; }
.inst-actions .btn { width: 34px; height: 34px; padding: 0; line-height: 32px; border-radius: 10px; }

.inst-name { font-weight: 600; color: var(--ps-text); }
.inst-male   { margin-left: 6px; color: #3b82f6; }
.inst-female { margin-left: 6px; color: #ec4899; }

.inst-sub { font-size: .9rem; color: var(--ps-muted); }

.inst-resp {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  font-size: .85rem;
  font-weight: 500;
  color: #047857;
  border-radius: 999px;
  background: #d1fae5;
}

.inst-status { padding: 5px 12px; font-size: .85rem; font-weight: 500; border-radius: 999px; }

.inst-noresult,
.inst-empty-branches {
  padding: 14px 18px;
  color: var(--ps-muted);
  border: 1px dashed var(--ps-border);
  border-radius: 14px;
  background: #f8fafc;
}

.inst-noresult { padding: 40px 18px; text-align: center; }
.inst-empty-branches { margin-top: 14px; font-size: .95rem; }
.inst-noresult .far, .inst-empty-branches .far { margin-right: 6px; }

@media (max-width: 767.98px) {
  .inst-toolbar select.form-control { flex: 1 1 100%; }
  .inst-toolbar-actions { margin-left: 0; }
  .inst-group-stats { margin-left: 0; }
}
