:root {
    --font:  system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-family: var(--font);

    --colour-black: #080B0F;
    --colour-white: #FAFAFF;
    --colour-blue: #3F84E5;
    --colour-dblue: #336cbd;
    --colour-navy: #020912;
    --colour-red: #eb3434;
    --colour-dred: #a92f2d;
    --colour-green: #46af0e;
    --colour-dgreen: #3a9c0b;
    --colour-orange: #F89225;
    --colour-purple: #8034eb;

    --nav-width: 180px;
    --header-height: 95px;
}

body {
    overflow: hidden;
    color: var(--colour-white);
    background-color: var(--colour-navy);
    margin: 0;
    display: flex;
}

/* DEFAULT ELEMENTS */

button {
    outline: none;
    border: none;
    font-family: inherit;
    font-weight: inherit;
    cursor: pointer;
    background: transparent;
    font-size: inherit;
    color: inherit;
}

input {
    border: none;
    outline: none;
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
}

select {
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
}

textarea {
    border: none;
    outline: none;
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
}

.form-checkbox input[type="checkbox"] {
    visibility: hidden;
    display: none;
}

.form-checkbox *,
.form-checkbox ::after,
.form-checkbox ::before {
    box-sizing: border-box;
}

.form-checkbox .switch {
    --size: 20px;
    width: calc(var(--size) * 2);
    height: var(--size);
    position: relative;
    display: inline-block;
}

.form-checkbox {
    padding: 2px;
    display: flex;
    align-items: center;
    height: 100%;
}

.form-checkbox .slider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--size);
    box-shadow: 0 0 0 2px #777, 0 0 4px #777;
    cursor: pointer;
    border: 4px solid transparent;
    overflow: hidden;
    transition: 0.2s;
}

.form-checkbox .slider:before {
    --translate: calc(var(--size) - 2px);
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    background-color: #777;
    border-radius: var(--size);
    transform: translateX(calc(0px - var(--translate)));
    transition: 0.2s;
}

  .form-checkbox input:checked + .slider:before {
    transform: translateX(var(--translate));
    background-color: limeGreen;
}

.form-checkbox input:checked + .slider {
    box-shadow: 0 0 0 2px limeGreen, 0 0 8px limeGreen;
}

/* SCROLLBAR STYLING */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* GENERAL CLASSES */

.heading-large {
    font-size: 24px;
    font-weight: 500;
}

.heading-small {
    font-size: 22px;
    font-weight: 500;
}

.button {
    background-color: var(--colour-blue);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: 500;
    transition: all 100ms ease-in-out;
}
.button:hover {
    background-color: var(--colour-dblue);
}
.button.red {
    background-color: var(--colour-red);
}
.button.red:hover {
    background-color: var(--colour-dred);
}
.button.green {
    background-color: var(--colour-green);
}
.button.green:hover {
    background-color: var(--colour-dgreen);
}

/* NOTIFICATIONS */

.notification {
    position: fixed;
    top: 25px;
    left: 50%;
    translate: -50%;
    font-size: 19px;
    padding: 20px;
    border-radius: 5px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    max-width: 400px;
}

.notification > i {
    font-size: 24px;
}

/* NAV */

#nav {
    width: var(--nav-width);
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    box-sizing: border-box;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-button {
    display: flex;
    gap: 10px;
    align-items: center;
    border-radius: 5px;
    padding: 14px 10px;
    font-weight: 100;
    width: 100%;
    border-left: 5px solid transparent;
    transition: all 100ms ease-in-out;
    text-align: left;
    text-transform: capitalize;
}
.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.nav-button.active {
    border-color: var(--colour-white);
}

.nav-button > i {
    width: 24px;
    text-align: center;
}

/* MDT HEADER */

#header {
    width: calc(100% - var(--nav-width));
    height: var(--header-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    position: absolute;
    top: 0;
    left: var(--nav-width);
    display: flex;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
}

#profile {
    display: flex;
    gap: 20px;
    cursor: pointer;
    padding: 16px 20px;
    box-sizing: border-box;
    margin: -10px;
    border-radius: 5px;
}
#profile:hover {
    background: rgba(255, 255, 255, 0.1);
}
#profile.show {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
    z-index: 100;
    background-color: var(--colour-navy);
}

#profile > img {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 100%;
}

#profile-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-row {
    display: flex;
    gap: 4px;
}

#profile-edit-back {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    cursor: pointer;
}
#profile-edit-back.show {
    display: block;
}

#profile-edit {
    position: absolute;
    width: 400px;
    height: fit-content;
    background-color: var(--colour-navy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    top: calc(100% - 11px);
    left: 10px;
    z-index: 99;
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 10px;
    border-radius: 5px;
    border-top-left-radius: 0;
}
#profile-edit.show {
    display: flex;
}

#status-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
}

.status-button {
    position: relative;
    border: 1px solid var(--colour);
    color: rgb(180, 180, 180);
    box-sizing: border-box;
    padding: 12px;
    border-radius: 5px;
    width: 120px;
    overflow: hidden;
    transition: all 100ms ease-in-out;
}
.status-button:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}
.status-button.active {
    color: white;
    background-color: var(--colour);
}

.unit-status {
    padding: 3px 6px;
    border-radius: 5px;
    background-color: var(--colour);
    width: fit-content;
    height: fit-content;
    color: white;
}

/* MDT MAIN */

#main {
    flex-grow: 1;
    padding: 20px;
    height: calc(100% - var(--header-height));
    margin-top: var(--header-height);
    box-sizing: border-box;
}

.main-cont {
    display: none;
    position: relative;
    width: 100%;
    height: 100%;
    gap: 12px;
}
.main-cont.active {
    display: grid;
}
.main-cont > * {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* DISPATCH */

#main-dispatch {
    grid-template-columns: 3fr 4fr;
    grid-template-rows: 5fr 2fr;
}

#dispatch-units-cont {
    display: flex;
    flex-direction: column;
    grid-row-start: 1;
    grid-row-end: 3;
}

#dispatch-units {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

#dispatch-units-heading, .dispatch-unit {
    font-size: 14px;
    display: grid;
    gap: 4px;
    padding: 4px;
}
.dispatch-unit {
    font-weight: 300;
    cursor: pointer;
    border-radius: 4px;
    display: none;
}
.dispatch-unit:nth-child(2n) {
    background-color: rgba(255, 255, 255, 0.1);
}
.dispatch-unit.is_active {
    display: grid;
}

#dispatch-units-heading > div {
    cursor: pointer;
}

.dispatch-unit > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}
.dispatch-unit > div:not(:has(div)) {
    line-height: 200%;
}
.dispatch-unit > div:last-child {
    border-right: none;
}

/* MAP */

#main-map {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    background-color: rgba(123,174,206,255);
    overflow: hidden;
    position: relative;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    cursor: grab;
}
#map.selecting {
    cursor: crosshair;
}

.map-blip {
    position: absolute;
    left: -100vw;
    translate: -50% -50%;
    width: fit-content;
    height: fit-content;
    font-size: 28px;
    text-shadow: 3px 3px 0 black;
    -webkit-text-stroke: 1px black;
    cursor: pointer;
    color: var(--blip-colour);
    z-index: 3;
}

.map-blip > * {
    z-index: 3;
    position: relative;
}

.map-blip.show-rotation::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    rotate: var(--blip-rotation, 0);
    translate: -50% -50%;
    width: 18px;
    height: 60px;
    clip-path: polygon(50% 0%, 0% 50%, 100% 50%);
    z-index: 2;
    background-color: black;
    box-shadow: 0 0 0 3px black;
}

.map-blip-trail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.map-blip-popup {
    position: absolute;
    padding: 10px;
    width: 180px;
    height: fit-content;
    background-color: white;
    border: 1px solid black;
    border-radius: 5px;
    bottom: calc(100% + 5px);
    left: 50%;
    translate: -50% 0;
    color: black;
    font-size: 16px;
    overflow: hidden;
    text-shadow: none;
    -webkit-text-stroke: 0;
    font-family: var(--font);
    font-weight: 500;
    display: none;
    flex-direction: column;
    gap: 8px;
}

.map-blip-popup > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.map-blip-popup > div > div {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* SETTINGS */

#main-settings {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 50px;
}

.settings-category {
    display: flex;
    flex-direction: column;
}

.settings-buttons {
    grid-column: 1 / -1;
    border: none;
    display: flex;
    flex-direction: row-reverse;
}

/* LOGIN PAGE */

#login-div {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.close-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    translate: -50%;
    width: fit-content;
    height: fit-content;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* INPUT POPUP */

.input-back {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    justify-content: center;
    align-items: center;
}

.input-popup {
    position: absolute;
    width: 400px;
    height: fit-content;
    background-color: var(--colour-navy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    top: 50%;
    left: 50%;
    z-index: 99;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-radius: 5px;
    translate: -50% -50%;
}

.input-popup-title {
    font-size: 22px;
    margin-bottom: 12px;
}

.input-popup-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.input-cont {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    overflow: hidden;
}

.input {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 8px;
    width: 100%;
    color: inherit;
    transition: all 100ms ease-in-out;
    height: 40px;
}
.input:focus {
    border-color: white;
}
.input[disabled] {
    /* background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5); */
    cursor: not-allowed;
}
input[type="checkbox"] {
    height: auto;
}

select.input {
    cursor: pointer;
    padding-left: 4px;
}
select.input:focus {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}
select.input > option {
    background-color: var(--colour-navy);
}

textarea.input {
    resize: none;
    height: 100%;
}

div.input {
    box-sizing: border-box;
    height: 100%;
    overflow-y: auto;
}

/* HOVER PROMPT */

.hover-prompt {
    position: absolute;
    background-color: var(--colour-navy);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 14px;
    width: fit-content;
    height: fit-content;
    padding: 4px 8px;
    translate: -50%;
    text-align: center;
    text-wrap: nowrap;
}

.hover-prompt::after {
    content: '';
    position: absolute;
    background-color: var(--colour-navy);
    width: 10px;
    height: 10px;
    top: 100%;
    left: 50%;
    translate: -50% -50%;
    rotate: 45deg;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.hover-prompt.bottom::after {
    border-bottom: none;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    clip-path: polygon(0 100%, 100% 0, 0 0);
    top: 0;
    bottom: 100%;
}

/* CURRENT CALL */

#current-call {
    width: 100%;
    height: 100%;
    margin-top: 8px;
    display: grid;
    grid-template-rows: repeat(2, 70px) 1fr 40px 50px;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px;
    overflow: hidden;
}

#current-call-units {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
}
#current-call-units:not(:has(div))::after {
    content: 'No units assigned to this call.';
    font-size: 16px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-notes-add {
    grid-column: 7 / span 6;
    display: flex;
    gap: 10px;
}
.call-notes-add > button {
    width: fit-content;
    flex-shrink: 0;
    font-weight: 400;
    border-radius: 100%;
    width: 40px;
    height: 40px;
}

.call-buttons {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    height: fit-content;
    align-self: end;
    height: 50px;
}
.call-buttons > button {
    font-weight: 400;
    font-size: 16px;
    margin-top: 10px;
    flex-shrink: 0;
}

.call-buttons > button:first-child {
    background-color: var(--colour-red);
}
.call-buttons > button:first-child:hover {
    background-color: var(--colour-dred);
}

.call-buttons > button:last-child {
    background-color: var(--colour-green);
}
.call-buttons > button:last-child:hover {
    background-color: var(--colour-dgreen);
}

.call-location-button {
    position: fixed;
    translate: -50% -50%;
    cursor: pointer;
    font-size: 22px;
}

/* CALL LOG */

#call-log {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.call-log-call {
    display: grid;
    font-size: 14px;
    display: grid;
    gap: 4px;
    padding: 4px;
    font-weight: 300;
    cursor: pointer;
    border-radius: 4px;
}
.call-log-call:nth-child(2n) {
    background-color: rgba(255, 255, 255, 0.1);
}

/* CONTEXT MENU */

.has-context-menu {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom-right-radius: 0;
    box-sizing: border-box;
    padding: 3px;
}

.context-menu, .context-submenu {
    position: absolute;
    display: flex;
    flex-direction: column;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--colour-navy);
    width: fit-content;
    height: fit-content;
    font-weight: 300;
    font-size: 14px;
}

.context-menu {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

.context-submenu {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.context-option {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* TABLE */

table.table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-heading {
    text-align: left;
}

.table-heading > th {
    padding: 4px 8px;
    cursor: pointer;
}

.table-heading i.sort-icon {
    margin-left: 6px;
}

.table-row:nth-child(2n) {
    background-color: rgba(255, 255, 255, 0.1);
}

.table-row > td {
    padding: 2 8px;
    font-weight: 300;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}
.table-row > td:not(:first-child) {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* ADMIN */

#main-admin.active {
    display: flex;
    flex-direction: column;
}

#admin-tabs {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: none;
    border: none;
    height: fit-content;
}

.admin-tab-button {
    border: 1px solid grey;
    border-bottom-color: var(--colour-white);
    padding: 4px 20px;
    cursor: pointer;
    width: fit-content;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    z-index: 5;
    background-color: var(--colour-navy);
}
.admin-tab-button.active {
    border-color: var(--colour-white);
    border-bottom: none;
}

.admin-tab-content {
    display: none;
    margin-top: -19px;
    border-color: var(--colour-white);
    height: 100%;
    flex-shrink: 1;
}
.admin-tab-content.active {    
    display: block;
}