/* Status Page Frest Bridge
   Purpose: Align status page look & feel with Frest public theme while keeping lightweight assets.
   Scope: Only common Bootstrap-like utilities and component skinnings we use on the status page.
*/

:root {
  /* Bridge vars to Frest tokens when present */
  --bs-body-bg: var(--bs-body-bg, #f8f9fa);
  --bs-body-color: var(--bs-body-color, #212529);
  --bs-heading-color: rgb(81.4, 99, 119); /* Ensure headings are readable in light mode */
  --bs-border-color: var(--bs-border-color, rgba(0,0,0,.08));
  --bs-border-color-subtle: var(--bs-border-color-subtle, rgba(0,0,0,.15));
  --bs-secondary-bg: var(--bs-secondary-bg, rgba(0,0,0,.06));
  --bs-tertiary-bg: var(--bs-tertiary-bg, rgba(0,0,0,.04));
}

/* Ensure headings are readable in light theme */
[data-bs-theme="light"] {
  --bs-heading-color: rgb(81.4, 99, 119);
}

/* Ensure headings are readable in dark theme */
[data-bs-theme="dark"] {
  --bs-heading-color: rgb(216, 222, 233.5);
}

/* Card look closer to Frest */
.card.component-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

/* Navbar spacing/weight */
header[role=banner] .navbar {
  padding-top: .75rem !important;
  padding-bottom: .75rem !important;
}
header[role=banner] .navbar .navbar-brand span {
  font-weight: 700;
  letter-spacing: .2px;
}

header[role=banner] .navbar {
  background-color: unset !important;
}

/* Pills and badges tint alignment */
.status-pill {
  letter-spacing: .2px;
}
.badge.incident-badge {
  font-weight: 600;
}

/* Hour/day tick visuals */
.status-ticks .day-tick {
  display: inline-block;
  width: 8px;
  {{/* height: 16px; */}}
  border-radius: 2px;
  /* Let the app's status classes control color; avoid theme default backgrounds */
  /* background: none !important; */
}
.status-ticks .day-tick.tick-maintenance {
  outline: 1px dashed var(--bs-border-color);
}

/* Hourly pills hover affordance */
.hourly-tight .hour-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

/* Popover typography */
#hour-incidents-popover {
  font-family: inherit;
}
#hour-incidents-popover .inc-link {
  line-height: 1.2;
}

/* Uptime popover (component card header) */
[data-comp-uptime] [data-uptime-dropdown] {
  cursor: pointer;
  user-select: none;
  outline: none;
  box-shadow: none;
}

/* Avoid the browser focus ring box; keep an accessible affordance. */
[data-comp-uptime] [data-uptime-dropdown]:focus-visible {
  outline: none;
  text-decoration: underline;
  text-decoration-color: var(--bs-primary, #0d6efd);
  text-underline-offset: 2px;
}

.uptime-popover-menu {
  min-width: 180px;
  max-width: 260px;
  background: var(--bs-body-bg, #fff);
  border: 1px solid rgba(0, 0, 0, .15);
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, .15);
  border-radius: 8px;
  padding: 10px !important;
  font-size: .8rem;
  z-index: 2000;
}

/* Arrow to match the 90d tick popover style. */
.uptime-popover-menu::before,
.uptime-popover-menu::after {
  content: "";
  position: absolute;
  left: var(--tail-left, calc(100% - 18px));
  transform: translateX(-50%);
  width: 0;
  height: 0;
}

/* Border triangle (points up, attached to top of menu) */
.uptime-popover-menu::before {
  top: -10px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 10px solid rgba(0, 0, 0, .15);
}

/* Fill triangle (matches popover bg) */
.uptime-popover-menu::after {
  top: -9px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 9px solid var(--bs-body-bg, #fff);
}

[data-bs-theme="dark"] .uptime-popover-menu {
  background: #1f242b !important;
  border-color: #2d333b !important;
  color: #e5e7eb !important;
}
[data-bs-theme="dark"] .uptime-popover-menu::before {
  border-bottom-color: #2d333b !important;
}
[data-bs-theme="dark"] .uptime-popover-menu::after {
  border-bottom-color: #1f242b !important;
}

/* Incident timeline tweaks */
.incident-timeline {
  max-width: 70%;
  margin-left: auto;
  margin-right: auto;
}

/* Mobile/tablet: give the timeline full width */
@media (max-width: 991.98px) {
  .incident-timeline {
    max-width: 100%;
  }
}

.incident-day-heading {
  letter-spacing: .3px;
}

/* Fix readability of date headings in light theme */
[data-bs-theme="light"] .incident-day-heading.text-muted, #hour-incidents-popover .dp-date {
  color: #6c757d !important; /* Darker muted color for better readability */
}

.incident-timeline .card.component-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

/* Maintenance blocks */
.maintenance-update {
  border: 1px solid var(--bs-border-color);
}

/* Dark theme overrides should follow the explicit data-bs-theme attribute so
   user-selected theme (stored in localStorage) wins over system preference. */
[data-bs-theme="dark"] .card.component-card {
  background: #1f242b;
  border-color: #2d333b;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
[data-bs-theme="dark"] .maintenance-update {
  border-color: #2d333b;
}

/* Fix dark theme readability for timeline/update bodies and navbar links */
[data-bs-theme="dark"] .incident-updates-timeline,
[data-bs-theme="dark"] .incident-updates-timeline .update-body,
[data-bs-theme="dark"] .update-body {
  color: var(--bs-body-color, #e9ecef);
}
[data-bs-theme="dark"] .navbar-nav .nav-link {
  color: var(--bs-heading-color, var(--bs-body-color, #e9ecef));
}
[data-bs-theme="dark"] .navbar-nav .nav-link:hover,
[data-bs-theme="dark"] .navbar-nav .nav-link:focus {
  color: var(--bs-primary, #0d6efd);
}

/* Ensure tick/incident popover honors dark theme, overriding inline styles */
[data-bs-theme="dark"] #hour-incidents-popover {
  background: #1f242b !important;
  border-color: #2d333b !important;
  color: #e5e7eb !important;
}
[data-bs-theme="dark"] #hour-incidents-popover a.inc-link { color: #f1f5f9 !important; }
[data-bs-theme="dark"] #hour-incidents-popover a.inc-link:hover {
  background: #2a3133 !important;
  border-color: #394046 !important;
}
[data-bs-theme="dark"] #hour-incidents-popover .inc-span-bar { background: #2f3840 !important; }
[data-bs-theme="dark"] #hour-incidents-popover[data-pos="above"]::before { border-top-color: #2d333b !important; }
[data-bs-theme="dark"] #hour-incidents-popover[data-pos="below"]::before { border-bottom-color: #2d333b !important; }
[data-bs-theme="dark"] #hour-incidents-popover[data-pos="above"]::after { border-top-color: #1f242b !important; }
[data-bs-theme="dark"] #hour-incidents-popover[data-pos="below"]::after { border-bottom-color: #1f242b !important; }

/* Fix table row hover in dark theme for archives */

[data-bs-theme="dark"] .table {
    --bs-table-hover-bg: #2a2d2e !important;
}
