/* =========================================================
   SAMNET CAMERA VIEWER
   /assets/css/cameras.css

   Matches the current cameras.js DOM structure.
   ========================================================= */


/* =========================================================
   MAIN CONTAINER
   ========================================================= */

.cam-console {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 32px 0 60px;
}


/* =========================================================
   INTRO
   ========================================================= */

.cam-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 24px;
}

.cam-intro > div > span {
    display: block;
    margin-bottom: 6px;

    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;

    color: #657080;
}

.cam-intro h1 {
    margin: 0;

    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1;
    font-weight: 700;
}

.cam-intro p {
    margin: 10px 0 0;

    color: #657080;
    font-size: 1rem;
}

.cam-intro small {
    color: #657080;
    white-space: nowrap;
}


/* =========================================================
   MAIN CONTROL BAR
   ========================================================= */

.cam-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;

    padding: 18px;
    margin-bottom: 24px;

    background: #ffffff;

    border: 1px solid #dfe3e8;
    border-radius: 12px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.cam-controls > div {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.cam-controls label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;

    color: #657080;
}


/* =========================================================
   SEGMENTED BUTTONS
   ========================================================= */

.seg {
    display: flex;
    align-items: center;
    overflow: hidden;

    border: 1px solid #cfd5dc;
    border-radius: 8px;

    background: #f5f6f7;
}

.seg button {
    appearance: none;

    border: 0;
    border-right: 1px solid #cfd5dc;

    padding: 10px 14px;

    background: transparent;
    color: #28313c;

    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;

    cursor: pointer;
}

.seg button:last-child {
    border-right: 0;
}

.seg button:hover {
    background: #e9ecef;
}

.seg button.active {
    background: #252c34;
    color: #ffffff;
}


/* =========================================================
   TIMELAPSE / HISTORICAL CONTROLS
   ========================================================= */

.history {
    display: flex !important;
    align-items: flex-end;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 10px !important;
}

.history[hidden] {
    display: none !important;
}

.history label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history input,
.history select,
.history button {
    height: 40px;
    box-sizing: border-box;

    padding: 0 11px;

    border: 1px solid #cfd5dc;
    border-radius: 7px;

    background: #ffffff;
    color: #28313c;

    font: inherit;
    font-size: 0.88rem;
}

.history button {
    cursor: pointer;
    font-weight: 600;
}

.history button:hover {
    background: #f0f2f4;
}


/* =========================================================
   NOTICE
   ========================================================= */

.cam-notice {
    width: min(1138px, 100%);
    box-sizing: border-box;

    margin: 0 auto 18px;
    padding: 12px 15px;

    border: 1px solid #d9dee4;
    border-radius: 8px;

    background: #f6f7f8;
    color: #414b57;

    font-size: 0.9rem;
}

.cam-notice[hidden] {
    display: none !important;
}


/* =========================================================
   CAMERA GRID
   ========================================================= */

.cam-grid {
    display: grid;
    gap: 18px;

    width: 100%;

    margin-left: auto;
    margin-right: auto;

    justify-content: center;
}


/* 1 × 1 */

.cam-grid.layout-1x1 {
    grid-template-columns: minmax(0, 800px);
    max-width: 800px;
}


/* 2 × 1 */

.cam-grid.layout-2x1 {
    grid-template-columns: repeat(2, minmax(0, 560px));
    max-width: 1138px;
}


/* 2 × 2 */

.cam-grid.layout-2x2 {
    grid-template-columns: repeat(2, minmax(0, 520px));
    max-width: 1058px;
}


/* 3 × 2 */

.cam-grid.layout-3x2 {
    grid-template-columns: repeat(3, minmax(0, 420px));
    max-width: 1296px;
}


/* 3 × 3 */

.cam-grid.layout-3x3 {
    grid-template-columns: repeat(3, minmax(0, 400px));
    max-width: 1236px;
}


/* =========================================================
   CAMERA TILE
   ========================================================= */

.cam-tile {
    width: 100%;
    min-width: 0;

    overflow: hidden;

    background: #080a0c;

    border: 1px solid #272d33;
    border-radius: 10px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}


/* =========================================================
   CAMERA TILE TOOLBAR

   Actual JS class:
   .cam-tile-toolbar
   ========================================================= */

.cam-tile-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;

    width: 100%;
    height: 44px;

    box-sizing: border-box;

    padding: 6px 8px;

    background: #ffffff;

    border-bottom: 1px solid #d9dee4;
}

.cam-tile-toolbar select {
    flex: 1;

    min-width: 0;
    height: 32px;

    box-sizing: border-box;

    padding: 0 8px;

    border: 1px solid #cfd5dc;
    border-radius: 6px;

    background: #ffffff;
    color: #28313c;

    font: inherit;
    font-size: 0.84rem;
}


/* Remove button */

.cam-remove {
    flex: 0 0 auto;

    height: 32px;

    box-sizing: border-box;

    padding: 0 10px;

    border: 1px solid #cfd5dc;
    border-radius: 6px;

    background: #ffffff;
    color: #555f6b;

    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;

    cursor: pointer;
}

.cam-remove:hover {
    background: #f0f2f4;
}


/* =========================================================
   CAMERA STAGE

   Actual JS class:
   .cam-stage

   This explicitly controls the camera dimensions.
   ========================================================= */

.cam-stage {
    position: relative;

    display: block;

    width: 100%;
    height: auto;

    aspect-ratio: 16 / 9;

    overflow: hidden;

    background: #080a0c;
}


/* =========================================================
   ACTUAL CAMERA JPEG

   Actual JS class:
   .cam-image
   ========================================================= */

.cam-image {
    position: absolute !important;

    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;

    display: block;

    width: 100% !important;
    height: 100% !important;

    max-width: 100% !important;
    max-height: 100% !important;

    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    transform: none !important;

    object-fit: contain !important;
    object-position: center center;

    background: #080a0c;
}

.cam-image[hidden] {
    display: none !important;
}


/* =========================================================
   LOADING MESSAGE

   Actual JS class:
   .cam-loading
   ========================================================= */

.cam-loading {
    position: absolute;

    inset: 0;

    z-index: 3;

    display: flex;

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

    background: #080a0c;

    color: rgba(255, 255, 255, 0.80);

    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.cam-loading[hidden] {
    display: none !important;
}


/* =========================================================
   CAMERA BANNER

   Actual JS class:
   .cam-banner
   ========================================================= */

.cam-banner {
    position: absolute;

    top: 0;
    right: 0;
    left: 0;

    z-index: 5;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 12px;

    width: 100%;
    box-sizing: border-box;

    padding: 8px 12px;

    color: #ffffff;

    background: rgba(12, 17, 22, 0.82);

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}


/* =========================================================
   BANNER LEFT
   ========================================================= */

.cam-banner-left {
    min-width: 0;
}

.cam-banner-left strong {
    display: block;

    overflow: hidden;

    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.15;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.cam-banner-left span {
    display: block;

    margin-top: 3px;

    font-size: 0.67rem;

    color: rgba(255, 255, 255, 0.76);
}


/* =========================================================
   BANNER LOGO
   ========================================================= */

.cam-banner-logo {
    position: static !important;

    display: block !important;

    width: auto !important;
    height: 32px !important;

    max-width: 90px !important;
    max-height: 32px !important;

    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    transform: none !important;

    object-fit: contain !important;

    background: transparent !important;
}


/* =========================================================
   BANNER RIGHT
   ========================================================= */

.cam-banner-right {
    min-width: 0;

    text-align: right;
}

.cam-banner-right strong {
    display: block;

    overflow: hidden;

    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.cam-banner-right span {
    display: block;

    margin-top: 3px;

    font-size: 0.63rem;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;

    color: rgba(255, 255, 255, 0.78);
}


/* =========================================================
   EMPTY CAMERA TILE
   ========================================================= */

.cam-tile--empty {
    display: flex;

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

    min-height: 220px;

    background: #f5f6f7;

    border: 1px dashed #bbc2ca;
}

.cam-add {
    appearance: none;

    padding: 12px 18px;

    border: 1px solid #c7cdd4;
    border-radius: 8px;

    background: #ffffff;
    color: #343d47;

    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;

    cursor: pointer;
}

.cam-add:hover {
    background: #eceff2;
}


/* =========================================================
   MASTER TIMELINE
   ========================================================= */

.timeline-panel {
    width: min(1138px, 100%);
    box-sizing: border-box;

    margin: 18px auto 0;
    padding: 16px 18px;

    background: #ffffff;

    border: 1px solid #dfe3e8;
    border-radius: 10px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.timeline-panel[hidden] {
    display: none !important;
}

.timeline-meta {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 10px;
}

.timeline-meta strong {
    font-size: 0.95rem;
}

.timeline-meta span {
    color: #657080;

    font-size: 0.82rem;
}

.timeline {
    display: grid;

    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 12px;
}

.timeline span {
    color: #657080;

    font-size: 0.75rem;
}

.timeline input[type="range"] {
    width: 100%;
}


/* =========================================================
   DOWNLOAD PANEL
   ========================================================= */

.download-panel {
    display: flex;

    width: min(1138px, 100%);
    box-sizing: border-box;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin: 16px auto 0;
    padding: 16px 18px;

    background: #ffffff;

    border: 1px solid #dfe3e8;
    border-radius: 10px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.download-panel[hidden] {
    display: none !important;
}

.download-panel > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.download-panel > div:first-child span {
    color: #657080;

    font-size: 0.82rem;
}

.download-panel [data-downloads] {
    display: flex;

    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;

    gap: 8px;
}

.download-panel a {
    display: inline-flex;

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

    min-height: 36px;

    padding: 0 13px;

    border: 1px solid #cfd5dc;
    border-radius: 7px;

    background: #ffffff;
    color: #28313c;

    text-decoration: none;

    font-size: 0.84rem;
    font-weight: 600;
}

.download-panel a:hover {
    background: #f0f2f4;
}


/* =========================================================
   HIDDEN ELEMENTS
   ========================================================= */

[hidden] {
    display: none !important;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

    .cam-intro {
        align-items: flex-start;
        flex-direction: column;

        gap: 10px;
    }

    .cam-grid.layout-2x1,
    .cam-grid.layout-2x2 {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        max-width: 100%;
    }

    .cam-grid.layout-3x2,
    .cam-grid.layout-3x3 {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        max-width: 100%;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

    .cam-console {
        width: calc(100% - 22px);

        padding-top: 20px;
    }

    .cam-controls {
        align-items: stretch;

        flex-direction: column;

        gap: 14px;
    }

    .seg {
        width: 100%;
    }

    .seg button {
        flex: 1;

        padding-left: 8px;
        padding-right: 8px;

        font-size: 0.8rem;
    }

    .history {
        align-items: stretch;

        flex-direction: column !important;
    }

    .history label,
    .history input,
    .history select,
    .history button {
        width: 100%;
    }


    /* All camera layouts become one column */

    .cam-grid.layout-1x1,
    .cam-grid.layout-2x1,
    .cam-grid.layout-2x2,
    .cam-grid.layout-3x2,
    .cam-grid.layout-3x3 {
        grid-template-columns:
            minmax(0, 1fr);

        max-width: 100%;
    }


    /* Camera stage stays 16:9 */

    .cam-stage {
        width: 100%;

        aspect-ratio: 16 / 9;
    }


    /* Simplified mobile banner */

    .cam-banner {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);

        gap: 8px;

        padding: 7px 9px;
    }

    .cam-banner-logo {
        display: none !important;
    }

    .cam-banner-left strong {
        font-size: 0.75rem;
    }

    .cam-banner-left span {
        font-size: 0.62rem;
    }

    .cam-banner-right strong {
        font-size: 0.66rem;
    }

    .cam-banner-right span {
        font-size: 0.58rem;
    }


    /* Timeline */

    .timeline {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .timeline > span {
        display: none;
    }


    /* Downloads */

    .download-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .download-panel [data-downloads] {
        justify-content: flex-start;
    }
}