html, body, #app, .app-shell {
    height: 100%;
    margin: 0;
    background: #05070d;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.app-shell {
    display: flex;
    flex-direction: column;
}

/* --- Top nav --- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    flex-shrink: 0;
    padding: 0 20px;
    background: rgba(8, 12, 22, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(74, 222, 128, 0.2);
    position: relative;
    z-index: 2000;
}

.top-nav-brand {
    color: #4ade80;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    text-decoration: none;
}

.top-nav-links {
    display: flex;
    gap: 4px;
}

.top-nav-links a {
    color: #9db8ab;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.top-nav-links a:hover {
    color: #e2f5e8;
    background: rgba(74, 222, 128, 0.08);
}

.top-nav-links a.active {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.14);
}

.app-body {
    flex: 1;
    min-height: 0; /* let this flex child scroll/size correctly instead of overflowing the viewport */
    position: relative;
}

/* --- Status bar (VS Code style) --- */
.status-bar {
    flex-shrink: 0;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: #4ade80;
    color: #05070d;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    position: relative;
    z-index: 1500;
    -webkit-user-select: none;
    user-select: none;
}

.status-bar-left,
.status-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.status-bar-brand {
    font-weight: 800;
}

.status-bar-sep {
    opacity: 0.5;
}

.status-bar-item {
    opacity: 0.9;
}

.stack-badge {
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.stack-badge:hover {
    background: rgba(5, 7, 13, 0.15);
}

.status-bar-clock {
    font-variant-numeric: tabular-nums;
    min-width: 150px;
    text-align: right;
}

/* --- Tech stack card --- */
.stack-card {
    position: fixed;
    bottom: 34px;
    right: 14px;
    z-index: 1600;
    width: 300px;
    background: rgba(8, 12, 22, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    padding: 16px 18px;
    animation: stack-card-in 0.15s ease-out;
}

@keyframes stack-card-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stack-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stack-card-header h3 {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4ade80;
}

.stack-card-close {
    background: none;
    border: none;
    color: #9db8ab;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}

.stack-card-close:hover {
    color: #e2f5e8;
}

.stack-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.78rem;
    color: #cfe8d8;
    line-height: 1.6;
}

.stack-list li {
    padding: 4px 0;
    border-top: 1px solid rgba(74, 222, 128, 0.1);
}

.stack-list li:first-child {
    border-top: none;
}

.stack-cat {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4ade80;
    opacity: 0.8;
    margin-bottom: 2px;
}

.tracker-page {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

#iss-map {
    height: 100%;
    width: 100%;
    background: #05070d;
}

/* --- HUD overlay --- */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(8, 12, 22, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 12px;
    padding: 16px 20px;
    color: #e2f5e8;
    min-width: 220px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.hud h1 {
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4ade80;
    margin: 0 0 12px 0;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.85rem;
    padding: 3px 0;
    color: #cfe8d8;
}

.hud-row span:first-child {
    opacity: 0.6;
}

.hud-row span:last-child {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.hud-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    margin-top: 10px;
    opacity: 0.8;
}

.hud-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}

.hud-status-dot.offline {
    background: #f87171;
    box-shadow: 0 0 8px #f87171;
}

/* --- Crew / flyover panels --- */
.crew-panel,
.flyover-panel {
    position: absolute;
    z-index: 1000;
    background: rgba(8, 12, 22, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 12px;
    padding: 16px 20px;
    color: #e2f5e8;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* The Leaflet popup pane is permanently trapped below these panels in
   z-order — Leaflet applies a CSS transform to its map pane for panning,
   which forms its own stacking context and blocks any z-index from
   escaping it. Rather than fight that, just fade the panels out of the way
   while the ISS info popup is open, so nothing overlaps. */
.tracker-page.popup-active .crew-panel,
.tracker-page.popup-active .flyover-panel {
    opacity: 0;
    pointer-events: none;
}

.crew-panel {
    top: 20px;
    right: 20px;
    width: 220px;
    max-height: 260px;
    overflow-y: auto;
}

.flyover-panel {
    bottom: 20px;
    left: 20px;
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
}

.crew-panel h2,
.flyover-panel h2 {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #4ade80;
    margin: 0 0 12px 0;
}

.panel-status {
    font-size: 0.8rem;
    opacity: 0.7;
}

.panel-status.error {
    color: #f87171;
    opacity: 1;
}

.crew-count {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 8px;
}

.crew-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.crew-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: #cfe8d8;
    cursor: default;
}

.crew-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(74, 222, 128, 0.35);
    background: rgba(255, 255, 255, 0.06);
    transition: transform 0.15s ease;
}

.crew-list li:hover .crew-avatar {
    transform: scale(1.25);
}

/* Positioned via inline left/top (actual cursor coords, set from Blazor) —
   fixed rather than absolute so it isn't clipped by .crew-panel's
   overflow-y: auto, and anchored to its own right edge via the transform
   so it opens away from the panel instead of under the cursor. */
.crew-hover-card {
    position: fixed;
    transform: translate(-100%, -50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 150px;
    padding: 16px;
    background: rgba(8, 12, 22, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: crew-hover-card-in 0.12s ease-out;
}

@keyframes crew-hover-card-in {
    from { opacity: 0; transform: translate(-100%, -50%) scale(0.92); }
    to   { opacity: 1; transform: translate(-100%, -50%) scale(1); }
}

.crew-hover-photo,
.crew-hover-photo-fallback {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(74, 222, 128, 0.5);
}

.crew-hover-photo {
    object-fit: cover;
}

.crew-hover-photo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: rgba(255, 255, 255, 0.06);
}

.crew-hover-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2f5e8;
    text-align: center;
}

.crew-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.flyover-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.flyover-form input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 6px;
    padding: 6px 8px;
    color: #e2f5e8;
    font-size: 0.8rem;
}

.flyover-form input::placeholder {
    color: rgba(226, 245, 232, 0.4);
}

.flyover-actions {
    display: flex;
    gap: 8px;
}

.flyover-actions button {
    flex: 1;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.35);
    border-radius: 6px;
    padding: 6px 8px;
    color: #4ade80;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.flyover-actions button:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.25);
}

.flyover-actions button:disabled {
    opacity: 0.4;
    cursor: default;
}

.flyover-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
}

.flyover-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-top: 1px solid rgba(74, 222, 128, 0.12);
}

.flyover-list li:first-child {
    border-top: none;
}

.flyover-time {
    color: #e2f5e8;
    font-weight: 600;
    white-space: nowrap;
}

.flyover-detail {
    color: #9db8ab;
    text-align: right;
    white-space: nowrap;
}

/* --- ISS marker --- */
.iss-marker {
    position: relative;
    cursor: pointer;
}

.iss-marker-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px !important;
    height: auto !important;
    filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.9));
    transition: transform 0.2s ease-out, filter 0.2s ease-out;
}

.iss-marker:hover .iss-marker-icon {
    transform: translate(-50%, -50%) scale(1.6);
    filter: drop-shadow(0 0 8px rgba(74, 222, 128, 1));
}

.iss-marker--active .iss-marker-icon {
    transform: translate(-50%, -50%) scale(2.1);
    filter: drop-shadow(0 0 12px rgba(74, 222, 128, 1));
}

.iss-marker-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(74, 222, 128, 0.25);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%   { transform: translate(-50%, -50%) scale(0.8); opacity: 0.7; }
    70%  { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* --- ISS info card (Leaflet popup, restyled to match the HUD) --- */
.iss-popup-wrapper .leaflet-popup-content-wrapper {
    background: rgba(8, 12, 22, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #e2f5e8;
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.iss-popup-wrapper .leaflet-popup-content {
    margin: 16px 18px;
    line-height: 1.5;
    font-size: 0.82rem;
}

.iss-popup-wrapper .leaflet-popup-tip {
    background: rgba(8, 12, 22, 0.92);
    border: 1px solid rgba(74, 222, 128, 0.3);
    box-shadow: none;
}

.iss-popup-wrapper .leaflet-popup-close-button {
    color: #4ade80 !important;
    font-size: 20px !important;
}

.iss-popup-wrapper .leaflet-popup-close-button:hover {
    color: #86efac !important;
}

.iss-popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4ade80;
    margin-bottom: 10px;
}

.iss-popup-body p {
    color: #cfe8d8;
    margin: 0 0 10px 0;
}

.iss-popup-body p:last-child {
    margin-bottom: 0;
}

.iss-popup-source {
    margin-top: 10px;
    font-size: 0.7rem;
    text-align: right;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* --- Explore ISS page --- */
.explore-page {
    height: 100%;
    overflow-y: auto;
    padding: 40px 32px 64px;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

.explore-header {
    margin-bottom: 28px;
}

.explore-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #e2f5e8;
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.explore-header p {
    color: #9db8ab;
    font-size: 0.9rem;
    max-width: 640px;
    line-height: 1.5;
}

.explore-loading {
    color: #9db8ab;
    font-size: 0.9rem;
    padding: 40px 0;
    text-align: center;
}

.explore-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: 20px;
    padding: 6px 16px;
    color: #9db8ab;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter-btn:hover {
    border-color: rgba(74, 222, 128, 0.5);
    color: #e2f5e8;
}

.filter-btn.active {
    background: rgba(74, 222, 128, 0.16);
    border-color: #4ade80;
    color: #4ade80;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.module-card {
    background: rgba(8, 12, 22, 0.75);
    border: 1px solid rgba(74, 222, 128, 0.18);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.module-card:hover {
    border-color: rgba(74, 222, 128, 0.45);
    transform: translateY(-2px);
}

.module-image-wrap {
    height: 160px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.module-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.module-image-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.3;
}

.module-body {
    padding: 16px 18px 20px;
}

.module-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #9db8ab;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.module-body h2 {
    font-size: 1rem;
    color: #e2f5e8;
    margin: 0 0 6px 0;
}

.module-category {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 4px;
    padding: 2px 8px;
    margin-bottom: 10px;
}

.module-body p {
    font-size: 0.82rem;
    color: #cfe8d8;
    line-height: 1.5;
    margin: 0;
}
