@font-face {
    font-family: Montserrat;
    src: url('/css/fonts/Montserrat.ttf');
}

canvas {
    display: block;
}

body {
    padding-bottom: 5rem;
}

:root {
    --bs-font-sans-serif: Montserrat, system-ui;
}

/* Make Nette links look like normal text */
a {
    color: var(--bs-body-color);
    text-decoration: none;
}

/* Bootstrap's toasts container */
.toast-container {
    /* Ensure it appears above the modal */
    z-index: 7000;
}

.toast-header {
    font-size: 1rem;
}

.toast-header.no-details {
    border-bottom: 0px;
    border-bottom-left-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width));
    border-bottom-right-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width));
}

.toast-body {
    background-color: var(--bs-toast-header-bg);
    border-bottom-left-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width));
    border-bottom-right-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width));
}

/* Make Nette links in toasts look like links */
.toast-body a,
.toast-header a {
    color: var(--bs-info);
    text-decoration: underline;
}

.popover {
    --bs-popover-font-size: var(--bs-font-size-base);
}

.monospace-number {
    font-variant-numeric: tabular-nums;
}

/* Customize Bootstrap tooltip */
.custom-tooltip {
    --bs-tooltip-bg: var(--bs-primary-bg-subtle);
    --bs-tooltip-color: var(--bs-black);
    --bs-tooltip-opacity: 1;
    border-radius: var(--bs-tooltip-border-radius);
    box-shadow: 0 0px 8px rgba(0, 0, 0, 0.2);
}

/* Highlight currently navbar link if active or if has active dropdown item */
.navbar .nav-item .nav-link.active,
.navbar .nav-item:has(.dropdown-item.active)>.nav-link {
    box-shadow: inset 0 -1px 0 0 var(--bs-primary);
}

/* Default color for projects dropdown items in navbar */
.navbar .nav-item .projects-dropdown-menu .dropdown-item {
    color: var(--bs-navbar-color);
}

/* Highlight currently active dropdown item in navbar */
.navbar .nav-item .dropdown-item.active,
.navbar .nav-item .projects-dropdown-menu .project-selected {
    color: var(--bs-black);
    background-color: var(--bs-primary-bg-subtle);
    box-shadow: inset 0 -1px 0 0 var(--bs-primary);
}

/* Style for the project dropdown in navbar */
.nav-project-dropdown {
    max-width: 15rem;
    align-items: center;
    display: flex;
}

/* Style for the account in navbar */
.nav-account-dropdown {
    max-width: 10rem;
    align-items: center;
    display: flex;
}


/* Make the dropdown scrollable */
.scrollable-dropdown {
    max-height: 50vh;
    overflow-y: auto;
}

.scrollable-dropdown::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    border-radius: var(--bs-dropdown-border-radius);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
}

/* Style for scanned devices list */
#scan-devices {
    max-height: 50vh;
    overflow-y: auto;
}

/* Style for the scan progress bar */
#scan-progress-bar {
    width: 0%;
    height: 1.5rem;
}

/* Style for the account projects list */
.account-projects-list {
    max-height: 30vh;
    overflow-y: auto;
}

/* Do not wrap nav items */
.nav-item {
    white-space: nowrap;
}

.projects-dropdown-menu {
    max-width: 20rem;
    overflow-x: hidden;
}

/* Style for selected (active) card */
.card-selected {
    border-color: var(--bs-primary);
    border-width: 1px;
}

.card-selected .card-header {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
    font-weight: bold;
}

.card-selected::after {
    --border-width: 3px;
    content: "";
    z-index: -1;
    position: absolute;
    border-radius: var(--bs-border-radius);
    top: calc(-1 * var(--border-width));
    left: calc(-1 * var(--border-width));
    width: calc(100% + var(--border-width) * 2);
    height: calc(100% + var(--border-width) * 2);
    background: linear-gradient(60deg,
            #2ebdbc,
            #ffffff,
            #2ebdbc);
    background-size: 300% 300%;
    background-position: 0 50%;
    animation: moveGradient 5s alternate infinite;
}

@keyframes moveGradient {
    50% {
        background-position: 100% 50%;
    }
}

/* Style for projects counters */
.projects-counter-item {
    color: white;
    font-size: 1rem;
    border: none;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.projects-counter-item:hover {
    color: white;
    filter: brightness(1.1);
}

.projects-counter-item.active {
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.projects-counter-item.inactive {
    opacity: 0.3;
}

.zone-label {
    cursor: text;
}

.node-label {
    cursor: text;
}

/* Style for alarm indicator */
.alarm-indicator-count {
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.toast {
    width: fit-content;
    max-width: 500px;
}

/* Style for the configuration sync container */
.config-sync-container {
    /* Ensure it appears above the modal (--bs-modal-zindex: 1055) */
    z-index: 1060;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.95;
    max-height: 50%;
    overflow-y: auto;
    transition: opacity 0.3s ease-in-out;
    border-radius: 0.75rem;
    border: 1px solid #cfe2ff;
    background: #f8fcff;
    padding: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.15);
}

/* Hide if initially hidden or if there are no config sync card */
.config-sync-container.initially-hidden,
.config-sync-container:not(:has(.config-sync-card)) {
    display: none;
}

.config-sync-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.config-sync-buttons .btn {
    flex: 1 1 auto;
    white-space: nowrap;
    min-width: 250px;
}

/* Styles for the configured zones list in the Configure section */
.configure-zones-list {
    max-height: 55vh;
    overflow-y: auto;
}

/* Styles for the configured devices list in the Configure section */
.configure-devices-list {
    max-height: 55vh;
    overflow-y: auto;
}

/* Style for the global modal */
#global-modal .modal-dialog {
    transform: translate(0, -50px);
}

#global-modal .modal-content {
    position: absolute;
    max-height: 80%;
}

.draggable {
    cursor: grab;
}

.sticky-header th {
    position: sticky;
    top: 0;
    background-color: var(--bs-body-bg);
    z-index: 1;
}

/* Pulsing effect */
.pulsing {
    animation: pulsing 1s infinite;
}

@keyframes pulsing {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.event-message-textarea {
    resize: vertical;
}

.event-priority-select {
    max-width: 8rem;
}

.events-table-container {
    max-height: 80vh;
    overflow-y: auto;
}

.events-time-column {
    max-width: 250px;
    width: 250px;
    white-space: nowrap;
}

.events-source-column {
    max-width: 150px;
    width: 100px;
    white-space: normal;
}

.events-priority-column {
    max-width: 100px;
    width: 100px;
    white-space: nowrap;
}

.events-message-column {
    white-space: normal;
    max-width: 400px;
    word-wrap: break-word;
}

.events-message-toggle {
    display: flex;
    align-items: center;
    padding: 0;
    color: var(--bs-info);
}

.popover-message {
    max-width: 800px;
}

#popover-message .form-control {
    min-width: 300px;
}

.fs-7 {
    font-size: 0.875rem;
}

.fs-8 {
    font-size: 0.75rem;
}

/* Style for the icon used to expand/collapse details */
.unfold-icon {
    display: inline-block;
    transition: transform .3s ease-in-out;
}

.unfold-icon:hover {
    color: var(--bs-secondary);
    filter: brightness(1.2);
}

.collapsed .unfold-icon {
    transform: rotate(-180deg) !important;
}

/* Real-Time Data loading spinner */
.loading-container {
    height: 20rem;
}

.loading-container .spinner-border {
    width: 5rem;
    height: 5rem;
}

/* Style for the default value in the configuration */
.default-value {
    color: var(--bs-secondary);
}

/* Style for Node, Zone, etc. rename input */
.rename-input {
    width: 100%;
    max-width: 100%;
    display: inline-block;
    padding: 0.2rem 0.5rem;
}

/* Configuration item (property) in modal */
.config-item {
    margin-bottom: 1rem;
}

/* Styling for the drop zone when a draggable element hovers over it,
    but not for embedded accordions */
.zone.accordion-item.over * {
    background-color: var(--bs-primary-bg-subtle) !important;
    transition: background-color 0.2s ease-in-out;
}

/* Enhanced Toggle Switch Styling */
.enhanced-toggle-container {
    display: flex;
    justify-content: start;
    align-items: center;
    gap: 0.5rem;
}

.enhanced-toggle {
    display: inline-block;
    transition: all 0.2s ease;
    color: var(--bs-secondary);
    padding: 0.1em 0.5em;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.enhanced-toggle.active {
    background-color: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary);
}

.enhanced-toggle-hidden-description {
    display: none;
}

/* Make the toggle a bit larger */
.enhanced-toggle-form .form-check-input {
    width: 2.5em;
    height: 1.25em;
}

/* Local time badge */
.local-time-indicator {
    position: absolute;
    top: 0;
    left: 100%;
    transform: translate(-95%, -50%);
    z-index: 6;
}

/* Charts area and container for historic data*/
.charts-area {
    min-height: 50vh;
    margin-top: 3rem;
}

.chart-container {
    height: 25rem;
}

.chart-wrapper {
    margin-bottom: 3rem;
}

.chart-tooltip-item {
    display: flex;
    gap: 0.15rem;
    align-items: center;
}

.chart-tooltip-name {
    max-width: 170px;
    word-break: break-word;
    white-space: normal;
    margin-right: 0.5rem;
}

/* Loading spinner overlay */
.spinner-overlay {
    position: absolute;
    justify-content: center;
    align-items: center;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    display: none;
}

/* Spinner style */
.spinner-overlay .spinner-border {
    width: 5rem;
    height: 5rem;
}

/* Show spinner when active */
.spinner-overlay.active {
    display: flex;
}

/* Refresh spinner for historic data */
.refresh-spinner {
    display: none;
}

.refresh-spinner.active {
    display: flex;
}

/* Real-Time Data measurement chart styles */
.real-time-meas-chart-container {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
}

.real-time-meas-chart {
    width: 60px;
    height: 20px;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Real-Time Data scheduler info row */
.real-time-scheduler-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
    border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    padding: 0.25rem;
    gap: 1rem;
}

/* Real-Time Data Node title and measurement row */
.real-time-node-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem;
    width: 100%;
    gap: 1rem;
}

.real-time-node-meas-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
    border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color);
    padding: 0.25rem;
    gap: 1rem;
}

/* Class that preserves the sign space for numbers to prevent layout shifts */
.with-sign-space::before {
    content: '-';
    visibility: hidden;
    display: inline-block;
}

/* Style for the submit button container in global modal */
#submit-button-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

#submit-button-container>* {
    flex: 1;
}

/* Style for the documentation items (files) */
.docs-item:hover {
    background-color: var(--bs-primary-bg-subtle);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

/* Style for copyable elements */
.copyable {
    cursor: pointer;
    transition: background-color 0.2s, border-radius 0.2s, box-shadow 0.2s ease;
}

.copied {
    background-color: var(--bs-primary);
    border-radius: var(--bs-border-radius);
    box-shadow: 0 0 0.5rem 0.25rem var(--bs-primary);
}

/* Style for the logs container */
.logs-container {
    max-height: 80vh;
    overflow-y: auto;
}

/* Project status indicator in navbar */
#project-status-indicator-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0.3rem;
}

#project-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    --status-color: #6c757dbf;
    background-color: var(--status-color);
    box-shadow: 0 0 4px color-mix(in srgb, var(--status-color), transparent 50%);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#project-status-indicator[data-state="running"] {
    --status-color: #34c759;
}

#project-status-indicator[data-state="stopped"] {
    --status-color: #ff9500;
}

#project-status-indicator[data-state="offline"] {
    --status-color: #ff3b30;
}

.relative-time {
    cursor: pointer;
    user-select: none;
    display: inline-block;
    position: relative;
    transition: opacity 150ms ease, transform 150ms ease;
}

.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

.fade-in {
    opacity: 1;
    transform: scale(1);
}