/*!
 * InTouch custom theme built on Bootstrap 5.3.3
 * Brand color: #023c5b (dark teal-blue)
 * Modern polished UI
 */

:root {
  --bs-primary: #023c5b;
  --bs-primary-rgb: 2, 60, 91;
  --bs-body-bg: #f0f2f5;
  --bs-body-color: #2d3748;
  --bs-border-color: #e2e8f0;
  --bs-font-sans-serif: "Source Serif 4", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-font-monospace: "Fira Code", "Cascadia Code", Consolas, "Courier New", monospace;
  --bs-link-color: #023c5b;
  --bs-link-hover-color: #012c42;
  --bs-navbar-bg: #023c5b;
  --intouch-sidebar-width: 250px;
  --intouch-sidebar-bg: #2e3330;
  --intouch-sidebar-color: rgba(255, 255, 255, 0.82);
  --intouch-sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --intouch-sidebar-active-bg: rgba(255, 255, 255, 0.14);
  --intouch-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --intouch-shadow: 0 4px 12px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --intouch-shadow-lg: 0 10px 30px rgba(0,0,0,.1), 0 3px 8px rgba(0,0,0,.06);
  --intouch-radius: .625rem;
  --intouch-radius-lg: .875rem;
  --intouch-transition: all .2s cubic-bezier(.4,0,.2,1);
}

/* Body */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -.015em;
}
h1 { font-weight: 700; }
h2 { font-weight: 700; }
h3 { font-weight: 600; }
.lead { font-weight: 400; }

/* Links */
a { text-decoration: none; transition: var(--intouch-transition); }
a:hover { text-decoration: none; }

/* Buttons */
.btn-primary {
  --bs-btn-bg: #023c5b;
  --bs-btn-border-color: #023c5b;
  --bs-btn-hover-bg: #012c42;
  --bs-btn-hover-border-color: #012c42;
  --bs-btn-active-bg: #012c42;
  --bs-btn-active-border-color: #012c42;
  --bs-btn-disabled-bg: #023c5b;
  --bs-btn-disabled-border-color: #023c5b;
  font-weight: 500;
  border-radius: var(--intouch-radius);
  transition: var(--intouch-transition);
}
.btn { border-radius: var(--intouch-radius); transition: var(--intouch-transition); }
.btn:focus-visible { box-shadow: 0 0 0 .2rem rgba(2,60,91,.18); }

/* Navbar */
.app-navbar {
  background: #ffffff;
  box-shadow: var(--intouch-shadow);
  z-index: 1030;
  backdrop-filter: blur(8px);
}
.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .btn-link {
  color: #2d3748;
}
.app-navbar .navbar-brand {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.app-navbar .navbar-brand h2 { font-size: 1.1rem; line-height: 1.3; }
.app-navbar .nav-link:hover,
.app-navbar .btn-link:hover {
  color: rgba(45, 55, 72, 0.8);
}
.app-navbar .btn-link {
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--intouch-transition);
}
.app-navbar .btn-link:hover {
  background-color: rgba(0,0,0,.06);
}
.app-navbar .navbar-toggler {
  border-radius: var(--intouch-radius);
  padding: .4rem .6rem;
  transition: var(--intouch-transition);
  border-color: rgba(0,0,0,.2);
}
.app-navbar .navbar-toggler-icon {
  filter: none;
}
.app-navbar .navbar-toggler:hover {
  background-color: rgba(0,0,0,.04);
}

/* Offcanvas sidebar */
.app-sidebar {
  --bs-offcanvas-width: var(--intouch-sidebar-width);
  background-color: var(--intouch-sidebar-bg) !important;
  color: var(--intouch-sidebar-color);
  box-shadow: 4px 0 20px rgba(0,0,0,.08);
}
.app-sidebar .offcanvas-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 1.25rem;
}
.app-sidebar .offcanvas-title { color: #fff; font-weight: 600; font-size: 1.05rem; }
.app-sidebar .btn-close { filter: invert(1) grayscale(100%) brightness(200%); opacity: .7; transition: var(--intouch-transition); }
.app-sidebar .btn-close:hover { opacity: 1; }
.app-sidebar .offcanvas-body { padding: .5rem .75rem; }
.app-sidebar .nav-link {
  color: var(--intouch-sidebar-color);
  padding: .7rem 1rem;
  border-radius: var(--intouch-radius);
  margin: 3px 6px;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .925rem;
  font-weight: 400;
  transition: var(--intouch-transition);
}
.app-sidebar .nav-link:hover {
  background-color: var(--intouch-sidebar-hover-bg);
  color: #fff;
  transform: translateX(2px);
}
.app-sidebar .nav-link.active {
  background-color: var(--intouch-sidebar-active-bg);
  color: #fff;
  font-weight: 600;
}
.app-sidebar .nav-link i { font-size: 1.1rem; opacity: .85; }
.app-sidebar .sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: .5rem 1rem;
}

/* Risk profile slide-out panel */
.app-profile-panel {
  --bs-offcanvas-width: 290px;
  box-shadow: -4px 0 20px rgba(0,0,0,.08);
}
.app-profile-panel .offcanvas-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
}
.app-profile-panel .offcanvas-title { font-weight: 600; }
.app-profile-panel .list-group-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem;
  font-size: .88rem;
  border: none;
  border-bottom: 1px solid #f0f2f5;
  transition: var(--intouch-transition);
}
.app-profile-panel .list-group-item:hover {
  background-color: #f8f9fb;
  text-decoration: none;
}

/* Risk circles */
.circle, .circle2 {
  display: inline-block;
  border-radius: 50%;
  flex-shrink: 0;
}
.circle { width: 14px; height: 14px; margin-right: 6px; vertical-align: middle; }
.circle2 { width: 10px; height: 10px; margin-right: 6px; vertical-align: middle; }

#risk1-small, #risk1-xsmall { background-color: #2f835a; }
#risk2-small, #risk2-xsmall { background-color: #3eaf70; }
#risk3-small, #risk3-xsmall { background-color: #fbc93a; }
#risk4-small, #risk4-xsmall { background-color: #e1874d; }
#risk5-small, #risk5-xsmall { background-color: #bd2f35; }

/* Cards */
.card {
  border: none;
  border-radius: var(--intouch-radius-lg);
  box-shadow: var(--intouch-shadow-sm);
  transition: var(--intouch-transition);
}
.card:hover {
  box-shadow: var(--intouch-shadow);
}
.card-header {
  cursor: pointer;
  background-color: #fff;
  border-bottom: 1px solid var(--bs-border-color);
  padding: .85rem 1.1rem;
  font-weight: 600;
  font-size: .95rem;
  border-radius: var(--intouch-radius-lg) var(--intouch-radius-lg) 0 0 !important;
}
.card-header i { transition: transform 0.25s ease; }
.card.collapsed .card-header i.chevron { transform: rotate(-90deg); }
.card-body { padding: 1.1rem; }

/* Accordion */
.accordion {
  --bs-accordion-border-color: var(--bs-border-color);
  --bs-accordion-border-radius: var(--intouch-radius-lg);
}
.accordion-item {
  border: 1px solid var(--bs-border-color) !important;
  border-radius: var(--intouch-radius) !important;
  margin-bottom: .5rem;
  overflow: hidden;
  box-shadow: var(--intouch-shadow-sm);
}
.accordion-button {
  font-weight: 600;
  font-size: .92rem;
  padding: .85rem 1.1rem;
  transition: var(--intouch-transition);
}
.accordion-button:not(.collapsed) {
  background-color: rgba(2, 60, 91, 0.04);
  color: #023c5b;
  box-shadow: none;
}
.accordion-button:focus {
  box-shadow: 0 0 0 .2rem rgba(2,60,91,.12);
  border-color: rgba(2,60,91,.2);
}
.accordion-button::after {
  background-size: .85rem;
  transition: transform .25s ease;
}
.accordion-body {
  padding: 1rem 1.1rem;
  font-size: .9rem;
  line-height: 1.65;
}
.accordion-body p { margin-bottom: .6rem; }
.accordion-body p:last-child { margin-bottom: 0; }

/* Alert list links */
.alert-list a {
  display: block;
  padding: .55rem .1rem;
  border-bottom: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  font-size: .88rem;
  transition: var(--intouch-transition);
}
.alert-list a:last-child { border-bottom: none; }
.alert-list a:hover {
  color: var(--bs-primary);
  padding-left: .3rem;
}

/* Watchlist links */
.watchlist a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .1rem;
  color: var(--bs-body-color);
  font-size: .9rem;
  transition: var(--intouch-transition);
}
.watchlist a:hover {
  color: var(--bs-primary);
  padding-left: .3rem;
}

/* Country list sidebar (countryprofile) */
.country-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--intouch-radius);
  font-size: .88rem;
  transition: var(--intouch-transition);
}
.country-list a:hover {
  background: rgba(46,51,48,.06);
  padding-left: 14px;
}

/* Map container */
#mapdiv, #map, #map_canvas {
  background-color: #fff;
  border-radius: var(--intouch-radius-lg);
  box-shadow: var(--intouch-shadow-sm);
}

/* Leaflet popups */
.leaflet-popup-content-wrapper {
  border-radius: var(--intouch-radius);
  box-shadow: var(--intouch-shadow-lg);
  border: 1px solid var(--bs-border-color);
}
.leaflet-popup-content { margin: .85rem 1rem; font-size: .9rem; line-height: 1.6; }
.leaflet-popup-tip { box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.leaflet-container a.leaflet-popup-close-button {
  width: 28px; height: 28px;
  font-size: 1.2rem;
  padding: 4px 0 0 0;
  color: #999;
  transition: var(--intouch-transition);
}
.leaflet-container a.leaflet-popup-close-button:hover { color: #023c5b; }
.leaflet-control-attribution {
  border-radius: var(--intouch-radius) 0 0 0;
  font-size: .7rem;
}

/* Form controls */
.form-control, .form-select {
  border-radius: var(--intouch-radius);
  border-color: #d1d9e0;
  transition: var(--intouch-transition);
}
.form-control:focus, .form-select:focus {
  border-color: #023c5b;
  box-shadow: 0 0 0 .2rem rgba(2,60,91,.1);
}
.form-check-input:checked {
  background-color: #023c5b;
  border-color: #023c5b;
}
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(2,60,91,.15); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .35rem; }

/* Badges */
.badge { font-weight: 500; letter-spacing: .02em; }

/* Alerts (Bootstrap) */
.alert {
  border: none;
  border-radius: var(--intouch-radius);
  padding: .85rem 1.1rem;
  box-shadow: var(--intouch-shadow-sm);
}

/* Content container */
.container-fluid { padding-left: 1.5rem; padding-right: 1.5rem; }

/* Main content area - offset for the fixed sidebar on desktop only */
.app-content {
  padding-top: 80px;
  padding-left: 250px;
}
@media (max-width: 991.98px) {
  .app-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
@media (max-width: 575.98px) {
  .app-content {
    padding-left: .75rem;
    padding-right: .75rem;
  }
}

/* Map visibility by device */
.map-mobile { display: none; }
.map-desktop { display: block; }
@media (max-width: 991.98px) {
  .map-mobile { display: block; }
  .map-desktop { display: none; }
}

/* Profile panel filter button */
.filter-toggle-btn {
  border-radius: 50px !important;
  padding: .5rem 1.2rem !important;
  box-shadow: var(--intouch-shadow) !important;
  font-weight: 500;
  transition: var(--intouch-transition);
}
.filter-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--intouch-shadow-lg) !important;
}

/* Filter panel (alerts.php) */
.filter-panel {
  border-left: 1px solid var(--bs-border-color);
  box-shadow: -6px 0 20px rgba(0,0,0,.1);
}
.filter-panel .form-check-label { font-size: .88rem; }
.filter-panel select.form-select { font-size: .85rem; }

/* Responsive */
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; }
}
@media (max-width: 575.98px) {
  /* Collapse the long brand title on phones so the navbar stays on one line */
  .app-navbar .navbar-brand .fw-semibold { display: none; }
  .app-content { padding-top: 72px; }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1cad4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8b4c0; }

/* Selection */
::selection { background: rgba(2,60,91,.15); }

/* jsVectorMap overrides */
#mapdiv .jvm-series-container { margin-top: 8px; }
#mapdiv .jvm-legend-title { font-weight: 600; font-size: .8rem; color: #2e3330; }
.jvm-tooltip {
  background: #023c5b !important;
  font-family: 'Source Serif 4', serif !important;
  border: none !important;
  padding: 8px 10px !important;
  box-shadow: 0 6px 18px rgba(0,0,0,.25) !important;
  max-width: 220px;
}
.jvm-tooltip strong { font-size: .95rem; }
.jvm-tooltip .jvm-tooltip-sub { font-size: .78rem; opacity: .9; margin-top: 2px; }
.jvm-tooltip .jvm-tooltip-content strong { display: block; margin-bottom: 2px; }
.jvm-zoom-btn { background: #023c5b; color: #fff; border: none; }
.jvm-zoom-btn:hover { background: #025580; }

/* High-severity alert markers */
#mapdiv .jvm-marker-alert {
  fill: #ff2a2a;
  stroke: #ffffff;
  stroke-width: 2.5;
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  animation: jvm-alert-pulse 1.6s ease-out infinite;
}
#mapdiv .jvm-marker-alert:hover { animation-play-state: paused; }
@keyframes jvm-alert-pulse {
  0%   { r: 7;  opacity: 1; }
  60%  { r: 11; opacity: .55; }
  100% { r: 7;  opacity: 1; }
}