/* ============================================================================
   Public Executive HR Open Data Dashboard Stylesheet
   โรงเรียนนครศรีลำดวนวิทยา (https://reghr.nswssk.ac.th)
   Sovereign Navy & Warm Family Gold-Coral Accent Line Palette (PDPA-Safe)
   ============================================================================ */

:root {
  --navy-gradient: linear-gradient(135deg, #0b1c36 0%, #15315c 55%, #1f4782 100%);
  --warm-line-gradient: linear-gradient(90deg, #c98a3b 0%, #e7c280 50%, #d47a6a 100%);
  --navy-deep: #0e2242;
  --navy-main: #183a6d;
  --navy-hover: #0f274c;
  --navy-soft: #eef3fa;
  --navy-border: #d6e0ee;
  --navy-ink: #0f1f38;
  --warm-gold: #c98a3b;
  --warm-gold-light: #e7c280;
  --warm-coral: #c96b63;
  --warm-border: #e9d4b4;
  --card-radius: 16px;
  --shadow-soft: 0 10px 26px -6px rgba(11, 28, 54, 0.08), 0 6px 12px -6px rgba(11, 28, 54, 0.04);
  --shadow-hover: 0 18px 30px -6px rgba(11, 28, 54, 0.15), 0 8px 14px -6px rgba(11, 28, 54, 0.06);
  --bs-primary: #183a6d;
  --bs-primary-rgb: 24, 58, 109;
  --bs-primary-bg-subtle: #eaf0f8;
  --bs-primary-border-subtle: #c5d5ea;
  --bs-primary-text-emphasis: #0e2242;
}

body {
  font-family: 'Prompt', sans-serif;
  background-color: #f4f7fb;
  color: var(--navy-ink);
  min-height: 100vh;
}

.text-primary { color: var(--navy-main) !important; }
.bg-primary { background-color: var(--navy-main) !important; }
.btn-primary {
  background: linear-gradient(135deg, #10284d 0%, #1d4682 100%);
  border-color: #10284d;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0a1b36 0%, #153566 100%);
  border-color: #0a1b36;
}
.form-control:focus, .form-select:focus {
  border-color: var(--warm-gold);
  box-shadow: 0 0 0 0.2rem rgba(24, 58, 109, 0.16);
}

/* Hero Banner (Authoritative Navy + Warm Family Bottom Ribbon) */
.public-hero {
  background: var(--navy-gradient);
  color: #fff;
  border-radius: 20px;
  padding: 1.65rem 1.85rem 1.85rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.public-hero::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--warm-line-gradient);
  z-index: 3;
}
.public-hero::after {
  content: '';
  position: absolute;
  right: -45px;
  top: -45px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle, rgba(231, 194, 128, 0.16) 0%, rgba(255, 255, 255, 0.03) 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-logo-wrap {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.97);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(6, 15, 31, 0.36), 0 0 0 4px rgba(231, 194, 128, 0.48);
  flex-shrink: 0;
}
.hero-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-pill-btn {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(231, 194, 128, 0.42);
  color: #fff;
  border-radius: 50px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  cursor: pointer;
}
.hero-pill-btn:hover {
  background: rgba(231, 194, 128, 0.25);
  border-color: var(--warm-gold-light);
  color: #fff;
  transform: translateY(-1px);
}
.hero-pill-btn.solid {
  background: #fff;
  color: var(--navy-deep);
  border: 1.5px solid var(--warm-gold-light);
  font-weight: 600;
}
.hero-pill-btn.solid:hover {
  background: #fffbf2;
  color: var(--navy-deep);
}

/* Navigation Pills */
.pub-nav {
  background: #fff;
  border: 1px solid var(--navy-border);
  border-top: 2.5px solid var(--warm-gold);
  border-radius: 14px;
  padding: 0.45rem;
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pub-nav .nav-link {
  color: #4d607a;
  font-weight: 500;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  transition: all 0.18s ease;
}
.pub-nav .nav-link:hover {
  background: var(--navy-soft);
  color: var(--navy-deep);
}
.pub-nav .nav-link.active {
  background: var(--navy-gradient);
  color: #fff;
  box-shadow: inset 0 -2.5px 0 var(--warm-gold-light), 0 4px 12px rgba(14, 34, 66, 0.26);
}

/* Cards & KPIs */
.surface-card {
  background: #fff;
  border-radius: var(--card-radius);
  border: 1px solid var(--navy-border);
  border-top: 3px solid var(--navy-main);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem;
}
.kpi-card {
  border-radius: var(--card-radius);
  border: none;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 100%;
}
.kpi-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(231, 194, 128, 0.85), rgba(212, 122, 106, 0.65));
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.kpi-card .kpi-icon {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 3rem;
  opacity: 0.16;
}
.kpi-1 { background: linear-gradient(135deg, #0b1e3b 0%, #1b4078 100%); }
.kpi-2 { background: linear-gradient(135deg, #12365c 0%, #235c91 100%); }
.kpi-3 { background: linear-gradient(135deg, #8f5c1a 0%, #c98a3b 100%); }
.kpi-4 { background: linear-gradient(135deg, #1d2c59 0%, #364e8c 100%); }
.kpi-5 { background: linear-gradient(135deg, #7d3642 0%, #b35a64 100%); }
.kpi-6 { background: linear-gradient(135deg, #0d4b57 0%, #187280 100%); }

/* Charts */
.chart-box {
  background: #fff;
  border-radius: var(--card-radius);
  border: 1px solid var(--navy-border);
  border-top: 2.5px solid rgba(201, 138, 59, 0.55);
  box-shadow: var(--shadow-soft);
  padding: 1.15rem;
  height: 100%;
}
.chart-container { position: relative; height: 265px; width: 100%; }
.chart-container-large { position: relative; height: 320px; width: 100%; }

/* Executive & Directory Cards (Dignified Navy + Warm Family Gold Top Accent) */
.exec-leader-card {
  background: linear-gradient(180deg, #f8fafd 0%, #ffffff 45%);
  border: 1.5px solid #cfdced;
  border-top: 4px solid var(--warm-gold);
  border-radius: 18px;
  padding: 1.35rem 1.1rem;
  text-align: center;
  height: 100%;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.exec-leader-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.exec-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 6px 16px rgba(14, 34, 66, 0.18), 0 0 0 2.5px var(--warm-gold-light);
  margin: 0 auto 0.85rem auto;
  display: block;
}
.exec-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #edf2f9;
  border: 4px solid #fff;
  box-shadow: 0 6px 16px rgba(14, 34, 66, 0.12), 0 0 0 2.5px var(--warm-gold-light);
  color: #4f6d96;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 0.85rem auto;
}

.dir-card {
  background: #fff;
  border: 1px solid var(--navy-border);
  border-left: 3px solid rgba(201, 138, 59, 0.55);
  border-radius: 14px;
  padding: 1rem;
  height: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 2px 8px rgba(14, 34, 66, 0.04);
}
.dir-card:hover {
  transform: translateY(-2px);
  border-color: var(--navy-main);
  border-left-color: var(--warm-gold);
  box-shadow: 0 10px 22px rgba(14, 34, 66, 0.12);
}
.dir-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid #e7c280;
  flex-shrink: 0;
}
.dir-avatar-placeholder {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #edf2f9;
  border: 2.5px solid #e7c280;
  color: #4f6d96;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

/* Tables */
.table-rose-head th {
  background-color: #0f2447 !important;
  color: #ffffff !important;
  border-color: #1e3b6b !important;
  border-bottom: 2.5px solid var(--warm-gold) !important;
}

/* PDPA Compliance Footer */
.pdpa-footer {
  background: #fff;
  border: 1px solid var(--navy-border);
  border-left: 4px solid var(--warm-gold);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  color: #4d607a;
  font-size: 0.82rem;
}

/* Loader */
#pub-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(244, 247, 251, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Isolated Print Container */
@media screen {
  #pub-print-container {
    display: none !important;
  }
}

@media print {
  @page { size: A4 portrait; margin: 9mm; }
  body.printing-public-report {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.printing-public-report #pub-main-wrap,
  body.printing-public-report #pub-loader {
    display: none !important;
  }
  body.printing-public-report #pub-print-container {
    display: block !important;
    width: 100% !important;
  }
  .rep-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-bottom: 2.5px solid #15315c;
    box-shadow: inset 0 -2px 0 #c98a3b;
    padding-bottom: 7px;
    margin-bottom: 10px;
  }
  .rep-logo { width: 38px; height: 38px; object-fit: contain; }
  .rep-header h2 { font-size: 13.5pt; font-weight: 700; margin: 0 0 2px 0; color: #0e2242; }
  .rep-header .sub { font-size: 8.5pt; color: #415570; }
  .rep-kpi-table { width: 100%; border-collapse: separate; border-spacing: 5px 0; margin: 0 -5px 10px -5px; table-layout: fixed; }
  .rep-kpi-cell { border: 1.2px solid #2b4263; border-top: 3.5px solid #183a6d; border-radius: 8px; padding: 6px 4px; text-align: center; background: #fff; }
  .rep-kpi-cell .k-label { font-size: 7.4pt; font-weight: 600; color: #364963; }
  .rep-kpi-cell .k-val { font-size: 13.5pt; font-weight: 700; color: #0e2242; }
  .rep-kpi-cell .k-sub { font-size: 6.7pt; color: #52647d; }
  .rep-charts-table { width: 100%; border-collapse: separate; border-spacing: 6px 6px; margin: 0 -6px; table-layout: fixed; }
  .rep-chart-cell { border: 1px solid #cbd7e8; border-radius: 8px; padding: 5px; background: #fff; text-align: center; vertical-align: middle; page-break-inside: avoid; }
  .rep-chart-img { display: block; margin: 0 auto; max-width: 100%; max-height: 160px; object-fit: contain; }
  .rep-chart-img-wide { display: block; margin: 0 auto; max-width: 100%; max-height: 192px; object-fit: contain; }
  .rep-page-break { page-break-before: always; break-before: page; }
  .rep-section { margin-bottom: 12px; page-break-inside: avoid; }
  .rep-section-title { font-size: 10pt; font-weight: 700; color: #0e2242; border-left: 4px solid #c98a3b; padding: 2px 8px; margin-bottom: 6px; background: #eef3fa; }
  .rep-table { width: 100%; border-collapse: collapse; font-size: 8.2pt; }
  .rep-table th, .rep-table td { border: 1px solid #415570; padding: 3.5px 5px; vertical-align: middle; }
  .rep-table thead th { background: #e8eef6; color: #0e2242; font-weight: 700; text-align: center; }
  .rep-pdpa-note { font-size: 7.5pt; color: #52647d; text-align: center; margin-top: 10px; border-top: 1px dashed #c98a3b; padding-top: 6px; }
}
