@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
    /*    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;*/
    /*    background: black;*/
    background: var(--mdc-theme-on-secondary);
}

a, .btn-link {
    color: #0366d6;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

app {
    position: relative;
    display: flex;
    flex-direction: column;
}

.top-row {
    height: 4.5rem;
    display: flex;
    align-items: center;
}

.main {
    flex: 1;
}

    .main .top-row {
/*        background-color: #f7f7f7;*/
/*        border-bottom: 1px solid #d6d5d5;*/
        justify-content: flex-end;
    }

        .main .top-row > a, .main .top-row .btn-link {
            white-space: nowrap;
            margin-left: 1.5rem;
        }

.main .top-row a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

    .sidebar .top-row {
        background-color: rgba(0,0,0,0.4);
    }

    .sidebar .navbar-brand {
        font-size: 1.1rem;
    }

    .sidebar .oi {
        width: 2rem;
        font-size: 1.1rem;
        vertical-align: text-top;
        top: -2px;
    }

    .sidebar .nav-item {
        font-size: 0.9rem;
        padding-bottom: 0.5rem;
    }

        .sidebar .nav-item:first-of-type {
            padding-top: 1rem;
        }

        .sidebar .nav-item:last-of-type {
            padding-bottom: 1rem;
        }

        .sidebar .nav-item a {
            color: #d7d7d7;
            border-radius: 4px;
            height: 3rem;
            display: flex;
            align-items: center;
            line-height: 3rem;
        }

            .sidebar .nav-item a.active {
                background-color: rgba(255,255,255,0.25);
                color: white;
            }

            .sidebar .nav-item a:hover {
                background-color: rgba(255,255,255,0.1);
                color: white;
            }

.content {
    padding-top: 1.1rem;
}

.navbar-toggler {
    background-color: rgba(255, 255, 255, 0.1);
}

/*.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}*/

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 767.98px) {
    .main .top-row:not(.auth) {
        display: none;
    }

    .main .top-row.auth {
        justify-content: space-between;
    }

    .main .top-row a, .main .top-row .btn-link {
        margin-left: 0;
    }
}

@media (min-width: 768px) {
    app {
/*        flex-direction: row;*/
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .main .top-row {
        position: sticky;
        top: 0;
    }

    .main > div {
        /*        padding-left: 2rem !important;*/
        /*        padding-right: 1.5rem !important;*/
                padding-left: 1rem !important;
                padding-right: 1rem !important;
    }

    .navbar-toggler {
        display: none;
    }

    .sidebar .collapse {
        /* Never collapse the sidebar for wide screens */
        display: block;
    }
}

/* MatBlazor temp */
.mat-toast-body {
    padding: 8px 5px;
}

.mat-toast-icon {
    padding-left: 5px;
}

.mat-toast-close-button .material-icons {
    color: white;
}

.div-resizable {
    border: 1px solid;
    padding: 0px;
    width: 1280px;
    resize: both;
    overflow: auto;
}
.div-canvas {
    width: 100%;
    height: 100%;
    border: 0;
    left: 0;
    top: 0;
    position: absolute;
    overflow: hidden;
    scrollbar-width: none;
}

.canvasholderx {
    background: black;
}

.iframe-container {
    overflow: hidden;
    padding-top: 56.25%;
    position: relative;
}

    .iframe-container iframe {
        border: 0;
        height: 100%;
        left: 0;
        position: absolute;
        top: 0;
        width: 100%;
    }

.cams-top-container {
    width: 100%;
    display: flex;
    flex-direction: row;
    height: 100%;
}
.cams-container {
    width: 100%;
    display: flex;
    flex-direction: row;
    height: 100%;
}

.cams-iframe {
    width: 100%;
    display: flex;
    height: calc(100vh - 120px);
}
    .cams-iframe iframe {
        border: 0;
        left: 0;
        top: 0;
        width: 100%;
    }


.cams-timeline {
    display: flex;
    flex-direction: column;
    width: 18%;
/*    width: 200px;*/
    background: black;
    color: white;
    height: calc(100vh - 120px);
}
.cams-timeline-header {
    width: 100%;
    text-align: center;
    font-family: monospace;
    background: var(--mdc-theme-primary);
/*    top: 0px;*/
}

.cams-timeline-lanes {
    width: 100%;
    height: inherit;
}

.cams-timeline-footer {
    width: 100%;
    text-align: center;
    background: var(--mdc-theme-primary);
    font-family: monospace;
    position: relative;
}

.menuwrapperdiv {
    position: relative;
}

.menuoverlaybuttondiv {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
}

    .menuoverlaybuttondiv * {
        font-size: 14px !important;
        padding: 0px !important;
        width: 20px !important;
        height: 16px !important;
    }

.mdc-top-app-bar .mdc-icon-button {
    --mdc-ripple-top: 13px !important;
}

.mdc-select__anchor .mdc-floating-label {
    left: 16px !important;
}

.mdc-select .mdc-select__anchor {
    padding-left: 16px !important;
}

/*.mat-tooltip {
    white-space: pre-line;
}*/

.tlmarker {
    z-index: 100;
    height: 1px;
    background: white;
    position: absolute;
    visibility: hidden;
}

.tlttmarker {
    z-index: 150;
    height: 1px;
    background: yellow;
    position: absolute;
    opacity: 0.5;
}

.tlzoom {
    z-index: 200;
    height: 1px;
    background: white;
    position: absolute;
    opacity: 0.5;
    visibility: hidden;
}

.tllistener {
    z-index: 1000;
    height: 1px;
    background: white;
    position: absolute;
    opacity: 0.0;
}

/* Blazor Reconnection UI */
#components-reconnect-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.components-reconnect-hide {
    display: none;
}

.components-reconnect-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.6);
}

.components-reconnect-dialog {
    position: relative;
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    text-align: center;
}

.components-reconnect-show,
.components-reconnect-failed,
.components-reconnect-rejected {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-show {
    display: block;
}

#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed {
    display: block;
}

#components-reconnect-modal.components-reconnect-rejected .components-reconnect-rejected {
    display: block;
}

.components-reconnect-dialog p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.components-reconnect-dialog a {
    color: #0366d6;
    text-decoration: underline;
}

/* ============================================
   Mobile Responsive Styles for Top App Bar
   ============================================ */

/* Global chip text truncation for all screen sizes */
.mdc-top-app-bar .mdc-chip,
.mdc-top-app-bar .mat-chip {
    max-width: 200px;
    overflow: hidden;
}

.mdc-top-app-bar .mdc-chip .mdc-chip__text,
.mdc-top-app-bar .mdc-chip__text,
.mdc-top-app-bar .mat-chip__text,
.mdc-top-app-bar .mdc-chip__primary-action {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: inline-block;
    max-width: 100%;
    vertical-align: middle;
}

/* Ensure chip label text is truncated */
.mdc-top-app-bar .mdc-chip__text,
.mdc-top-app-bar .mat-chip .mdc-evolution-chip__text-label {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.mdc-top-app-bar .mdc-chip .material-icons,
.mdc-top-app-bar .mat-chip .material-icons {
    flex-shrink: 0;
}

/* Ensure appbar sections don't overflow */
.mdc-top-app-bar__section {
    overflow: hidden;
}

.mdc-top-app-bar__section--align-start {
    flex-shrink: 1;
    min-width: 0;
}

.mdc-top-app-bar__section--align-end {
    flex-shrink: 0;
}

/* Mobile: Extra Small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Hide logo on mobile to save space */
    .mdc-top-app-bar img {
        display: none !important;
    }

    /* Hide title on mobile */
    /* .mdc-top-app-bar__title {
        display: none !important;
    } */

    /* Hide chips with resolution and FPS on mobile */
    .chip-resolution,
    .chip-fps {
        display: none !important;
    }

    /* Make icon buttons smaller on mobile */
    .mdc-top-app-bar .mdc-icon-button {
        width: 36px !important;
        height: 36px !important;
        padding-top: 8px !important;
        padding: 6px !important;
    }

    .mdc-top-app-bar .mdc-icon-button .material-icons {
        font-size: 20px !important;
    }

    /* Make chips smaller on mobile */
    .mdc-top-app-bar .mdc-chip {
        height: 24px !important;
        font-size: 11px !important;
        padding: 4px 8px 2px !important;
        max-width: 100px !important;
        overflow: hidden !important;
    }

    .mdc-top-app-bar .mdc-chip .mdc-chip__text {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .mdc-top-app-bar .mdc-chip .material-icons {
        font-size: 16px !important;
        flex-shrink: 0 !important;
        padding: 1px 0px!important;
    }

    /* Hide icon in time chip on mobile to save space */
    .chip-datetime .material-icons {
        display: none !important;
    }

    /* Give more room for time chip */
    .chip-datetime {
        max-width: 120px !important;
    }

    .chip-datetime.live-mode {
        display: none !important;
    }

    .chip-camera.playback-mode {
        min-width: 28px !important;
    }

    .chip-mode.playback-mode {
        display: none !important;
    }

    .chip-camera.live-mode {
        max-width: 200px !important;
    }

    .chip-camera.live-mode .material-icons {
        display: none !important;
    }

    /* Reduce spacing between sections */
    .mdc-top-app-bar__section {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    /* Stack appbar on mobile if needed */
    .mdc-top-app-bar__row {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    /* Adjust iframe height for mobile */
    .cams-iframe {
        height: calc(100vh - 90px) !important;
    }

    /* Make timeline narrower or hide on very small screens */
    .cams-timeline {
        width: 25% !important;
        min-width: 80px !important;
    }

    /* Reduce timeline header/footer font size */
    .cams-timeline-header,
    .cams-timeline-footer {
        font-size: 10px !important;
    }
}

/* Small devices (landscape phones, 576px to 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Hide logo on mobile to save space */
    .mdc-top-app-bar img {
        display: none !important;
    }

    /* Make title smaller on mobile */
    .mdc-top-app-bar__title {
        font-size: 14px !important;
        padding-left: 8px !important;
    }

    /* Hide chips with resolution and FPS on mobile */
    .chip-resolution,
    .chip-fps {
        display: none !important;
    }

    /* Smaller icon buttons */
    .mdc-top-app-bar .mdc-icon-button {
        width: 40px !important;
        height: 40px !important;
        padding: 8px !important;
    }

    /* Smaller chips */
    .mdc-top-app-bar .mdc-chip {
        height: 28px !important;
        font-size: 12px !important;
        max-width: 140px !important;
        min-width: 48px !important;
        overflow: hidden !important;
    }

    .mdc-top-app-bar .mdc-chip .mdc-chip__text {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    /* Hide icons in time and camera chips to save space */
    .chip-datetime .material-icons,
    .chip-camera .material-icons {
        display: none !important;
    }

    /* Give more room for time chip */
    .chip-datetime {
        max-width: 140px !important;
    }

    /* Shorten camera name chip */
    .chip-camera {
        max-width: 100px !important;
    }

    .chip-mode.playback-mode {
        display: none !important;
    }

    .cams-iframe {
        height: calc(100vh - 100px) !important;
    }

    .cams-timeline {
        width: 20% !important;
    }
}

/* Medium devices (tablets, 768px to 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Normal logo size */
    .mdc-top-app-bar img {
        width: 42px !important;
        height: 42px !important;
    }

    /* Show all chips but smaller */
    .mdc-top-app-bar .mdc-chip {
        height: 30px !important;
        font-size: 13px !important;
        max-width: 160px !important;
        overflow: hidden !important;
    }

    .mdc-top-app-bar .mdc-chip .mdc-chip__text {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .cams-iframe {
        height: calc(100vh - 110px) !important;
    }

    .cams-timeline {
        width: 18% !important;
    }
}

/* Large devices and up (desktops, 992px and up) - default styles apply */
@media (min-width: 992px) {
    /* Keep default styles */
}

/* Portrait orientation specific adjustments */
@media (orientation: portrait) and (max-width: 767.98px) {
    /* Hide mode chip on portrait mobile */
    .mat-chip:not([leadingicon]) {
        max-width: 80px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Make appbar sections wrap if absolutely necessary */
    .mdc-top-app-bar__section--align-end {
        flex-shrink: 1 !important;
    }
}

/* Landscape orientation specific adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    /* Maximize vertical space on landscape */
    .cams-iframe {
        height: calc(100vh - 60px) !important;
    }

    .cams-timeline {
        height: calc(100vh - 60px) !important;
    }
}



