/* ========= RHAC — Bootstrap 5 Theme (pure CSS) ========= */
/* Brand tokens */
:root{
  --rhac-teal: #0EA5A4;
  --rhac-teal-600: #0F766E;
  --rhac-coral: #FB7185;
  --rhac-ink: #0F172A;        /* slate-900 */
  --rhac-ink-800: #1E293B;    /* slate-800 */

  /* Override Bootstrap CSS variables */
  --bs-primary: var(--rhac-teal);
  --bs-secondary: var(--rhac-teal-600);
  --bs-info: #06b6d4;
  --bs-success: #16a34a;
  --bs-warning: #f59e0b;
  --bs-danger: #ef4444;
  --bs-body-color: var(--rhac-ink);
  --bs-body-bg: #F4FBFA; /* soft teal tint */
  --bs-border-radius: 1rem;     /* softer rounding globally */
  --bs-border-radius-lg: 1.25rem;
  --bs-border-radius-xl: 1.5rem;
}

/* ======= Background & hero ======= */
.bg-rhac-gradient{
  background-image: radial-gradient(60rem 60rem at -10% -10%, rgba(14,165,164,.18), transparent 40%),
                    radial-gradient(36rem 36rem at 110% 110%, rgba(251,113,133,.16), transparent 40%),
                    linear-gradient(180deg, #ffffff, #F4FBFA);
}
.rhac-hero{
  min-height: 100vh;
  display:flex; align-items:center; justify-content:center;
  padding: 2rem;
  position:relative;
}

/* ======= Card (glassy) ======= */
.card-glass{
  background: rgba(255,255,255,.88) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.65) !important;
  border-radius: 1.25rem !important;
  box-shadow: 0 10px 30px rgba(15,23,42,.10), 0 2px 10px rgba(15,23,42,.06);
}
.card-header-clean{
  background: transparent !important;
  border-bottom: 0 !important;
}

/* ======= Headings & small text ======= */
.h-title{
  font-weight: 800; color: var(--rhac-ink); letter-spacing: .2px;
}
.h-sub{
  color: #64748b; /* slate-500 */
  font-size: .925rem;
}

/* ======= Inputs ======= */
.form-control, .form-select {
  border-radius: 0.85rem !important;
  border-color: #e2e8f0 !important; /* slate-200 */
  padding: .85rem 1rem !important;
  background-color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(2,6,23,.03) inset;
}
.form-control::placeholder { color:#94a3b8; } /* slate-400 */

.form-control:focus, .form-select:focus{
  border-color: rgba(14,165,164,.65) !important;
  box-shadow: 0 0 0 .25rem rgba(14,165,164,.15) !important;
}

/* make selects prettier */
.form-select {
  background-image:
    linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%),
    linear-gradient(to right, #e2e8f0, #e2e8f0);
  background-position:
    calc(100% - 1.25rem) calc(1.2em + .15rem),
    calc(100% - .9rem)  calc(1.2em + .15rem),
    calc(100% - 2.5rem) .9em;
  background-size: 8px 8px, 8px 8px, 1px 1.8em;
  background-repeat: no-repeat;
  padding-right: 2.75rem !important;
}

/* checkboxes / radios */
.form-check-input{
  border-radius: .55rem;
  border-color:#cbd5e1;
}
.form-check-input:focus{
  box-shadow: 0 0 0 .2rem rgba(14,165,164,.15) !important;
  border-color: rgba(14,165,164,.65);
}
.form-check-input:checked{
  background-color: var(--rhac-teal);
  border-color: var(--rhac-teal);
}

/* ======= Buttons ======= */
.btn{
  border-radius: .9rem !important;
  font-weight: 600;
  letter-spacing: .2px;
}
.btn-primary{
  background: linear-gradient(180deg, var(--rhac-teal), var(--rhac-teal-600)) !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(14,165,164,.25), 0 2px 5px rgba(14,165,164,.15);
}
.btn-primary:hover{ filter: brightness(.97); }
.btn-outline-primary{
  color: var(--rhac-teal); border-color: var(--rhac-teal) !important;
}
.btn-outline-primary:hover{
  color: #fff; background: var(--rhac-teal) !important;
}
.btn-dark{
  background: var(--rhac-ink) !important; border:0 !important;
}
.btn-soft{
  background: #E6FFFB; color: var(--rhac-teal-600);
}

/* ======= Links ======= */
.link-brand{ color: var(--rhac-teal-600); text-decoration:none; }
.link-brand:hover{ color: var(--rhac-teal); text-decoration: underline; }

/* ======= Alerts ======= */
.alert-soft-success{ background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
.alert-soft-warning{ background:#fffbeb; color:#92400e; border:1px solid #fde68a; }

/* ======= Tables ======= */
.table-modern thead th{ color:#64748b; font-weight:600; border-bottom:1px solid #e2e8f0; }
.table-modern tbody tr{ border-top:1px solid #f1f5f9; }
.table-modern td{ padding:.75rem 1rem; }

/* ======= Utility chips ======= */
.badge-soft-teal{
  background: #e6fffb; color: var(--rhac-teal-600);
  border-radius: .75rem; padding: .35rem .6rem; font-weight:600;
}

/* ======= Auth container sizes ======= */
.auth-card{ width:100%; max-width: 460px; }

/* ======= Small helpers ======= */
.text-quiet{ color:#64748b; }
.shadow-subtle{ box-shadow: 0 10px 24px rgba(2,6,23,.06); }
/* ===== Khmer Font Stacks =====
   Primary UI: Kantumruy Pro
   Headlines:  Moul (or Moulpali for lighter), Battambang (rounded), Siemreap (compact)
*/
:root{
  --font-ui: "Kantumruy Pro", "Battambang", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Khmer", Arial, sans-serif;
  --font-rounded: "Battambang", "Kantumruy Pro", "Noto Sans Khmer", Arial, sans-serif;
  --font-compact: "Siemreap", "Kantumruy Pro", "Noto Sans Khmer", Arial, sans-serif;
  --font-display: "Moul", "Moulpali", "Battambang", "Kantumruy Pro", "Noto Sans Khmer", sans-serif;
}

/* Global app font */
html, body {
  font-family: var(--font-ui);
  font-feature-settings: "kern","liga","clig","cv01","cv02","cv03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings default (UI-friendly); switch to Khmer display with .kh-display if needed */
.h1, .h2, .h3, .h4, .h5, .h6,
h1,  h2,  h3,  h4,  h5,  h6 {
  font-family: var(--font-ui);
  font-weight: 700;
}

/* Utilities so you can opt-in per section */
.khun-ui         { font-family: var(--font-ui) !important; }
.khun-rounded    { font-family: var(--font-rounded) !important; }  /* Battambang */
.khun-compact    { font-family: var(--font-compact) !important; }  /* Siemreap   */
.khun-display    { font-family: var(--font-display) !important; }  /* Moul/Moulpali */
.khun-light      { font-weight: 300 !important; }                  /* pairs with Moulpali/Kantumruy Pro */
.khun-semibold   { font-weight: 600 !important; }
.khun-bold       { font-weight: 700 !important; }

/* Fine-tune sizes for Khmer headlines using display font */
.khun-display.h1, .khun-display h1 { letter-spacing: .2px; }
.khun-display.h2, .khun-display h2 { letter-spacing: .2px; }

/* Form elements inherit UI font */
.form-control, .form-select, .btn, .form-check-label, .form-label, .nav, .dropdown-menu {
  font-family: var(--font-ui);
}
/* ---- Subtle Green Buttons ---- */
:root{
  --rhac-green-500: #22c55e; /* emerald-500 */
  --rhac-green-600: #16a34a; /* emerald-600 */
  --rhac-green-soft: #e9f9ef; /* very light green bg */
  --rhac-green-text: #0f5132; /* deep green text */
}

/* Solid (but gentle) */
.btn-green {
  color: #fff;
  background: linear-gradient(180deg, #27cf66, var(--rhac-green-600));
  border: 0;
  border-radius: .9rem;
  box-shadow: 0 8px 18px rgba(34,197,94,.22), 0 2px 6px rgba(34,197,94,.14);
  font-weight: 600;
}
.btn-green:hover { filter: brightness(.98); }
.btn-green:focus { box-shadow: 0 0 0 .25rem rgba(34,197,94,.25); }

/* Soft (pastel) */
.btn-green-soft {
  color: var(--rhac-green-text);
  background: var(--rhac-green-soft);
  border: 1px solid rgba(22,163,74,.25);
  border-radius: .9rem;
  font-weight: 600;
}
.btn-green-soft:hover {
  background: #daf3e5;
  border-color: rgba(22,163,74,.35);
}
.btn-green-soft:focus { box-shadow: 0 0 0 .25rem rgba(34,197,94,.18); }
/* ---- Subtle Blue Buttons ---- */
:root{
  --rhac-blue-500: #3b82f6; /* indigo/blue 500 */
  --rhac-blue-600: #2563eb; /* blue 600 */
  --rhac-blue-soft: #eef5ff; /* very light blue bg */
  --rhac-blue-text: #0b3b91; /* deep blue text */
}

/* Solid (gentle gradient) */
.btn-blue {
  color: #fff;
  background: linear-gradient(180deg, var(--rhac-blue-500), var(--rhac-blue-600));
  border: 0;
  border-radius: .9rem;
  box-shadow: 0 8px 18px rgba(37,99,235,.22), 0 2px 6px rgba(37,99,235,.14);
  font-weight: 600;
}
.btn-blue:hover { filter: brightness(.98); }
.btn-blue:focus { box-shadow: 0 0 0 .25rem rgba(37,99,235,.25); }

/* Soft (pastel) */
.btn-blue-soft {
  color: var(--rhac-blue-text);
  background: var(--rhac-blue-soft);
  border: 1px solid rgba(37,99,235,.25);
  border-radius: .9rem;
  font-weight: 600;
}
.btn-blue-soft:hover {
  background: #e3eeff;
  border-color: rgba(37,99,235,.35);
}
.btn-blue-soft:focus { box-shadow: 0 0 0 .25rem rgba(37,99,235,.18); }
.btn-primary { background: linear-gradient(180deg, #27cf66, #16a34a); color:#fff; border:0; border-radius:.9rem; }
.btn-primary:hover { filter: brightness(.98); }
.btn-primary:focus { box-shadow: 0 0 0 .25rem rgba(34,197,94,.25); }
/* ===== Dashboard polish ===== */
.dash-wrap { background-image: linear-gradient(180deg, #ffffff, #F4FBFA); }

/* Title + subtitle */
.dash-title { font-weight: 800; letter-spacing: .3px; }
.dash-sub   { color:#64748b; }

/* Compact brand banner */
.brand-banner {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid rgba(0,0,0,.04);
  box-shadow: 0 10px 28px rgba(2,6,23,.06);
  padding: 1rem 1.25rem;
}
.brand-logo {
  max-height: 90px;                    /* << smaller image */
  width: auto;
}

/* Filter card */
.filter-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 1rem;
  box-shadow: 0 12px 22px rgba(15,23,42,.06);
}

/* Content cards */
.card-glass-lite{
  background: rgba(255,255,255,.9) !important;
  border: 1px solid rgba(255,255,255,.6) !important;
  border-radius: 1.1rem !important;
  box-shadow: 0 12px 30px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.05);
}

/* Shadow pop (hover) */
.shadow-pop{
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}
.shadow-pop:hover{
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 16px 36px rgba(0,0,0,.12);
}

/* Section titles */
.section-title { font-weight: 800; }
.section-note  { color:#64748b; font-size:.925rem; }

/* Compact table */
.table-compact td, .table-compact th { padding: .6rem .8rem; }
/* ===== Dashboard polish ===== */
.dash-wrap { background-image: linear-gradient(180deg, #ffffff, #F4FBFA); }
.dash-title { font-weight: 800; letter-spacing: .3px; }
.dash-sub   { color:#64748b; }
.brand-banner {
  background: #ffffff; border-radius: 1.25rem;
  border: 1px solid rgba(0,0,0,.04);
  box-shadow: 0 10px 28px rgba(2,6,23,.06);
  padding: 1rem 1.25rem;
}
.brand-logo { max-height: 90px; width: auto; }
.filter-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 1rem;
  box-shadow: 0 12px 22px rgba(15,23,42,.06);
}
.card-glass-lite{
  background: rgba(255,255,255,.9) !important;
  border: 1px solid rgba(255,255,255,.6) !important;
  border-radius: 1.1rem !important;
  box-shadow: 0 12px 30px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.05);
}
.shadow-pop{ transition: transform .18s ease, box-shadow .18s ease; box-shadow: 0 10px 26px rgba(0,0,0,.08); }
.shadow-pop:hover{ transform: translateY(-2px) scale(1.01); box-shadow: 0 16px 36px rgba(0,0,0,.12); }
.section-title { font-weight: 800; }
.section-note  { color:#64748b; font-size:.925rem; }
.table-compact td, .table-compact th { padding: .6rem .8rem; }
/* --- Accessible high-contrast tweaks --- */
:root{
  --rhac-text-strong: #0b1220; /* very dark */
  --rhac-muted: #475569;       /* slate-600 */
  --rhac-surface: #ffffff;
  --rhac-surface-alt: #f8fafc; /* light */
}

/* Larger default text a bit for readability */
body { font-size: 1rem; line-height: 1.55; color: var(--rhac-text-strong); }

/* Focus states visible */
a:focus, button:focus, .form-select:focus, .form-control:focus {
  outline: 3px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}

/* Tabs with brand accent */
.nav-tabs-rhac .nav-link {
  font-weight: 700;
  color: var(--rhac-muted);
  border: 0;
  border-bottom: 3px solid transparent;
  padding: .6rem 1rem;
}
.nav-tabs-rhac .nav-link.active {
  color: var(--rhac-ink);
  border-bottom-color: var(--rhac-teal);
}

/* Buttons spacing group */
.d-flex.gap-2 > .btn { margin-left: .25rem; }

/* Make table rows slightly higher contrast */
.table-modern thead th { background: #f1f5f9; }
.table-modern tbody tr:hover { background:#f8fafc; }

/* Ensure canvas area has space on small screens */
#indicatorChart { max-width: 100%; }

/* ===== RHAC Signature Theme – Modern Green ===== */
:root{
  /* Core brand */
  --rhac-green-50:  #f1fcf6;
  --rhac-green-100: #e6fff2;
  --rhac-green-200: #c9f5df;
  --rhac-green-300: #a7ebcb;
  --rhac-green-400: #6fddb0;
  --rhac-green-500: #27cf66;  /* vivid */
  --rhac-green-600: #16a34a;  /* deep */
  --rhac-green-700: #0f7a38;

  --rhac-ink:       #0b1220;  /* primary text */
  --rhac-muted:     #475569;  /* slate-600 */
  --rhac-surface:   #ffffff;
  --rhac-surface-2: #f6fbf8;  /* minty bg */
  --rhac-border:    rgba(15,163,74,.18);

  /* Default radius + shadow color */
  --rhac-radius: 18px;
  --rhac-shadow: 0 12px 28px rgba(22,163,74,.12), 0 3px 10px rgba(22,163,74,.08);
  --rhac-shadow-hover: 0 18px 40px rgba(22,163,74,.18), 0 6px 16px rgba(22,163,74,.10);
}

/* Page background with subtle mint wash */
.dash-wrap {
  background:
    radial-gradient(60rem 60rem at -10% -20%, rgba(39,207,102,.07), transparent 45%),
    radial-gradient(42rem 42rem at 120% 120%, rgba(22,163,74,.05), transparent 40%),
    linear-gradient(180deg, #fff, var(--rhac-surface-2));
}

/* Title + subtitle */
.dash-title { font-weight: 800; letter-spacing: .2px; color: var(--rhac-ink); }
.dash-sub   { color: var(--rhac-muted); }

/* Brand banner with soft green glow */
.brand-banner {
  background: var(--rhac-surface);
  border-radius: calc(var(--rhac-radius) + 2px);
  border: 1px solid rgba(39,207,102,.10);
  box-shadow:
    0 10px 24px rgba(0,0,0,.06),
    0 0 0 6px rgba(39,207,102,.04);
  padding: 1rem 1.25rem;
}
.brand-banner:hover { box-shadow: var(--rhac-shadow-hover), 0 0 0 8px rgba(39,207,102,.05); }

.brand-logo { max-height: 90px; width: auto; }

/* Filter card: glassy + mint border */
.filter-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-radius: var(--rhac-radius);
  border: 1px solid var(--rhac-border);
  box-shadow: var(--rhac-shadow);
}

/* Universal RHAC card with “color ring” */
.rhac-card {
  position: relative;
  border-radius: var(--rhac-radius);
  background: var(--rhac-surface);
  box-shadow: var(--rhac-shadow);
  border: 1px solid var(--rhac-border);
}
.rhac-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;                    /* thin color ring */
  background: linear-gradient(135deg, rgba(39,207,102,.28), rgba(15,163,74,.10));
  -webkit-mask: 
    linear-gradient(#000 0 0) content-box, 
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.rhac-card:hover { box-shadow: var(--rhac-shadow-hover); }

/* Chart panel background for depth */
#chartPane {
  border-radius: var(--rhac-radius);
  background:
    radial-gradient(18rem 18rem at 20% -10%, rgba(39,207,102,.06), transparent 55%),
    var(--rhac-surface);
  border: 1px solid rgba(39,207,102,.12);
  padding: 1rem;
}

/* Tabs: thick active underline + better contrast */
.nav-tabs-rhac .nav-link {
  font-weight: 700;
  color: var(--rhac-muted);
  border: 0; border-bottom: 3px solid transparent;
  padding: .65rem 1rem;
  border-radius: .5rem .5rem 0 0;
}
.nav-tabs-rhac .nav-link:hover { color: var(--rhac-ink); }
.nav-tabs-rhac .nav-link.active {
  color: var(--rhac-ink);
  border-bottom-color: var(--rhac-green-500);
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* Buttons: RHAC green */
.btn-rhac {
  color: #fff;
  background: linear-gradient(180deg, var(--rhac-green-500), var(--rhac-green-600));
  border: 0;
  border-radius: 14px !important;
  box-shadow: 0 10px 22px rgba(39,207,102,.22), 0 3px 8px rgba(39,207,102,.16);
  font-weight: 700;
  letter-spacing: .2px;
}
.btn-rhac:hover { filter: brightness(.98); box-shadow: var(--rhac-shadow-hover); }

.btn-outline-rhac {
  color: var(--rhac-green-600);
  border: 1px solid var(--rhac-green-500) !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, rgba(39,207,102,.06), rgba(39,207,102,.02));
}
.btn-outline-rhac:hover { color:#fff; background: var(--rhac-green-600) !important; }

/* Soft “chip” buttons */
.btn-soft-rhac {
  color: var(--rhac-green-700);
  background: var(--rhac-green-50);
  border: 1px solid rgba(39,207,102,.18);
  border-radius: 14px !important;
  font-weight: 700;
}
.btn-soft-rhac:hover { background: var(--rhac-green-100); }

/* Inputs */
.form-control, .form-select {
  border-radius: 12px !important;
  border: 1px solid rgba(39,207,102,.22) !important;
  box-shadow: 0 1px 0 rgba(2,6,23,.03) inset;
}
.form-control:focus, .form-select:focus {
  border-color: var(--rhac-green-500) !important;
  box-shadow: 0 0 0 .25rem rgba(39,207,102,.18) !important;
}

/* Table */
.table-modern thead th{
  background: linear-gradient(180deg, #f2fbf6, #eafdF3);
  color: #0b1220; border-bottom: 1px solid rgba(39,207,102,.18);
}
.table-modern tbody tr { border-top: 1px solid rgba(16,185,129,.08); }
.table-modern tbody tr:hover { background: #f7fdf9; }

/* Section titles */
.section-title { font-weight: 800; color: var(--rhac-ink); }
.section-note  { color: var(--rhac-muted); font-size: .94rem; }

/* Focus rings for accessibility */
:where(a,button,.form-select,.form-control):focus-visible{
  outline: 3px solid rgba(39,207,102,.35);
  outline-offset: 2px;
}

/* Optional: dark mode (auto) */
@media (prefers-color-scheme: dark){
  :root {
    --rhac-ink:#e5e7eb; --rhac-muted:#a3b0c2;
    --rhac-surface:#0e1512; --rhac-surface-2:#0b120f;
    --rhac-border: rgba(39,207,102,.25);
  }
  .dash-wrap { background: linear-gradient(180deg,#0b120f,#0e1512); }
  .brand-banner,
  .filter-card,
  .rhac-card,
  #chartPane { background: #0e1512; border-color: var(--rhac-border); }
  .table-modern thead th { background: #0f1914; color:#e5e7eb; }
}
/* ===== Title pop-out chip ===== */
.title-pop {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .95rem;                 /* comfy chip */
  border-radius: 1rem;
  background: linear-gradient(180deg,#ffffff, #f7fffd);
  border: 1px solid rgba(14,165,164,.22);  /* teal ring */
  box-shadow:
    0 14px 28px rgba(14,165,164,.18),      /* teal glow */
    0 4px 12px rgba(15,23,42,.10);         /* soft depth */
  line-height: 1.15;
  will-change: transform, box-shadow;
  transition: transform .18s ease, box-shadow .18s ease;
}

/* subtle text lift without reducing readability */
.title-pop > .title-text {
  text-shadow:
    0 1px 0 #fff,
    0 6px 14px rgba(14,165,164,.18);
}

/* tiny accent dot (optional) */
.title-pop .title-dot {
  width: .6rem; height: .6rem;
  border-radius: 999px;
  background: var(--rhac-teal);
  box-shadow: 0 0 0 6px rgba(14,165,164,.12);
}

/* ambient glow behind the chip */
.title-pop::before{
  content:'';
  position: absolute; inset: -10px -12px;
  border-radius: inherit;
  background:
    radial-gradient(24rem 18rem at 10% 10%, rgba(14,165,164,.10), transparent 40%),
    radial-gradient(18rem 14rem at 90% 40%, rgba(6,182,212,.10), transparent 45%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}

/* slight “popup” on hover/focus */
.title-pop:hover,
.title-pop:focus-within {
  transform: translateY(-2px);
  box-shadow:
    0 18px 34px rgba(14,165,164,.22),
    0 6px 16px rgba(15,23,42,.12);
}

/* motion-safe */
@media (prefers-reduced-motion: reduce){
  .title-pop { transition: none; }
}
#insightSummary div { margin-bottom: 2px; }
#insightSummary b { color: #0f766e; }

