/* ==========================================================================
 * MNRE GEF PROJECT PORTFOLIO DASHBOARD
 * Client: Ministry of Natural Resources and Environment (MNRE), Government of Samoa
 * Partner: SPREP | Contract AP_11/3: 2026-041-DS
 * Developed by: Bitsolution IT Consulting - Fogāmomi Pelenato Pritchard, Managing Director
 * pelenato@bitsolution.ws | https://bitsolution.ws | +685 7286825 (WS) | +64 0277286825 (NZ)
 * ========================================================================== */
/* MNRE GEF Dashboard — custom styles (green government palette) */
:root {
  --mnre-green: #1b5e38;
  --mnre-green-dark: #12442a;
  --mnre-teal: #0e7490;
  --mnre-gold: #b45309;
  --mnre-bg: #f4f7f5;
}
body { background: var(--mnre-bg); min-height: 100vh; display: flex; flex-direction: column; }

.mnre-nav { background: linear-gradient(90deg, var(--mnre-green-dark), var(--mnre-green)); }
.mnre-nav .nav-link { font-weight: 500; }
/* Official MNRE crest in the navbar: white rounded chip so it reads on the dark bar */
.brand-logo {
  height: 36px; width: auto; display: block;
  background: #fff; border-radius: 8px; padding: 1px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
/* GEF mark: portrait artwork, slightly taller chip */
.gef-logo { height: 38px; padding: 2px 4px; }
/* Official MNRE banner lockup (crest + name + diamond strip) on a white chip */
.brand-banner {
  height: 46px; width: auto; display: block;
  background: #fff; border-radius: 10px; padding: 4px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
/* Brand text with the MNRE diamond strip underlining it (from the official banner) */
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.15; }
.brand-title { display: block; }
.brand-diamonds { justify-content: space-between; width: 100%; margin-top: 4px; align-items: center; }
.brand-diamonds i {
  width: 8px; height: 8px; display: block; transform: rotate(45deg); border-radius: 1.5px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.45), 0 1px 1px rgba(0,0,0,.3);
}
.brand-diamonds i:nth-child(1)  { background: #262949; }
.brand-diamonds i:nth-child(2)  { background: #075357; }
.brand-diamonds i:nth-child(3)  { background: #0d7052; }
.brand-diamonds i:nth-child(4)  { background: #1dbf84; }
.brand-diamonds i:nth-child(5)  { background: #abd771; }
.brand-diamonds i:nth-child(6)  { background: #f9bd56; }
.brand-diamonds i:nth-child(7)  { background: #e86a3d; }
.brand-diamonds i:nth-child(8)  { background: #e81b48; }
.brand-diamonds i:nth-child(9)  { background: #9f2a5c; }
.brand-diamonds i:nth-child(10) { background: #6d0a5e; }
.brand-diamonds i:nth-child(11) { background: #022a77; }

.btn-mnre { background: var(--mnre-green); color: #fff; border: none; }
.btn-mnre:hover, .btn-mnre:focus { background: var(--mnre-green-dark); color: #fff; }

/* KPI cards */
.kpi-card { border: none; border-left: 5px solid var(--mnre-green); box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.kpi-teal { border-left-color: var(--mnre-teal); }
.kpi-gold { border-left-color: var(--mnre-gold); }
.kpi-green { border-left-color: #2e7d32; }
.kpi-value { font-size: 1.9rem; font-weight: 700; color: var(--mnre-green-dark); line-height: 1.1; }
.kpi-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: #6b7280; }

/* Charts */
.chart-card { border: none; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.chart-title { font-weight: 600; color: #374151; margin-bottom: .75rem; }

/* Login */
.login-card { border: none; margin-top: 6vh; }
.login-icon { font-size: 2.6rem; color: var(--mnre-green); }

/* Footer */
.mnre-footer { background: #e8efe9; color: #4b5563; }
.mnre-footer a { color: var(--mnre-green); }
.mnre-footer a:hover { text-decoration: underline !important; }

/* Tables */
.table-projects thead th { background: var(--mnre-green); color: #fff; white-space: nowrap; font-size: .85rem; }
.table-projects td { vertical-align: middle; }
.badge { font-weight: 500; }

/* Portfolio filter bar */
.filter-card { border: none; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.title-cell { min-width: 280px; }
.table-projects tbody tr:hover td { background: #eef5ef; }

/* Project detail */
.detail-item .detail-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: #6b7280; }
.detail-item .detail-value { font-weight: 600; color: #1f2937; }
.tag-chip { background: #e8efe9; color: var(--mnre-green-dark); font-weight: 500; }

/* Allocations */
.phase-badge { background: var(--mnre-green); font-size: .95rem; }
.alert-mnre { background: #e8efe9; border-left: 5px solid var(--mnre-green); color: #1f2937; }
details summary { color: var(--mnre-green); }
details[open] summary { margin-bottom: .25rem; }

/* Division cards */
.division-card { transition: transform .15s ease, box-shadow .15s ease; }
.division-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }

/* Share bar */
.share-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; }
.share-btn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .95rem; border: none; text-decoration: none; transition: transform .12s ease, opacity .12s ease; }
.share-btn:hover { transform: translateY(-2px); opacity: .9; color: #fff; }
.share-fb { background: #1877f2; } .share-x { background: #14171a; } .share-li { background: #0a66c2; }
.share-wa { background: #25d366; } .share-em { background: #6b7280; } .share-copy { background: var(--mnre-green); }
.share-tg { background: #229ed9; } .share-ms { background: #a334fb; }

/* Project map */
.map-container { height: 220px; border-radius: 8px; border: 1px solid #d1d5db; }
.map-page { height: 62vh; min-height: 420px; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* Visible only when printing (e.g. active-filter summary injected by export.js) */
.print-only { display: none; }

/* Print / screenshot friendly */
@media print {
  .print-only { display: block !important; }
  .mnre-nav, .mnre-footer, .filter-card, .no-print, .btn, .breadcrumb { display: none !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff; }
  main.container-fluid { padding: 0 !important; }
  .card, .chart-card, .kpi-card { box-shadow: none !important; border: 1px solid #d1d5db !important; break-inside: avoid; }
  .kpi-value { font-size: 1.4rem; }
  a { text-decoration: none; color: inherit; }
}

/* ---- Hover tooltip for truncated titles (modern bubble) ---- */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 8px);
  width: max-content; max-width: 440px; white-space: normal;
  background: #14532d; color: #f0f7f2;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.45; font-weight: 400;
  box-shadow: 0 10px 24px rgba(20, 83, 45, .25);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 1060;
}
.tip::before {
  content: ''; position: absolute; left: 14px; top: calc(100% + 2px);
  border: 6px solid transparent; border-top: none; border-bottom-color: #14532d;
  opacity: 0; transition: opacity .18s ease;
  z-index: 1061;
}
.tip:hover::after, .tip:hover::before { opacity: 1; transform: translateY(0); }

/* ---- Dark mode (data-bs-theme="dark" on <html>; Bootstrap 5.3 handles cards/forms/tables) ---- */
:root[data-bs-theme="dark"] { --mnre-bg: #121a15; }
[data-bs-theme="dark"] .card { --bs-card-bg: #1a241e; --bs-card-border-color: #2a352e; }
[data-bs-theme="dark"] .kpi-value { color: #8fd0a6; }
[data-bs-theme="dark"] .kpi-label { color: #96a19a; }
[data-bs-theme="dark"] .chart-title { color: #cfd6d1; }
[data-bs-theme="dark"] .kpi-card, [data-bs-theme="dark"] .chart-card, [data-bs-theme="dark"] .filter-card,
[data-bs-theme="dark"] .login-card { box-shadow: 0 2px 10px rgba(0,0,0,.45); }
[data-bs-theme="dark"] .mnre-footer { background: #0c110e; color: #96a19a; }
[data-bs-theme="dark"] .mnre-footer a { color: #8fd0a6; }
[data-bs-theme="dark"] .table-projects tbody tr:hover td { background: rgba(27,94,56,.28); }
[data-bs-theme="dark"] .detail-item .detail-label { color: #8f9a94; }
[data-bs-theme="dark"] .detail-item .detail-value { color: #e6ebe7; }
[data-bs-theme="dark"] .tag-chip { background: rgba(27,94,56,.4); color: #a9d6b7; }
[data-bs-theme="dark"] .alert-mnre { background: rgba(27,94,56,.22); color: #d8e2db; border-left-color: #2e7d52; }
[data-bs-theme="dark"] .badge.bg-light { background: rgba(255,255,255,.12) !important; border-color: #3a463f !important; color: #e6ebe7 !important; }
[data-bs-theme="dark"] .text-muted { color: #96a19a !important; }
[data-bs-theme="dark"] .map-container { border-color: #2a352e; }
[data-bs-theme="dark"] .leaflet-container { background: #121a15; }
[data-bs-theme="dark"] .leaflet-tile { filter: brightness(.88) saturate(.92); }
[data-bs-theme="dark"] .list-group-item { --bs-list-group-bg: #1a241e; --bs-list-group-border-color: #2a352e; }

/* ---- First-visit theme picker bubble ---- */
.theme-welcome {
  position: fixed; right: 18px; bottom: 18px; z-index: 1080;
  width: 290px; max-width: calc(100vw - 36px);
  background: var(--bs-body-bg); color: var(--bs-body-color);
  border: 1px solid rgba(27,94,56,.3); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(16px);
  transition: opacity .35s ease, transform .35s ease;
}
.theme-welcome.show { opacity: 1; transform: translateY(0); }
.theme-welcome-close { position: absolute; top: 8px; right: 8px; }
.theme-welcome-icon { color: var(--mnre-green); }
[data-bs-theme="dark"] .theme-welcome-icon { color: #8fd0a6; }
.theme-welcome-text { color: #6b7280; }
[data-bs-theme="dark"] .theme-welcome-text { color: #96a19a; }
[data-bs-theme="dark"] .theme-welcome { border-color: #2a352e; box-shadow: 0 14px 40px rgba(0,0,0,.55); }
