/* Global Styles */
body,
html {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden; /* Prevent vertical scrollbar on the body */
}



body {
    display: flex;
    font-size: 0.7rem;
    font-family: sans-serif;
}

body.is-loading #loader {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

body.is-loading #app-content {
    display: none;
}

/* When loading is finished, hide the loader and show the app */
body:not(.is-loading) #loader {
    display: none;
}

body:not(.is-loading) #app-content {
    display: block; /* Or whatever its default display should be */
    width: 100%;    /* Ensure it takes up space */
    height: 100%;
}

a[target="_blank"]:after{
  content: 
    url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
    margin: 0 3px 0 5px
}

input[type="checkbox"] {
    width: 0.6rem;
    height: 0.6rem;
    padding: 0;
    margin: 0;
    vertical-align: middle;
    display: inline-block;

}

/* Map Styles */
#map {
    width: 100%;
    height: 100vh;
    z-index: 1;
}

/* Common Floating Element Styles */
.floating-container {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 5px 5px 5px;
    z-index: 1000;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#timestamp {
    top: 10px;
    left: 50px;
    border-radius: 3px;
}

#auto-refresh-container {
    top: 36px;
    left: 50px;
}

#color-toggle-container {
    top: 52px;
    left: 50px;
    z-index: 999;
    cursor: pointer;

}

#logout {
    top: 88px;
    left: 50px;
    z-index: 1000;
    cursor: pointer;

}



/* Station Table and Legend Container */
#sidebar-container {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column; /* Stack station table and legend */
    align-items: flex-end; /* Align items to the right */
    z-index: 2147483647;
    
    /*max-height: calc(100vh); /* Ensure sidebar doesn't exceed viewport height */
}

/* Station Table Styles */
#station-table-wrapper {
    width: auto;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 10px; /* Space between table and legend */
    /*max-height: calc(100vh - 30px); /* Initial max height, adjust 50px based on collapsed legend height + margin */
    transition: max-height 0.3s ease-in-out; /* Smooth transition for resizing */
}

/*#station-table-wrapper[data-legend-open="true"] {
    /* Reduce max height when legend is open. We need to calculate the available space */
    /*max-height: calc(100vh - 30px - var(--legend-expanded-height));
}
*/

#station-table-wrapper[open] #station-table {
    max-height: calc(100vh - 80px - var(--legend-collapsed-height)); /* Adjust when table is collapsed */
}

#station-table-wrapper[open][data-legend-open="true"] #station-table {
    max-height: calc(100vh - 80px - var(--legend-expanded-height)); /* Adjust when both are collapsed/expanded */
}

#station-table-wrapper summary {
    display: block;
    padding: 8px 12px;
    font-weight: bold;
    cursor: pointer;
    background-color: #f8f8f8;
    border-bottom: 1px solid #ccc;
    list-style: none;
}

#station-table-wrapper summary::-webkit-details-marker {
    display: none;
}

#station-table-wrapper summary::before {
    content: '▶ ';
    font-size: .8em;
    margin-right: 5px;
}

#station-table-wrapper[open] summary::before {
    content: '▼ ';
}

#station-table {
    width: auto;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 0;
    color: black;
}

#station-table table {
    width: 100%;
    border-collapse: collapse;
}

#station-table th,
#station-table td {
    padding: 5px 5px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#station-table th {
    background-color: #e9e9e9;
    color: black;
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    /* Added for sortable headers */
}

#station-table th[data-sort="name"]::after {
    content: ' ▲';
    font-size: .8em;
    margin-left: 5px;
    opacity: 0.6;
}

#station-table th[data-sort="name"][data-order="desc"]::after {
    content: ' ▼';
}

#station-table th[data-sort="doserate"]::after {
    content: ' ▼';
    font-size: .8em;
    margin-left: 5px;
    opacity: 0.6;
}

#station-table th[data-sort="doserate"][data-order="asc"]::after {
    content: ' ▲';
}

#station-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#station-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* Map Legend Styles */
#map-legend-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    overflow: hidden; /* To contain the summary and details */
    margin-bottom: 0;
}

#map-legend-container summary {
    display: block;
    padding: 8px 12px;
    font-weight: bold;
    cursor: pointer;
    color: black;
    list-style: none;
    border-bottom: 1px solid #ccc;
}

#map-legend-container summary::-webkit-details-marker {
    display: none;
}

#map-legend-container details summary::before {
    content: '▶ ';
}

#map-legend-container details[open] summary::before {
    content: '▼ ';
}

#map-legend-container summary::before {
    content: '▶ ';
    font-size: .8em;
    margin-right: 5px;
}

#map-legend-container[open] summary::before {
    content: '▼ ';
}

#map-legend td {
    vertical-align: middle;
    padding: 5px 5px;
    color: black;
}

#map-legend table {
    margin-top: 0;
    margin-bottom: 0;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
}

.legend-kommunikasjon {
    background: #802000;
}
.legend-balanse {
    background: #F2A048;
}

.legend-ok {
    background: #218771;
}

.legend-row-1 {
    background: rgb(74, 173, 175);
}

.legend-row-2 {
    background: rgb(61, 138, 173);
}

.legend-row-3 {
    background: rgb(49, 101, 173);
}

.legend-row-4 {
    background: rgb(40, 65, 172);
}

.legend-row-5 {
    background: rgb(64, 32, 172);
}

#map-legend .legend-row-1 td,
#map-legend .legend-row-2 td,
#map-legend .legend-row-3 td,
#map-legend .legend-row-4 td,
#map-legend .legend-row-5 td {
    color: white;
}

/* Driftsmelding Legend Style */
.legend-driftsmelding-container {
    position: relative;
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-driftsmelding-outer,
.legend-driftsmelding-inner {
    position: absolute;
    border-radius: 50%;
}

.legend-driftsmelding-outer {
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: #F2A048;
}

.legend-driftsmelding-inner {
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    background: #218771;
}

/* Expand Indicator Style */
.expand-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8em;
    color: inherit;
    opacity: 0.8;
}