/*
 * Global page layout.
 */

:root {
    --panel-width: 360px;
    --panel-background: #ffffff;
    --panel-border: #d9dee5;
    --primary-color: #1769aa;
    --primary-hover-color: #12578e;
    --text-color: #1f2933;
    --muted-text-color: #66727f;
    --disabled-color: #c5cbd2;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text-color);
}


/*
 * Origo map.
 */

#app-wrapper {
    width: 100%;
    height: 100%;
}


/*
 * Detection panel.
 */

#detection-panel {
    position: absolute;
    top: 16px;
    left: 64px;
    z-index: 1000;

    display: flex;
    flex-direction: column;

    width: var(--panel-width);
    max-height: calc(100vh - 32px);

    overflow: hidden;

    background: var(--panel-background);
    border: 1px solid var(--panel-border);
    border-radius: 10px;

    box-shadow:
        0 8px 24px
        rgba(0, 0, 0, 0.18);
}

.panel-header {
    padding: 18px 20px 14px;

    color: #ffffff;
    background: #263746;
}

.panel-header h1 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;
}

.panel-header p {
    margin: 4px 0 0;

    font-size: 14px;
    color: #d5dde5;
}


/*
 * Time filter.
 */

.time-filter {
    display: grid;
    gap: 8px;

    padding: 16px 20px;

    border-bottom: 1px solid var(--panel-border);
}

.time-filter label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted-text-color);
}

.time-filter input {
    width: 100%;
    min-height: 38px;

    padding: 7px 9px;

    font: inherit;
    font-size: 14px;

    color: var(--text-color);
    background: #ffffff;

    border: 1px solid #b8c1ca;
    border-radius: 5px;
}

.time-filter input:focus {
    outline: 2px solid rgba(23, 105, 170, 0.25);
    border-color: var(--primary-color);
}

#search-button {
    min-height: 40px;
    margin-top: 6px;

    font: inherit;
    font-weight: 600;

    color: #ffffff;
    background: var(--primary-color);

    border: 0;
    border-radius: 5px;

    cursor: pointer;
}

#search-button:hover {
    background: var(--primary-hover-color);
}


/*
 * Result list.
 */

.result-summary {
    padding: 11px 20px;

    font-size: 13px;
    font-weight: 600;
    color: var(--muted-text-color);

    border-bottom: 1px solid var(--panel-border);
}

#detection-list {
    flex: 1;

    min-height: 120px;
    overflow-y: auto;

    background: #f7f9fb;
}

.detection-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;

    width: 100%;
    padding: 11px 20px;

    text-align: left;
    font: inherit;
    color: var(--text-color);
    background: #ffffff;

    border: 0;
    border-bottom: 1px solid var(--panel-border);

    cursor: pointer;
}

.detection-item:hover,
.detection-item:focus-visible,
.detection-item.is-highlighted {
    color: #111827;
    background: #fff4b8;
    outline: none;
}

.detection-item time {
    font-size: 14px;
    color: inherit;
}

.detection-summary {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted-text-color);
}

.detection-item:hover .detection-summary,
.detection-item:focus-visible .detection-summary,
.detection-item.is-highlighted .detection-summary {
    color: #594b00;
}

.empty-message {
    margin: 0;
    padding: 32px 20px;

    text-align: center;
    font-size: 14px;
    color: var(--muted-text-color);
}


/*
 * Pagination.
 */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 20px;

    background: #ffffff;
    border-top: 1px solid var(--panel-border);
}

.pagination button {
    width: 42px;
    height: 34px;

    font-size: 18px;
    color: #ffffff;
    background: var(--primary-color);

    border: 0;
    border-radius: 5px;

    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-hover-color);
}

.pagination button:disabled {
    color: #737b84;
    background: var(--disabled-color);

    cursor: not-allowed;
}

#page-status {
    font-size: 13px;
    color: var(--muted-text-color);
}


/*
 * Frame modal.
 */

.frame-modal[hidden],
.frame-image-stage[hidden] {
    display: none !important;
}

.frame-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 28px;
}

.frame-modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(8, 15, 24, 0.78);
}

.frame-modal-content {
    position: relative;
    z-index: 1;

    display: flex;
    flex-direction: column;

    width: min(1100px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);

    overflow: hidden;

    background: #ffffff;
    border-radius: 10px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.4);
}

.frame-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 18px;

    color: #ffffff;
    background: #263746;
}

.frame-modal-header h2 {
    margin: 0;

    font-size: 18px;
}

.frame-modal-header p {
    margin: 4px 0 0;

    font-size: 13px;
    color: #d5dde5;
}

#close-frame-modal {
    width: 40px;
    height: 40px;

    padding: 0;

    font-size: 30px;
    line-height: 36px;

    color: #ffffff;
    background: transparent;

    border: 0;
    border-radius: 5px;

    cursor: pointer;
}

#close-frame-modal:hover {
    background: rgba(255, 255, 255, 0.15);
}

#frame-modal-message {
    padding: 48px 20px;

    text-align: center;
    color: var(--muted-text-color);
}

.frame-image-stage {
    position: relative;

    align-self: center;

    width: fit-content;
    max-width: 100%;

    overflow: hidden;

    background: #101418;
}

#frame-image {
    display: block;

    max-width: 100%;
    max-height: calc(100vh - 190px);

    width: auto;
    height: auto;
}

#detection-box-layer {
    position: absolute;
    inset: 0;

    pointer-events: none;
}

.detection-box {
    position: absolute;

    border: 3px solid #ff2d2d;

    box-shadow:
        0 0 0 1px
        rgba(0, 0, 0, 0.6);
}

.detection-box-label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;

    min-width: max-content;
    padding: 3px 6px;

    font-size: 12px;
    line-height: 16px;

    color: #ffffff;
    background: rgba(220, 45, 45, 0.95);
}

/*
 * Keep ROI labels inside the ROI box, but place object labels
 * immediately above their detection boxes so they do not cover
 * the detected object.
 */
.detection-object-box > .detection-box-label {
    top: auto;
    bottom: 100%;
}

.frame-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    min-height: 45px;
    padding: 13px 18px;

    font-size: 13px;
    color: var(--muted-text-color);

    border-top: 1px solid var(--panel-border);
}


/*
 * Small-screen layout.
 */

@media (max-width: 700px) {
    #detection-panel {
        top: 8px;
        right: 8px;
        left: 56px;

        width: auto;
        max-height: calc(100vh - 16px);
    }

    .frame-modal {
        padding: 8px;
    }

    .frame-modal-content {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .frame-modal-footer {
        flex-direction: column;
        gap: 4px;
    }
}
