/* RESET */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #050814;
    --panel: rgba(8, 16, 34, 0.88);
    --panel-strong: rgba(10, 20, 42, 0.96);
    --panel-soft: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(110, 168, 255, 0.42);
    --text: #e8eefc;
    --muted: #9eaccf;
    --muted-2: #7f8db0;
    --accent: #6ea8ff;
    --accent-soft: rgba(110, 168, 255, 0.14);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

html,
body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(56, 100, 201, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 186, 104, 0.08), transparent 24%),
        var(--bg);
    color: var(--text);
}

body {
    overflow: hidden;
}

/* LAYOUT */
.app {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 18px;
    height: 100vh;
    padding: 18px;
}

/* SIDEBAR */
.sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, rgba(7, 14, 30, 0.96), rgba(5, 10, 24, 0.94));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eyebrow {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

.sidebar-header h1 {
    font-size: 30px;
    line-height: 1.04;
    letter-spacing: -0.02em;
}

.sidebar-text {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* SEARCH */
.search-wrap {
    position: relative;
}

.search-input,
#mission-search {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input::placeholder,
#mission-search::placeholder {
    color: var(--muted-2);
}

.search-input:focus,
#mission-search:focus {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.06);
}

/* FILTER */
.filter-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.filter-select,
#mission-filter {
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.filter-select:focus,
#mission-filter:focus {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.07);
}

.filter-select option,
#mission-filter option {
    color: #111827;
}

/* SUMMARY */
.summary-cards,
#mission-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.summary-card {
    background: linear-gradient(180deg, rgba(18, 30, 60, 0.8), rgba(10, 18, 38, 0.95));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 13px;
    min-width: 0;
}

.summary-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 6px;
}

.summary-card strong {
    display: block;
    font-size: 24px;
    line-height: 1;
}

/* MISSION LIST HEADER */
.mission-list-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
}

.mission-list-header h2 {
    font-size: 17px;
    line-height: 1.2;
}

.mission-count {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

/* MISSION LIST */
.mission-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.mission-item {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(15, 24, 45, 0.9), rgba(9, 15, 30, 0.96));
    color: var(--text);
    padding: 13px 14px;
    text-align: left;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mission-item:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, rgba(19, 31, 58, 0.96), rgba(10, 18, 34, 0.98));
}

.mission-item.is-active {
    border-color: var(--border-strong);
    background: linear-gradient(180deg, rgba(24, 46, 87, 0.95), rgba(12, 26, 52, 0.98));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.mission-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.mission-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mission-copy strong {
    font-size: 15px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mission-copy span {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MAIN */
.main {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(420px, 1.2fr) minmax(280px, 0.95fr);
    gap: 18px;
}

/* VIEWER */
.viewer-shell {
    position: relative;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.02), transparent 34%),
        #02050d;
    box-shadow: var(--shadow);
}

#cesiumContainer {
    width: 100%;
    height: 100%;
}

/* VIEWER HUD */
.viewer-hud {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.viewer-hud > * {
    pointer-events: auto;
}

.viewer-overlay {
    position: absolute;
    top: 18px;
    left: 18px;
    max-width: 420px;
    z-index: 3;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 10, 24, 0.62);
    backdrop-filter: blur(12px);
}

.viewer-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 8px;
}

.viewer-title {
    font-size: 28px;
    line-height: 1.06;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.viewer-subtitle {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.viewer-hud-topbar {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: min(58vw, 720px);
}

.viewer-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 10, 24, 0.72);
    backdrop-filter: blur(12px);
    color: var(--text);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.viewer-chip strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.viewer-chip span {
    color: var(--muted);
    font-size: 12px;
}

.viewer-chip--live::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #7ef0b8;
    box-shadow: 0 0 0 6px rgba(126, 240, 184, 0.14);
    flex: 0 0 auto;
}

.viewer-hud-panel {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: min(340px, calc(100% - 36px));
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 10, 24, 0.72);
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.viewer-hud-panel__eyebrow {
    display: inline-block;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 10px;
}

.viewer-hud-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.viewer-metric {
    min-width: 0;
    padding: 12px 13px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(17, 28, 56, 0.72), rgba(10, 18, 37, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.viewer-metric-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-2);
    margin-bottom: 6px;
    font-weight: 700;
}

.viewer-metric-value {
    display: block;
    font-size: 16px;
    line-height: 1.3;
    color: var(--text);
    font-weight: 700;
    word-break: break-word;
}

.viewer-legend {
    position: absolute;
    left: 18px;
    bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    z-index: 3;
}

.viewer-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(5, 10, 24, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    color: var(--text);
    font-size: 13px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.dot-earth {
    background: rgba(110, 168, 255, 0.55);
}

.dot-mission {
    background: #ffffff;
}

.dot-target {
    background: #ffd34d;
}

/* DETAILS */
.details-section {
    min-width: 0;
    min-height: 0;
}

.details-card {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(8, 16, 34, 0.92), rgba(5, 11, 24, 0.97));
    box-shadow: var(--shadow);
    padding: 22px;
    overflow: hidden;
}

.details-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.details-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 8px;
}

#detail-name,
.details-card__top h2 {
    font-size: 32px;
    line-height: 1.06;
    letter-spacing: -0.02em;
}

.focus-button {
    flex: 0 0 auto;
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, rgba(20, 44, 85, 0.94), rgba(12, 28, 58, 0.98));
    color: var(--text);
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.18s ease, border-color 0.18s ease;
}

.focus-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.focus-button:active {
    transform: translateY(0);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.detail-item {
    min-width: 0;
    background: linear-gradient(180deg, rgba(17, 28, 56, 0.78), rgba(10, 18, 37, 0.95));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px 18px;
}

.detail-label {
    display: block;
    font-size: 11px;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 9px;
    font-weight: 700;
}

.detail-value {
    display: block;
    font-size: 19px;
    line-height: 1.28;
    word-break: break-word;
}

.details-description {
    min-width: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.details-description h3 {
    font-size: 19px;
    margin-bottom: 8px;
}

.details-description p {
    color: var(--muted);
    line-height: 1.65;
    font-size: 15px;
}

.details-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.details-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid rgba(110, 168, 255, 0.24);
    background: rgba(110, 168, 255, 0.08);
    border-radius: 14px;
    padding: 11px 14px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.details-link:hover {
    background: rgba(110, 168, 255, 0.12);
    border-color: rgba(110, 168, 255, 0.38);
    transform: translateY(-1px);
}

/* SCROLLBAR */
.mission-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.mission-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.mission-list::-webkit-scrollbar-track {
    background: transparent;
}

/* CESIUM */
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom {
    display: none !important;
}

.cesium-viewer,
.cesium-widget,
.cesium-widget canvas {
    width: 100% !important;
    height: 100% !important;
}

.cesium-viewer,
.cesium-widget,
.cesium-widget canvas,
#cesiumContainer {
    border-radius: var(--radius-xl);
}

/* RESPONSIVE */
@media (max-width: 1320px) {
    .details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viewer-hud-topbar {
        max-width: 52vw;
    }
}

@media (max-width: 1180px) {
    .app {
        grid-template-columns: 300px minmax(0, 1fr);
    }

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

    #detail-name,
    .details-card__top h2 {
        font-size: 28px;
    }

    .viewer-hud-panel {
        width: min(300px, calc(100% - 36px));
    }
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .app {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        overflow: visible;
    }

    .mission-list {
        max-height: 360px;
    }

    .main {
        grid-template-rows: 420px auto;
    }

    .details-card__top {
        flex-direction: column;
        align-items: flex-start;
    }

    .details-grid {
        grid-template-columns: 1fr 1fr;
    }

    .viewer-hud-topbar {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
        justify-content: flex-start;
    }

    .viewer-overlay {
        top: 64px;
        left: 12px;
        right: 12px;
        max-width: none;
    }

    .viewer-hud-panel {
        right: 12px;
        bottom: 72px;
        width: min(340px, calc(100% - 24px));
    }

    .viewer-legend {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
}

@media (max-width: 680px) {
    .app {
        padding: 12px;
        gap: 12px;
    }

    .sidebar,
    .details-card,
    .viewer-shell {
        border-radius: 22px;
    }

    .viewer-overlay {
        top: 72px;
        left: 12px;
        right: 12px;
        max-width: none;
        padding: 14px 15px;
    }

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

    .viewer-subtitle {
        font-size: 13px;
    }

    .viewer-hud-topbar {
        gap: 8px;
    }

    .viewer-chip {
        min-height: 38px;
        padding: 9px 12px;
        font-size: 12px;
    }

    .viewer-chip strong {
        font-size: 12px;
    }

    .viewer-chip span {
        font-size: 11px;
    }

    .viewer-hud-panel {
        position: absolute;
        left: 12px;
        right: 12px;
        bottom: 64px;
        width: auto;
        padding: 14px;
    }

    .viewer-hud-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .viewer-legend {
        left: 12px;
        right: 12px;
        bottom: 12px;
        gap: 8px;
    }

    .viewer-legend span {
        font-size: 12px;
        padding: 9px 11px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    #detail-name,
    .details-card__top h2 {
        font-size: 24px;
    }

    .focus-button,
    .details-link {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .summary-cards,
    #mission-summary,
    .viewer-hud-metrics {
        grid-template-columns: 1fr;
    }

    .viewer-hud-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .viewer-chip {
        justify-content: flex-start;
    }

    .viewer-overlay {
        top: 110px;
    }
    /* INFO CHIPS (statt rechter Tafel) */
.info-chips {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: min(90vw, 420px);
    z-index: 20;
}

/* einzelner Chip */
.chip {
    background: rgba(10, 20, 40, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(110, 168, 255, 0.25);
    color: #e8eefc;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.3;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    white-space: nowrap;
}

/* Titel im Chip */
.chip span {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #7f8db0;
    margin-bottom: 2px;
}

/* wichtige Werte */
.chip strong {
    font-size: 14px;
    color: #ffffff;
}

/* Status farbig */
.chip.status-active {
    border-color: rgba(80, 220, 160, 0.5);
}

/* MOBILE OPTIMIERUNG */
@media (max-width: 768px) {
    .info-chips {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        justify-content: flex-end;
    }

    .chip {
        font-size: 12px;
        padding: 8px 10px;
    }
}