input:invalid {
    outline: none !important;
}

:root[data-mantine-color-scheme="dark"] #dark-theme-icon {
    display: none;
}

:root[data-mantine-color-scheme="light"] #light-theme-icon {
    display: none;
}

.mantine-Select-dropdown {
    z-index: 10000 !important;
}

.modebar-group {
    padding-left: 0px !important;
}

.modebar {
    top: 110px !important;
    right: 10px !important;
}

._dash-loading {
  margin: auto;
  color: transparent;
  width: 0;
  height: 0;
  text-align: center;
}

._dash-loading::after {
  content: '';
  display: inline-block;
  width: 2rem;
  height: 2rem;
  color: #e8e8e8;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  -webkit-animation: spinner-border 0.75s linear infinite;
  animation: spinner-border 2s linear infinite;
  margin-top: 50vh;
}

@keyframes spinner-border {
  100% {
    transform: rotate(360deg);
  }
}

input:invalid {
    outline: none !important;
}

.custom-link {
    text-decoration: underline;
    cursor: pointer;
}

.mantine-Pill-label {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The following styles ensure the attribution tag floats above the map and should be removed if the issue is fixed in a future plotly release. */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-top-left, .maplibregl-ctrl-top-right {
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.maplibregl-map {
  font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;
    font-family: Helvetica Neue, Arial, Helvetica, sans-serif;
}

.maplibregl-canvas {
  display: block;
}

/* maplibre popup (theme-dependent coloring handled inside the component) */
.dash-maplibre-popup.maplibregl-popup {
    max-width: 350px !important;  /* bump beyond default 240px */
}

.user-page {
    min-height: calc(100dvh - 50px);
    align-items: flex-start;
}

.user-paper {
    max-width: calc(100% - 24px);
}

.user-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.user-access-summary {
    margin: 14px 0;
}

.user-access-preview {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 48em) {
    .user-fields-grid {
        grid-template-columns: 1fr;
    }
}

.municipalities-page {
    min-height: calc(100dvh - 50px);
    align-items: flex-start;
}

.municipalities-paper {
    max-width: calc(100% - 24px);
    height: calc(100dvh - 140px);
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.municipalities-grid-container {
    flex: 1 1 auto;
    min-height: 0;
}

.municipalities-grid {
    width: 100%;
    --ag-font-family: "Inter", sans-serif;
    --ag-background-color: var(--mantine-color-white);
    --ag-foreground-color: var(--mantine-color-gray-9);
    --ag-header-background-color: var(--mantine-color-gray-0);
    --ag-odd-row-background-color: var(--mantine-color-gray-0);
    --ag-border-color: var(--mantine-color-gray-3);
    --ag-secondary-border-color: var(--mantine-color-gray-2);
    --ag-control-panel-background-color: var(--mantine-color-white);
    --ag-subheader-background-color: var(--mantine-color-gray-0);
    --ag-input-background-color: var(--mantine-color-white);
    --ag-input-border-color: var(--mantine-color-gray-4);
    --ag-row-hover-color: rgba(139, 22, 28, 0.08);
    --ag-selected-row-background-color: rgba(139, 22, 28, 0.12);
}

:root[data-mantine-color-scheme="dark"] .municipalities-grid {
    --ag-background-color: var(--mantine-color-dark-7);
    --ag-foreground-color: var(--mantine-color-dark-0);
    --ag-header-background-color: var(--mantine-color-dark-6);
    --ag-odd-row-background-color: var(--mantine-color-dark-8);
    --ag-border-color: var(--mantine-color-dark-4);
    --ag-secondary-border-color: var(--mantine-color-dark-5);
    --ag-control-panel-background-color: var(--mantine-color-dark-7);
    --ag-subheader-background-color: var(--mantine-color-dark-6);
    --ag-input-background-color: var(--mantine-color-dark-6);
    --ag-input-border-color: var(--mantine-color-dark-4);
    --ag-row-hover-color: rgba(164, 121, 123, 0.22);
    --ag-selected-row-background-color: rgba(164, 121, 123, 0.3);
}

.municipalities-grid .ag-row {
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.municipalities-grid .ag-cell {
    display: flex;
    align-items: center;
    line-height: normal;
    min-width: 0;
    overflow: hidden;
}

.municipalities-grid .ag-cell-wrapper,
.municipalities-grid .ag-cell-value {
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.municipalities-grid .municipalities-blazon-column {
    justify-content: center;
}

.municipalities-grid .municipalities-blazon-column .ag-cell-wrapper,
.municipalities-grid .municipalities-blazon-column .ag-cell-value {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.municipalities-grid .municipalities-blazon-header .ag-header-cell-label {
    justify-content: center;
}

.municipalities-grid .municipalities-risk-column .ag-cell-wrapper,
.municipalities-grid .municipalities-risk-column .ag-cell-value {
    width: 100%;
}

.municipalities-grid .municipalities-open-column {
    justify-content: center;
    color: var(--mantine-color-dimmed);
    font-size: 1.5rem;
    font-weight: 300;
}

.municipality-open-cell {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.municipality-blazon-cell {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.municipality-blazon-cell img {
    max-width: 38px;
    max-height: 40px;
    object-fit: contain;
}

.municipality-risk-cell {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

.municipality-risk-track {
    flex: 1 1 auto;
    min-width: 110px;
    height: 12px;
    background: #FFA500;
    overflow: hidden;
    border-radius: 0px;
    border: 1px solid #333;
}

.municipality-risk-fill {
    height: 100%;
    background: #007BFF;
}

.municipality-risk-label {
    min-width: 42px;
    color: var(--mantine-color-dimmed);
    font-size: 0.8rem;
    text-align: right;
}

.municipality-risk-empty {
    color: var(--mantine-color-dimmed);
    font-size: 0.8rem;
    width: 100%;
    display: flex;
    align-items: center;
}

@media (max-width: 48em) {
    .municipalities-page {
        min-height: calc(100dvh - 50px);
    }

    .municipalities-paper {
        height: calc(100dvh - 74px);
        min-height: 0;
        padding: 16px !important;
        margin-top: 12px !important;
        margin-bottom: 12px !important;
    }

    .municipality-risk-cell {
        justify-content: center;
        gap: 0;
    }

    .municipality-risk-track {
        display: none;
    }

    .municipality-risk-label {
        min-width: 0;
        width: 100%;
        color: var(--ag-foreground-color);
        font-size: 0.85rem;
        text-align: center;
    }
}
