/**
  * Custom CSS for status.grafana.com
  *
  * Ensure any changes are submitted as a pull request
  *  and merged in https://github.com/grafana/statuspage
  *  before changing anything in Statuspage.
  */

/* Allow the page to use more horizontal space on larger screens */
.masthead-container,
.container {
  max-width: 1024px !important;
}

/* Set the correct size for the logo in the masthead */
.masthead-container .masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (max-width: 768px) {
  .masthead-container .masthead {
    flex-direction: column;
  }
}

.masthead-container .masthead .logo-container {
  float: none !important;
  width: 25rem;
  max-width: 100% !important;
  flex-shrink: 1;
}

.masthead-container .masthead .logo-container a {
  display: block;
}

.masthead-container .masthead .logo-container a svg {
  width: 100%;
  height: auto;
}

.masthead-container .masthead .updates-dropdown-container {
  float: none !important;
}

/* Fix a bug with tooltips blocking clicks when invisible */
.tooltip:not(.in) {
  pointer-events: none;
}

/* Round the corners of incident updates at the top of the page */
.unresolved-incident .incident-title {
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.unresolved-incident .updates {
  border-bottom-left-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
}

/* Apply some spacing to the category headings we're adding */
.components-section .components-heading {
  margin: 2rem 0 0.5rem;
}

/* Use a three column grid for the components, with responsive adjustments for smaller screens */
.components-section .components-container.three-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 1rem;
}

@media (max-width: 1024px) {
  .components-section .components-container.three-columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .components-section .components-container.three-columns {
    grid-template-columns: 1fr;
  }
}

/* Override some styles on each component to make it work with the grid layout */
.components-section .component-container {
  width: auto !important;
  min-width: 0;
  padding: 1.25rem !important;
  border-width: 1px !important;
  border-radius: 0.25rem !important;
}

.components-section .component-container .child-components-container {
  padding: 0 !important;
}

/* Force the statuses legend to always render even on mobile */
.components-section .component-statuses-legend {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-width: 1px 0;
  border-style: solid;
  margin: 1.5rem 0 0;
  padding: 1.5rem 0;
}

.components-section .component-statuses-legend .legend-item {
  margin: 0 !important;
}

.components-section .component-statuses-legend .breaker {
  display: none !important;
}

/* Fix some alignment issues with the component status indicators and tooltips */
/* Always show the status indicator rather than the status name, even on mobile */
.components-section .component-container .component-inner-container {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.components-section
  .component-container
  .component-inner-container
  .icon-indicator {
  float: none !important;
  flex-shrink: 0;
  top: 0 !important;
}

.components-section
  .component-container:not(.is-group.open)
  .component-inner-container
  .icon-indicator,
.components-section
  .component-container
  .child-components-container
  .component-inner-container
  .icon-indicator {
  display: inline-block !important;
}

.components-section
  .component-container
  .component-inner-container
  .component-status {
  display: none !important;
}

.components-section
  .component-container
  .component-inner-container
  .tooltip-base {
  top: 0;
  color: inherit;
  flex-shrink: 0;
}

/* Allow component names to wrap across multiple lines */
/* Apply the same styles for the name to the incident update collapses */
.components-section .component-container .component-inner-container .name,
.unresolved-incident .updates .updates-collapse summary {
  max-width: 100% !important;
  white-space: wrap !important;
  display: flex !important;
  align-items: baseline;
  gap: 0.5rem;
  flex-grow: 1;
}

.components-section
  .component-container
  .component-inner-container
  .name
  .group-parent-indicator {
  margin: 0 !important;
}

/* For any incidents with multiple updates, support collapsing all but the most recent update */
/* Apply the same styles for the details/summary elements to the operational component collapses */
.unresolved-incident .updates .updates-collapse {
  margin: 0.5rem 0 0;
}

.unresolved-incident .updates .update > small:last-child {
  opacity: 0.75;
}

.unresolved-incident .updates .updates-collapse .update:not(:last-of-type) {
  margin: 1rem 0 !important;
}

.unresolved-incident .updates .updates-collapse summary,
.components-section .component-container .child-components-collapse summary {
  cursor: pointer;
  list-style: none;
}

.unresolved-incident .updates .updates-collapse summary::marker,
.unresolved-incident .updates .updates-collapse summary::-webkit-details-marker,
.components-section
  .component-container
  .child-components-collapse
  summary::marker,
.components-section
  .component-container
  .child-components-collapse
  summary::-webkit-details-marker {
  display: none;
}

.unresolved-incident .updates .updates-collapse[open] summary .fa-plus-square-o,
.unresolved-incident
  .updates
  .updates-collapse:not([open])
  summary
  .fa-minus-square-o,
.components-section
  .component-container
  .child-components-collapse[open]
  summary
  .fa-plus-square-o,
.components-section
  .component-container
  .child-components-collapse:not([open])
  summary
  .fa-minus-square-o {
  display: none !important;
}