/* Color Palette and Variables */
:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary-blue: #3b82f6;
    --accent-blue: #60a5fa;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success-green: #22c55e;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(96, 165, 250, 0.1), transparent 25%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--panel-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #60a5fa, #f8fafc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-icon {
    font-size: 1.75rem;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--success-green);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.pulse {
    width: 8px;
    height: 8px;
    background-color: var(--success-green);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Layout Container */
.dashboard-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Panels (Glassmorphism) */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Map Configuration */
.ops-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#iss-map {
    height: 480px;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--panel-border);
    z-index: 1; /* Keep map below sticky header */
}

/* Telemetry Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.data-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.data-card:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.3);
}

.data-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.data-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.data-card p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-blue);
}

/* Crew Manifest Column */
.crew-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--panel-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--primary-blue);
    color: var(--text-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--panel-border);
}

.filter-container label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

#country-filter {
    flex: 1;
    background: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

#country-filter:focus {
    border-color: var(--primary-blue);
}

.crew-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for Crew List */
.crew-list::-webkit-scrollbar {
    width: 6px;
}
.crew-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5); 
    border-radius: 3px;
}
.crew-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 3px;
}
.crew-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3); 
}

.crew-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 0.75rem;
    transition: background-color 0.2s;
}

.crew-card:hover {
    background: rgba(15, 23, 42, 0.8);
}

.crew-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-blue);
    background-color: var(--bg-dark);
}

.crew-info {
    flex: 1;
}

.crew-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crew-role {
    font-size: 0.8rem;
    color: var(--accent-blue);
    margin-top: 0.15rem;
    display: block;
}

.crew-agency {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    display: inline-block;
    margin-top: 0.35rem;
}

.loader {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
    animation: pulse 1.5s infinite;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    #iss-map {
        height: 400px;
    }
    
    .crew-list {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .telemetry-grid {
        grid-template-columns: 1fr;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
}
