/* =========================================================
   SATAID Web
   THAI Satellite Viewer v0.1.3 — TMD Identity

   Design
   ---------------------------------------------------------
   - TMD identity in header
   - Two-tone institutional shell
   - High contrast typography
   - Compact sidebar / maximum data area
   - Dark operational viewer
   - Large-display readability
   - Maximum-contain presentation
========================================================= */

:root {
    --header-height: 88px;

    --header-bg: #08283f;
    --header-bg-mid: #0b3552;
    --header-bg-soft: #124765;
    --header-border: #2d5b74;

    --header-text: #ffffff;
    --header-text-secondary: #e4f0f6;

    --shell-bg: #e9f1f6;
    --shell-panel: #f5f9fb;
    --shell-panel-strong: #ffffff;
    --shell-border: #bfd0dc;
    --shell-border-strong: #9cb3c3;

    --shell-text: #102a43;
    --shell-text-secondary: #334e68;
    --shell-text-muted: #536d80;

    --accent: #0878b9;
    --accent-hover: #06669f;
    --accent-soft: #d7ecf8;
    --accent-border: #5a9ec7;

    --tmd-gold: #f0c63f;
    --tmd-green: #149b4d;

    --viewer-bg: #030910;
    --viewer-panel: #091724;
    --viewer-panel-soft: #102337;
    --viewer-border: #2a4054;

    --viewer-text: #ffffff;
    --viewer-text-secondary: #d5e2eb;

    --latest-bg: #e3f5e9;
    --latest-border: #5da675;
    --latest-text: #14582d;

    --history-bg: #fff0d0;
    --history-border: #be841c;
    --history-text: #6b4300;

    --shadow: 0 7px 24px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;
    background: var(--shell-bg);
    color: var(--shell-text);

    font-family:
        "Segoe UI",
        "Noto Sans Thai",
        Tahoma,
        Arial,
        sans-serif;

    font-size: 16px;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
select,
input {
    font: inherit;
}

/* =========================================================
   HEADER / TMD IDENTITY
========================================================= */

.top-header {
    height: var(--header-height);

    display: flex;
    align-items: stretch;

    gap: 10px;

    padding: 0 16px;

    background:
        linear-gradient(
            100deg,
            var(--header-bg) 0%,
            var(--header-bg-mid) 62%,
            var(--header-bg-soft) 100%
        );

    border-bottom: 3px solid var(--tmd-gold);

    position: relative;
    z-index: 30;
}

.brand-area {
    min-width: 256px;
    max-width: 276px;

    flex: 0 0 auto;

    display: flex;
    align-items: center;

    gap: 10px;

    min-height: 0;
}

.brand-logo {
    width: 62px;
    height: 62px;

    flex: 0 0 auto;

    object-fit: contain;

    filter:
        drop-shadow(
            0 2px 3px rgba(0, 0, 0, 0.24)
        );
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    color: var(--header-text);

    font-size: 28px;
    line-height: 1.05;

    font-weight: 800;

    letter-spacing: 0.1px;

    white-space: nowrap;
}

.brand-subtitle {
    margin-top: 5px;

    color: var(--header-text-secondary);

    font-size: 12.5px;
    line-height: 1.25;

    font-weight: 650;

    white-space: normal;
}

/* =========================================================
   MAIN NAVIGATION
========================================================= */

.main-navigation {
    min-width: 0;

    flex: 1 1 auto;

    display: flex;
    align-items: stretch;

    overflow: hidden;
}

.nav-link {
    min-width: 0;

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

    padding: 0 15px;

    color: #ffffff;

    text-decoration: none;
    white-space: nowrap;

    font-size: 17px;
    line-height: 1.2;

    font-weight: 700;

    border-bottom: 5px solid transparent;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.11);
}

.nav-link.active {
    color: #ffffff;

    background: rgba(255, 255, 255, 0.15);

    border-bottom-color: #74d2ff;

    font-weight: 800;
}

/* =========================================================
   WORKSPACE
========================================================= */

.workspace {
    height:
        calc(
            100vh
            -
            var(--header-height)
        );

    display: grid;

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

    overflow: hidden;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    min-width: 0;

    background:
        linear-gradient(
            180deg,
            #e1edf4 0%,
            #eef5f8 55%,
            #f4f8fa 100%
        );

    border-right: 1px solid var(--shell-border);

    padding: 14px 10px;

    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    margin-bottom: 17px;
}

.sidebar-heading {
    margin-bottom: 7px;

    color: #35546b;

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

    font-weight: 800;

    letter-spacing: 0.5px;

    text-transform: uppercase;
}

/* =========================================================
   REGION
========================================================= */

.region-card {
    padding: 11px 11px;

    background: rgba(255, 255, 255, 0.9);

    border: 1px solid var(--shell-border);
    border-radius: 7px;
}

.region-name {
    color: #102a43;

    font-size: 18px;
    line-height: 1.25;

    font-weight: 800;
}

.region-en {
    margin-top: 3px;

    color: #405c72;

    font-size: 13px;
    line-height: 1.3;

    font-weight: 650;
}

/* =========================================================
   PRODUCT LIST
========================================================= */

.product-list {
    display: flex;
    flex-direction: column;

    gap: 4px;
}

.product-button {
    width: 100%;

    min-height: 44px;

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

    gap: 7px;

    padding: 8px 10px;

    color: #19344a;

    background: transparent;

    border: 1px solid transparent;
    border-radius: 7px;

    cursor: pointer;

    text-align: left;

    font-size: 17px;
    line-height: 1.25;

    font-weight: 680;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.product-button:hover {
    color: #0d263a;

    background: rgba(255, 255, 255, 0.88);

    border-color: #b4c8d7;
}

.product-button.active {
    color: #092a43;

    background: #d4eaf8;

    border-color: var(--accent-border);

    font-weight: 800;
}

.product-button-name {
    min-width: 0;

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

.product-button-indicator {
    width: 9px;
    height: 9px;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #71899b;
}

.product-button.active
.product-button-indicator {
    background: #0573b4;
}

.sidebar-loading {
    padding: 8px;

    color: #334e68;

    font-size: 14px;
    font-weight: 650;
}

/* =========================================================
   ACTIVE PRODUCT
========================================================= */

.active-product-card {
    padding: 11px;

    background: rgba(255, 255, 255, 0.9);

    border: 1px solid var(--shell-border);
    border-radius: 7px;
}

.active-product-name {
    color: #102a43;

    font-size: 19px;
    line-height: 1.25;

    font-weight: 800;
}

.active-product-full-name {
    margin-top: 4px;

    color: #405c72;

    font-size: 13px;
    line-height: 1.35;

    font-weight: 650;
}

/* =========================================================
   VIEWER
========================================================= */

.viewer {
    min-width: 0;
    min-height: 0;

    display: grid;

    grid-template-rows:
        auto
        minmax(0, 1fr)
        38px;

    background: var(--viewer-bg);

    overflow: hidden;
}

/* =========================================================
   VIEWER TOOLBAR
========================================================= */

.viewer-toolbar {
    min-height: 78px;

    display: grid;

    grid-template-columns:
        minmax(290px, 1.25fr)
        auto
        minmax(390px, 1fr);

    align-items: center;

    gap: 11px;

    padding: 9px 13px;

    background:
        linear-gradient(
            90deg,
            #f8fbfd 0%,
            #eaf2f7 100%
        );

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

.product-information {
    min-width: 0;
}

.product-title-row {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 0;
}

.product-title {
    margin: 0;

    min-width: 0;

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

    color: #0d2a40;

    font-size: 24px;
    line-height: 1.15;

    font-weight: 800;
}

.latest-status {
    display: inline-flex;
    align-items: center;

    flex: 0 0 auto;

    padding: 5px 10px;

    color: var(--latest-text);

    background: var(--latest-bg);

    border: 1px solid var(--latest-border);
    border-radius: 999px;

    font-size: 13px;
    line-height: 1.2;

    font-weight: 800;
}

.latest-status.not-latest {
    color: var(--history-text);

    background: var(--history-bg);

    border-color: var(--history-border);
}

.time-information {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;

    margin-top: 6px;

    color: #173b55;

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

    font-weight: 700;
}

.time-information > * {
    color: #173b55;
}

.time-separator {
    color: #637f93;
}

/* =========================================================
   MODE SELECTOR
========================================================= */

.mode-selector {
    display: inline-flex;

    padding: 3px;

    background: #dce6ee;

    border: 1px solid #aebfcd;
    border-radius: 8px;
}

.mode-button {
    min-height: 41px;

    padding: 8px 15px;

    color: #16364f;

    background: transparent;

    border: 0;
    border-radius: 6px;

    cursor: pointer;

    white-space: nowrap;

    font-size: 15px;
    font-weight: 720;
}

.mode-button:hover {
    color: #102a43;
    background: #ffffff;
}

.mode-button.active {
    color: #ffffff;

    background: var(--accent);

    font-weight: 800;
}

.mode-button.active:hover {
    color: #ffffff;
    background: var(--accent-hover);
}

/* =========================================================
   VIEWER TOOLS
========================================================= */

.viewer-tools {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    flex-wrap: wrap;

    gap: 6px;
}

.tool-button {
    min-height: 40px;

    padding: 7px 10px;

    color: #16354d;

    background: #f8fafc;

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

    cursor: pointer;

    white-space: nowrap;

    font-size: 14px;
    line-height: 1.2;

    font-weight: 700;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.tool-button:hover:not(:disabled) {
    color: #071f33;

    background: #ffffff;

    border-color: #718ca1;
}

.tool-button:disabled {
    opacity: 0.46;
    cursor: default;
}

.primary-button {
    color: #ffffff;

    background: var(--accent);

    border-color: #075f95;

    font-weight: 800;
}

.primary-button:hover:not(:disabled) {
    color: #ffffff;

    background: var(--accent-hover);

    border-color: #064e7b;
}

/* =========================================================
   MEDIA STAGE
========================================================= */

.media-stage {
    min-width: 0;
    min-height: 0;

    position: relative;

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

    overflow: hidden;

    padding: 5px;

    background:
        radial-gradient(
            circle at center,
            #0a1b2b 0%,
            #030910 72%
        );
}

.frame-container,
.animation-container {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

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

    overflow: hidden;
}

.satellite-image,
.satellite-video {
    display: block;

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

    width: auto;
    height: auto;

    object-fit: contain;

    background: #000000;

    box-shadow: var(--shadow);
}

.satellite-video {
    outline: none;
}

/* =========================================================
   LOADING / NO DATA
========================================================= */

.loading-message,
.no-data-message {
    position: absolute;

    z-index: 10;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    max-width: min(90%, 520px);

    padding: 13px 18px;

    color: #ffffff;

    background: rgba(5, 16, 27, 0.95);

    border: 1px solid #607a90;
    border-radius: 8px;

    box-shadow: var(--shadow);

    font-size: 15px;
    line-height: 1.35;

    font-weight: 700;

    text-align: center;
}

.no-data-message {
    color: #ffffff;

    background: rgba(91, 54, 0, 0.97);

    border-color: #c99238;
}

/* =========================================================
   BOTTOM PANEL
========================================================= */

.bottom-panel {
    min-width: 0;

    height: 38px;

    display: grid;
    align-items: center;

    padding: 0 12px;

    color: var(--viewer-text);

    background:
        linear-gradient(
            90deg,
            #081522 0%,
            #102235 100%
        );

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

.frame-bottom-panel {
    grid-template-columns:
        46px
        minmax(0, 1fr)
        72px;

    gap: 8px;
}

.timeline-label {
    color: #d8e5ee;

    font-size: 12px;
    font-weight: 800;
}

.time-slider {
    width: 100%;

    min-width: 0;

    cursor: pointer;
}

.frame-counter {
    text-align: right;

    color: #ffffff;

    font-size: 13px;
    font-weight: 700;
}

.animation-bottom-panel {
    grid-template-columns:
        auto
        minmax(270px, 470px)
        90px;

    justify-content: center;

    gap: 12px;
}

.animation-label {
    color: #d8e5ee;

    font-size: 12px;
    font-weight: 800;

    text-transform: uppercase;
}

.animation-select {
    width: 100%;

    min-width: 0;

    padding: 5px 9px;

    color: #ffffff;

    background: #162c40;

    border: 1px solid #60788d;
    border-radius: 5px;

    font-size: 13px;
    font-weight: 650;
}

.animation-size {
    color: #ffffff;

    font-size: 13px;

    font-weight: 700;

    text-align: right;
}

/* =========================================================
   PRESENTATION
========================================================= */

.presentation-overlay {
    position: fixed;

    z-index: 2000;

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

    min-height: 52px;

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

    gap: 18px;

    padding: 5px 10px;

    color: #ffffff;

    background:
        linear-gradient(
            180deg,
            rgba(2, 8, 15, 0.98),
            rgba(4, 15, 25, 0.90)
        );

    border-bottom:
        1px solid rgba(255, 255, 255, 0.20);
}

.presentation-left {
    min-width: 0;
}

.presentation-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #ffffff;

    font-size: 25px;
    line-height: 1.1;

    font-weight: 800;
}

.presentation-time {
    margin-top: 2px;

    color: #ffffff;

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

    font-weight: 650;
}

.presentation-actions {
    display: flex;
    align-items: center;

    flex: 0 0 auto;

    gap: 6px;
}

.presentation-button {
    min-height: 38px;

    padding: 6px 11px;

    color: #ffffff;

    background: #24435d;

    border: 1px solid #7a91a5;
    border-radius: 5px;

    cursor: pointer;

    font-size: 14px;
    font-weight: 700;
}

.presentation-button:hover {
    color: #ffffff;
    background: #325979;
}

.exit-button {
    background: #44505c;
    border-color: #8b9aa7;
}

body.presentation-mode {
    overflow: hidden;
    background: #000000;
}

body.presentation-mode
.top-header,

body.presentation-mode
.sidebar,

body.presentation-mode
.viewer-toolbar,

body.presentation-mode
.bottom-panel {
    display: none !important;
}

body.presentation-mode
.workspace {
    display: block;

    width: 100vw;
    height: 100vh;
}

body.presentation-mode
.viewer {
    width: 100vw;
    height: 100vh;

    display: block;

    background: #000000;
}

body.presentation-mode
.media-stage {
    width: 100vw;
    height: 100vh;

    padding: 53px 0 0;

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

    background: #000000;
}

body.presentation-mode
.frame-container,

body.presentation-mode
.animation-container {
    width: 100%;
    height: 100%;

    min-width: 0;
    min-height: 0;

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

    background: #000000;
}

body.presentation-mode
.satellite-image,

body.presentation-mode
.satellite-video {
    width: 100%;
    height: 100%;

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

    object-fit: contain;

    background: #000000;

    box-shadow: none;
}

body.presentation-mode
.presentation-overlay {
    display: flex;
}

:fullscreen {
    background: #000000;
}

.hidden {
    display: none !important;
}

/* =========================================================
   STANDARD DESKTOP
========================================================= */

@media (max-width: 1550px) {

    .top-header {
        padding-left: 12px;
        padding-right: 12px;

        gap: 8px;
    }

    .brand-area {
        min-width: 235px;
        max-width: 245px;

        gap: 8px;
    }

    .brand-logo {
        width: 56px;
        height: 56px;
    }

    .brand-title {
        font-size: 25px;
    }

    .brand-subtitle {
        font-size: 11.5px;
    }

    .nav-link {
        padding-left: 11px;
        padding-right: 11px;

        font-size: 15px;
    }

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

    .viewer-toolbar {
        grid-template-columns:
            minmax(255px, 1.2fr)
            auto
            minmax(360px, 1fr);

        gap: 9px;
    }

    .product-title {
        font-size: 22px;
    }

    .time-information {
        font-size: 15px;
    }

    .tool-button {
        padding-left: 9px;
        padding-right: 9px;

        font-size: 13px;
    }
}

/* =========================================================
   MEDIUM DESKTOP
========================================================= */

@media (max-width: 1280px) {

    :root {
        --header-height: 82px;
    }

    .brand-area {
        min-width: 205px;
        max-width: 215px;
    }

    .brand-logo {
        width: 50px;
        height: 50px;
    }

    .brand-title {
        font-size: 22px;
    }

    .brand-subtitle {
        display: none;
    }

    .main-navigation {
        overflow-x: auto;
    }

    .nav-link {
        padding-left: 9px;
        padding-right: 9px;

        font-size: 14px;
    }

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

    .sidebar {
        padding-left: 8px;
        padding-right: 8px;
    }

    .product-button {
        font-size: 16px;
    }

    .viewer-toolbar {
        grid-template-columns:
            minmax(180px, 1fr)
            auto;

        grid-template-areas:
            "product mode"
            "tools tools";

        gap: 8px;
    }

    .product-information {
        grid-area: product;
    }

    .mode-selector {
        grid-area: mode;

        justify-self: end;
    }

    .viewer-tools {
        grid-area: tools;

        justify-content: flex-start;
    }
}

/* =========================================================
   SMALL DESKTOP / TABLET
========================================================= */

@media (max-width: 1020px) {

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

    .product-button {
        min-height: 43px;

        font-size: 15px;
    }

    .nav-link {
        font-size: 13px;
    }
}

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

@media (max-width: 820px) {

    body {
        overflow: auto;
    }

    .top-header {
        height: auto;

        min-height: 88px;

        align-items: flex-start;

        padding:
            9px
            10px
            0;

        flex-direction: column;

        gap: 5px;
    }

    .brand-area {
        min-width: 0;
        max-width: none;
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }

    .brand-title {
        font-size: 24px;
    }

    .brand-subtitle {
        display: block;

        font-size: 11px;
    }

    .main-navigation {
        width: 100%;
        height: 46px;
    }

    .nav-link {
        min-height: 44px;

        padding: 0 11px;

        font-size: 14px;
    }

    .workspace {
        height: auto;

        min-height:
            calc(100vh - 134px);

        display: block;

        overflow: visible;
    }

    .sidebar {
        display: none;
    }

    .viewer {
        min-height:
            calc(100vh - 134px);

        grid-template-rows:
            auto
            minmax(450px, 1fr)
            40px;
    }

    .viewer-toolbar {
        grid-template-columns: 1fr;

        grid-template-areas:
            "product"
            "mode"
            "tools";

        align-items: stretch;
    }

    .product-title {
        font-size: 20px;
    }

    .time-information {
        font-size: 14px;
    }

    .mode-selector {
        justify-self: start;
    }

    .viewer-tools {
        overflow-x: auto;

        flex-wrap: nowrap;

        padding-bottom: 2px;
    }

    .tool-button {
        min-height: 42px;

        font-size: 14px;
    }

    .animation-bottom-panel {
        grid-template-columns:
            auto
            minmax(0, 1fr)
            auto;

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

/* =========================================================
   SHORT HEIGHT
========================================================= */

@media (max-height: 800px) and (min-width: 821px) {

    :root {
        --header-height: 78px;
    }

    .brand-logo {
        width: 50px;
        height: 50px;
    }

    .brand-title {
        font-size: 24px;
    }

    .sidebar {
        padding-top: 9px;
    }

    .sidebar-section {
        margin-bottom: 13px;
    }

    .viewer-toolbar {
        min-height: 68px;

        padding-top: 6px;
        padding-bottom: 6px;
    }

    .media-stage {
        padding: 4px;
    }

    .product-title {
        font-size: 21px;
    }

    .time-information {
        margin-top: 4px;
    }
}

/* =========================================================
   LARGE DISPLAY
========================================================= */

@media (min-width: 1800px) {

    :root {
        --header-height: 96px;
    }

    .top-header {
        padding-left: 20px;
        padding-right: 20px;
    }

    .brand-area {
        min-width: 292px;
        max-width: 310px;
    }

    .brand-logo {
        width: 70px;
        height: 70px;
    }

    .brand-title {
        font-size: 31px;
    }

    .brand-subtitle {
        font-size: 14px;
    }

    .nav-link {
        padding-left: 19px;
        padding-right: 19px;

        font-size: 18px;
    }

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

    .sidebar-heading {
        font-size: 13px;
    }

    .region-name {
        font-size: 19px;
    }

    .product-button {
        min-height: 48px;

        font-size: 18px;
    }

    .active-product-name {
        font-size: 21px;
    }

    .product-title {
        font-size: 27px;
    }

    .time-information {
        font-size: 17px;
    }

    .tool-button,
    .mode-button {
        font-size: 16px;
    }

    .tool-button {
        min-height: 43px;
    }

    body.presentation-mode
    .presentation-overlay {
        min-height: 60px;
    }

    body.presentation-mode
    .presentation-title {
        font-size: 31px;
    }

    body.presentation-mode
    .presentation-time {
        font-size: 19px;
    }

    body.presentation-mode
    .presentation-button {
        min-height: 44px;

        font-size: 16px;
    }

    body.presentation-mode
    .media-stage {
        padding-top: 61px;
    }
}


/* =========================================================
   SATAID WEB - DESKTOP TYPOGRAPHY POLISH
   Design direction: Operational / Presentation Style
   Applies to standard desktop only.
========================================================= */

@media (min-width: 1350px) and (max-width: 1799px) {

    /* Brand */
    .brand-area {
        min-width: 270px;
        max-width: 285px;
        gap: 10px;
    }

    .brand-logo {
        width: 60px;
        height: 60px;
    }

    .brand-title {
        font-size: 28px;
        line-height: 1.05;
        font-weight: 800;
    }

    .brand-subtitle {
        margin-top: 5px;
        font-size: 13px;
        line-height: 1.25;
        font-weight: 650;
    }

    /* Main menu */
    .nav-link {
        padding-left: 14px;
        padding-right: 14px;

        font-size: 17px;
        line-height: 1.2;
        font-weight: 700;
    }

    .nav-link.active {
        font-weight: 800;
    }

    /* Viewer information */
    .product-title {
        font-size: 24px;
        line-height: 1.15;
        font-weight: 800;
    }

    .time-information {
        font-size: 16px;
        line-height: 1.35;
    }
}

/* =========================================================
   PRESENTATION SAFE AREA
   Prevent title/time clipping in fullscreen/presentation
========================================================= */

body.presentation-mode
.presentation-overlay {
    min-height: 64px;

    padding-top: 10px;
    padding-bottom: 7px;

    box-sizing: border-box;
}

body.presentation-mode
.presentation-left {
    padding-top: 1px;
    padding-bottom: 1px;
}

body.presentation-mode
.presentation-title {
    line-height: 1.15;
}

body.presentation-mode
.presentation-time {
    line-height: 1.25;
}

body.presentation-mode
.media-stage {
    padding-top: 66px;
}


/* Large display */
@media (min-width: 1800px) {

    body.presentation-mode
    .presentation-overlay {
        min-height: 72px;

        padding-top: 11px;
        padding-bottom: 8px;
    }

    body.presentation-mode
    .media-stage {
        padding-top: 74px;
    }

}

/* =========================================================
   PRESENTATION SAFE AREA
   Prevent title/time clipping in fullscreen/presentation
========================================================= */

body.presentation-mode
.presentation-overlay {
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 7px;
    box-sizing: border-box;
}

body.presentation-mode
.presentation-left {
    padding-top: 1px;
    padding-bottom: 1px;
}

body.presentation-mode
.presentation-title {
    line-height: 1.15;
}

body.presentation-mode
.presentation-time {
    line-height: 1.25;
}

body.presentation-mode
.media-stage {
    padding-top: 66px;
}

@media (min-width: 1800px) {

    body.presentation-mode
    .presentation-overlay {
        min-height: 72px;
        padding-top: 11px;
        padding-bottom: 8px;
    }

    body.presentation-mode
    .media-stage {
        padding-top: 74px;
    }
}


/* =========================================================
   SATAID WEB - MAIN OPERATIONAL TASKS
========================================================= */

.main-task-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;

    margin-bottom: 14px;
}

.main-task-item {
    width: 100%;
    min-height: 42px;

    display: flex;
    align-items: center;

    padding: 6px 10px;

    color: #102b1a;
    background: #e5f6e8;

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

    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;

    text-decoration: none;

    box-sizing: border-box;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.main-task-item:hover {
    color: #102b1a;
    background: #d5efd9;
    border-color: #8bc69a;
}

.main-task-item.active {
    color: #102b1a;
    background: #bfe8c6;

    border-color: #72b984;

    box-shadow:
        inset 4px 0 0 #27844b,
        0 1px 2px rgba(20, 70, 38, 0.14);

    padding-left: 12px;
}

.main-task-item:focus-visible {
    outline: 2px solid #27844b;
    outline-offset: 2px;
}

@media (max-width: 1020px) {

    .main-task-item {
        min-height: 39px;
        padding: 5px 8px;

        font-size: 14px;
    }

    .main-task-item.active {
        padding-left: 10px;
    }
}


/* =========================================================
   REGION SELECTOR
========================================================= */

.region-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.region-option {
    min-height: 42px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 7px 9px;

    color: #19344a;
    background: rgba(255, 255, 255, 0.82);

    border: 1px solid var(--shell-border);
    border-radius: 6px;

    text-decoration: none;

    box-sizing: border-box;
}

.region-option:hover {
    color: #102b1a;
    background: #eef8f0;
    border-color: #9bc9a6;
}

.region-option.active {
    color: #102b1a;
    background: #dff3df;

    border-color: #78b987;

    box-shadow:
        inset 3px 0 0 #2f8f46;
}

.region-option-indicator {
    width: 9px;
    height: 9px;

    flex: 0 0 auto;

    border-radius: 50%;

    border: 1px solid #6f8798;
    background: transparent;
}

.region-option.active
.region-option-indicator {
    border-color: #2f8f46;
    background: #2f8f46;
}

.region-option-text {
    min-width: 0;

    display: flex;
    flex-direction: column;

    line-height: 1.15;
}

.region-option-text strong {
    font-size: 14px;
    font-weight: 800;
}

.region-option-text small {
    margin-top: 2px;

    color: #607586;

    font-size: 11px;
    font-weight: 650;
}

.region-option.active
.region-option-text small {
    color: #405d48;
}

@media (max-width: 1020px) {

    .region-option {
        min-height: 39px;
        padding: 6px 7px;
    }

    .region-option-text strong {
        font-size: 13px;
    }

    .region-option-text small {
        font-size: 10px;
    }
}


/* =========================================================
   SATELLITE PRODUCT REFERENCE
   Product legend + source / product credit
   Located below the operational viewer
========================================================= */

.satellite-product-reference {
    grid-column: 2;

    width: 100%;

    padding: 18px 24px 22px;

    color: #23384b;
    background: #f5f8fa;

    border-top: 1px solid #cbd5df;
}

.product-legend {
    width: 100%;

    margin: 0 auto 18px;

    padding: 14px 18px;

    background: #ffffff;

    border: 1px solid #d6dee6;
    border-radius: 7px;
}

.product-reference-heading {
    margin-bottom: 10px;

    color: #173653;

    font-size: 15px;
    font-weight: 800;

    text-align: center;
}

.product-legend-images {
    display: flex;

    flex-direction: column;

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

    gap: 7px;
}

.product-legend-images img {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;

    object-fit: contain;
}

.satellite-data-credit {
    display: flex;

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

    flex-wrap: wrap;

    gap: 12px 42px;

    padding: 12px 18px;

    background: #edf3f7;

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

    text-align: center;
}

.credit-block {
    display: flex;

    flex-direction: column;

    gap: 3px;

    color: #536779;

    font-size: 12px;
    line-height: 1.4;
}

.credit-block strong {
    color: #203b53;

    font-size: 12px;
    font-weight: 800;
}


/* Keep reference information out of Presentation mode */
body.presentation-mode
.satellite-product-reference {
    display: none !important;
}


@media (max-width: 900px) {

    .satellite-product-reference {
        grid-column: 1 / -1;

        padding:
            14px 12px 18px;
    }

    .satellite-data-credit {
        flex-direction: column;

        align-items: center;

        gap: 9px;
    }
}


/* =========================================================
   SATELLITE REFERENCE - BELOW VIEWPORT LAYOUT
   Keep operational viewer full-height.
   Legend / credit begins below the first screen.
========================================================= */

body:not(.presentation-mode) {
    height: auto;
    min-height: 100%;

    overflow-x: hidden;
    overflow-y: auto;
}


body:not(.presentation-mode) .workspace {
    height: auto;
    min-height:
        calc(
            100vh
            -
            var(--header-height)
        );

    grid-template-rows:
        calc(
            100vh
            -
            var(--header-height)
        )
        auto;

    overflow: visible;
}


body:not(.presentation-mode) .sidebar {
    grid-column: 1;
    grid-row: 1;

    height:
        calc(
            100vh
            -
            var(--header-height)
        );

    overflow-y: auto;
    overflow-x: hidden;
}


body:not(.presentation-mode) .viewer {
    grid-column: 2;
    grid-row: 1;

    height:
        calc(
            100vh
            -
            var(--header-height)
        );
}


body:not(.presentation-mode)
.satellite-product-reference {
    grid-column: 2;
    grid-row: 2;
}

/* =========================================================
   THAILAND SATELLITE LEGEND - VISUAL POLISH
========================================================= */

.product-reference-heading {
    margin-bottom: 8px;

    font-size: 16px;
    line-height: 1.35;
}

.product-reference-heading br + * {
    font-weight: 700;
}

.product-legend {
    padding: 10px 18px 12px;
}

.product-legend-images img {
    max-width: min(100%, 560px);
}

/* IR Enhanced cloud-top-temperature scale */
.product-legend-images img[src*="thai-ir-enhanced"] {
    width: min(560px, 100%);
    height: auto;
}

