.page {
    position: relative;
    display: flex;
    flex-direction: row;
}

main {
    flex: 1;
}

.content {
    padding-top: 1.5rem;
}

#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;
}

/* ===== Sidebar (dark navy, matches design reference) ===== */

:root {
    --sb-bg: #0e1f2c;
    --sb-bg-active: #16303f;
    --sb-text: #b9c6ce;
    --sb-text-muted: #6f8794;
    --sb-accent: #2fd3d9;
    --sb-border: rgba(255, 255, 255, 0.08);
}

.sidebar {
    flex: 0 0 auto;
}

.sb-shell {
    background: var(--sb-bg);
    width: 240px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: width 0.15s ease;
    font-size: 0.9rem;
}

.sb-shell.sb-collapsed {
    width: 72px;
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1rem 0.75rem;
}

.sb-user-link {
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.sb-user-link:hover .sb-user-name {
    text-decoration: underline;
}

.sb-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1c3444;
    color: var(--sb-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1rem;
}

.sb-user-name {
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.sb-cta {
    margin: 0.25rem 1rem 1rem;
    background: var(--sb-accent);
    color: #04262a;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
}

.sb-cta:hover {
    filter: brightness(1.05);
    color: #04262a;
}

.sb-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 0.6rem;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--sb-text);
    text-decoration: none;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: inherit;
}

.sb-link i {
    font-size: 1.05rem;
    width: 1.2rem;
    text-align: center;
    flex: 0 0 auto;
}

.sb-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.sb-link.active {
    background: var(--sb-bg-active);
    color: #fff;
    font-weight: 600;
}

.sb-link .sb-chevron {
    margin-left: auto;
    transition: transform 0.15s ease;
    font-size: 0.8rem;
}

.sb-link .sb-chevron.sb-open {
    transform: rotate(180deg);
}

.sb-group-items {
    padding-left: 1.7rem;
}

.sb-group-items.sb-group-closed {
    display: none;
}

.sb-group-items .sb-link {
    font-size: 0.86rem;
}

.sb-footer {
    padding: 0.6rem;
    border-top: 1px solid var(--sb-border);
}

.sb-label {
    white-space: nowrap;
    overflow: hidden;
}

.sb-shell.sb-collapsed .sb-label,
.sb-shell.sb-collapsed .sb-user-name,
.sb-shell.sb-collapsed .sb-chevron,
.sb-shell.sb-collapsed .sb-group-items {
    display: none;
}

.sb-shell.sb-collapsed .sb-cta span {
    display: none;
}

.sb-lang-switch {
    display: flex;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem 0.6rem;
}

.sb-lang-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--sb-border);
    color: var(--sb-text-muted);
    border-radius: 8px;
    padding: 0.3rem 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.sb-lang-btn:hover {
    color: #fff;
}

.sb-lang-btn.sb-lang-active {
    background: var(--sb-bg-active);
    color: var(--sb-accent);
    border-color: var(--sb-accent);
}

.sb-shell.sb-collapsed .sb-lang-switch {
    flex-direction: column;
}

/* ===== Dashboard widgets ===== */

.dash-card {
    background: #fff;
    border: 1px solid #e6e9ec;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.dash-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1b2733;
}

.dash-card-icons {
    display: flex;
    gap: 0.6rem;
    color: #9aa5ad;
    font-size: 0.95rem;
}

.dash-card-body-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6b7680;
    padding: 1.5rem 0.5rem;
}

.dash-card-body-empty i {
    font-size: 2.2rem;
    color: var(--sb-accent);
    margin-bottom: 0.6rem;
}

.dash-card-footer {
    text-align: right;
    margin-top: 0.5rem;
}

.dash-card-footer a {
    color: var(--sb-accent);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.88rem;
}

.dash-card-footer a:hover {
    text-decoration: underline;
}

.dash-map-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.dashboard-map {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-map-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    position: relative;
}

.dashboard-map-container > div:first-child {
    width: 100% !important;
    height: 100% !important;
}

.dash-map-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 20, 28, 0.75);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    z-index: 20;
    font-size: 0.9rem;
}

.dash-map-footer .btn {
    background: var(--sb-accent);
    border: none;
    color: #04262a;
    font-weight: 600;
    padding: 0.3rem 1rem;
    border-radius: 8px;
}

.dash-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #eef1f3;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 0.5rem;
}

.dash-profile-name {
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dash-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.9rem;
    color: #4a555e;
}

.dash-stat-row:last-child {
    border-bottom: none;
}

.dash-stat-row strong {
    color: #1b2733;
}

.dash-widgets-fab {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    background: var(--sb-accent);
    color: #04262a;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

/* Hides Cesium's bottom bar (which also contains the terrain/imagery attribution/
   credits). This reverses an earlier deliberate choice to keep that attribution
   visible per Cesium Ion's terms of use — requested explicitly, matching the same
   rule already used inside the standalone FlyPath editor tool's own styling. */
.cesium-viewer-bottom {
    display: none;
}

/* ===== Mobile / portrait: sidebar becomes a fixed bottom icon bar ===== */

:root {
    --sb-mobile-bar-height: 60px;
}

@media (max-width: 767.98px), (orientation: portrait) {
    .sb-shell {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        height: var(--sb-mobile-bar-height);
        /* The desktop rule now uses a plain height: 100vh (needed for sticky
           positioning there), not min-height — this min/max-height pairing here is
           no longer strictly required to counteract it, but is kept as a
           self-contained safety net so this bottom bar's height is explicit and
           correct regardless of what the desktop rule does. */
        min-height: var(--sb-mobile-bar-height);
        max-height: var(--sb-mobile-bar-height);
        flex-direction: row;
        align-items: center;
        z-index: 1030;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    }

    /* Never show the collapsed (icon-shrunk desktop) width override on mobile —
       the bar is always full-width and always icon-only here regardless. */
    .sb-shell.sb-collapsed {
        width: 100%;
    }

    /* Name/avatar block and the collapse-sidebar toggle don't make sense in a
       bottom bar — collapsing isn't a concept here, and there's no room for a name. */
    .sb-user,
    .sb-footer .sb-collapse-toggle {
        display: none;
    }

    .sb-cta {
        flex: 0 0 auto;
        margin: 0 0.35rem;
        padding: 0.5rem;
        border-radius: 50%;
        width: 40px;
        height: 40px;
    }

    .sb-cta span {
        display: none;
    }

    .sb-nav {
        flex: 1 1 auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0.25rem;
        height: 100%;
    }

    /* Flatten the Assets/Manage accordion groups: always show their children
       inline as plain icons, ignoring the desktop expand/collapse state. */
    .sb-group-items,
    .sb-group-items.sb-group-closed {
        display: flex;
        flex-direction: row;
        padding-left: 0;
    }

    .sb-chevron {
        display: none;
    }

    /* The Assets/Manage group *toggle* buttons themselves aren't needed on mobile —
       their children are already flattened into view unconditionally via
       .sb-group-items above, so the toggle would just be a dead-end button. */
    .sb-group-toggle {
        display: none;
    }

    .sb-link {
        flex: 0 0 auto;
        width: 48px;
        height: 48px;
        min-width: 48px;
        padding: 0;
        margin: 0 0.15rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sb-link i {
        font-size: 1.2rem;
    }

    /* Icons only, as requested — labels stay in the DOM (for screen readers /
       desktop) but are visually hidden here. */
    .sb-label {
        display: none;
    }

    .sb-footer {
        flex: 0 0 auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        border-top: none;
        border-left: 1px solid var(--sb-border);
        padding: 0 0.4rem;
    }

    .sb-lang-switch {
        flex-direction: row;
        padding: 0;
        gap: 0.25rem;
    }

    .sb-lang-btn {
        padding: 0.3rem 0.45rem;
    }

    /* Reserve space at the bottom of the page content so the fixed bar never
       overlaps the last bit of scrollable content. */
    main {
        padding-bottom: var(--sb-mobile-bar-height);
    }

    .dash-widgets-fab {
        bottom: calc(var(--sb-mobile-bar-height) + 1rem);
    }
}

/* Light green low-risk highlight (SORA GRC tables) — matches the color applied
   directly by the user locally, mirrored here so packages stay in sync. */
/* Cancels .content's horizontal padding (Bootstrap's px-4, 1.5rem each side) for
   the FlyPath editor's iframe specifically — that padding is right for normal
   pages, but wastes space around a full-height embedded tool that wants every
   pixel it can get. */
.flypath-full-bleed {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

/* Mission status badges. .status-completed intentionally reuses the exact same
   green as .table-success (SORA GRC low-risk cells) for a consistent "good/done"
   color language across the app. */
.status-completed {
    background: #C1F2B1;
    color: #1b5e20;
}
.status-overdue {
    background: #FFB020;
    color: #5c3a00;
}
.status-active {
    background: #FBCFE8;
    color: #7a1f4b;
}
.status-cancelled {
    background: #E9ECEF;
    color: #495057;
}

/* Full-screen background video on the login page — a dark overlay keeps the login
   card readable regardless of what's happening in the footage behind it. */
.login-video-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: #0b1014;
}

.login-video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 16, 20, 0.55);
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.table-success {
    --bs-table-bg: #C1F2B1;
    --bs-table-color: #1b5e20;
    --bs-table-border-color: #c8e6c9;
}

/* Sticky title/back/Save band at the top of edit pages (Drone, Mission, ...) —
   stays visible while scrolling through a page's tabs/content below it. Below the
   mobile bottom nav bar's z-index (1030) and Bootstrap modals (1050+), above
   ordinary page content. */
.page-header-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e6e9ec;
}

/* Hides CKEditor 4's warning-style notification popups (e.g. "no title" nags). */
.cke_notification.cke_notification_warning {
    display: none !important;
}

/* Speech-balloon style popover for the ARC flowchart question "?" help text —
   overlays on top of the page (absolute positioning) rather than pushing
   content down inline, with a small triangular tail pointing back at the "?"
   icon that opened it. */
.help-balloon {
    position: absolute;
    z-index: 1050;
    top: 1.6rem;
    left: 0;
    width: 380px;
    max-width: min(90vw, 380px);
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    white-space: pre-line;
}

.help-balloon::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    left: 0.6rem;
    border-left: 0.5rem solid transparent;
    border-right: 0.5rem solid transparent;
    border-bottom: 0.5rem solid #ced4da;
}

.help-balloon::after {
    content: "";
    position: absolute;
    top: -0.44rem;
    left: 0.68rem;
    border-left: 0.42rem solid transparent;
    border-right: 0.42rem solid transparent;
    border-bottom: 0.44rem solid #fff;
}
