/* Google Material Design 3 styled variables */
:root {
    /* MD3 Dark Theme Colors */
    --md-sys-color-background: #111318;
    --md-sys-color-on-background: #E2E2E9;
    --md-sys-color-surface: #111318;
    --md-sys-color-surface-container: #1E2025;
    --md-sys-color-surface-container-high: #282A2F;

    --md-sys-color-primary: #AECBFA;
    --md-sys-color-on-primary: #162D4A;
    --md-sys-color-primary-container: #2F4564;
    --md-sys-color-on-primary-container: #D8E2FF;

    --md-sys-color-secondary: #BFC6DC;
    --md-sys-color-secondary-container: #3F4759;

    --md-sys-color-tertiary: #DEBCDF;

    --md-sys-color-error: #FFB4AB;

    --md-sys-color-outline: #8E9099;
    --md-sys-color-outline-variant: #44474E;

    /* Custom Gradients */
    --gradient-glow: linear-gradient(135deg, rgba(66, 133, 244, 0.15) 0%, rgba(219, 68, 55, 0.15) 100%);
}

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

body {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* Sidebar Navigation Drawer */
.sidebar {
    width: 360px;
    background-color: var(--md-sys-color-surface-container);
    height: 100%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    transition: width 0.3s ease;
    z-index: 2;
}

.logo-area {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-family: 'Google Sans', sans-serif;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.scroll-area {
    padding: 0 24px 24px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Material Forms */
.form-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    font-weight: 700;
    display: block;
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

.md-select,
.md-input {
    width: 100%;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 4px;
    /* Material 2/3 hybrid for desktop density */
    padding: 16px 16px 4px 16px;
    color: var(--md-sys-color-on-background);
    font-family: inherit;
    font-size: 16px;
    height: 56px;
    transition: border-color 0.2s;
    appearance: none;
    cursor: pointer;
}

.md-select:focus,
.md-input:focus {
    border-color: var(--md-sys-color-primary);
    outline: none;
    border-width: 2px;
    padding: 15px 15px 3px 15px;
    /* Adjust for border width */
}

.input-label {
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 11px;
    color: var(--md-sys-color-secondary);
    pointer-events: none;
}

.md-slider-container {
    background-color: var(--md-sys-color-surface-container-high);
    padding: 12px 16px;
    border-radius: 12px;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--md-sys-color-secondary);
}

input[type=range] {
    width: 100%;
    accent-color: var(--md-sys-color-primary);
}

/* Primary FAB / Button */
.btn-primary {
    width: 100%;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 16px;
    border-radius: 28px;
    /* High pill shape */
    border: none;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background-color: #BDD5FA;
    /* Lighter shade */
}

.btn-primary:disabled {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-outline);
    cursor: not-allowed;
    box-shadow: none;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-background);
    position: relative;
    overflow: hidden;
}

/* App Bar */
.top-app-bar {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    justify-content: space-between;
}

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

.tab-bar {
    display: flex;
    gap: 32px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-secondary);
    font-weight: 500;
    font-size: 14px;
    padding: 20px 0;
    cursor: pointer;
    position: relative;
}

.tab-btn.active {
    color: var(--md-sys-color-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
}

/* Workspace */
.workspace {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: radial-gradient(circle at 10% 20%, rgba(174, 203, 250, 0.03) 0%, transparent 40%);
}

/* Cards */
.card {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Metrics */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.metric-card {
    background-color: var(--md-sys-color-surface-container-high);
    padding: 20px;
    border-radius: 12px;
}

.metric-label {
    font-size: 12px;
    color: var(--md-sys-color-secondary);
    margin-bottom: 8px;
}

.metric-value {
    font-size: 28px;
    font-family: 'Roboto Mono', monospace;
    color: var(--md-sys-color-on-background);
}

.metric-sub {
    font-size: 12px;
    color: var(--md-sys-color-tertiary);
    margin-top: 4px;
}

/* Plots */
.plot-wrapper {
    width: 100%;
    min-height: 450px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* History List */
.history-list {
    list-style: none;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    align-items: center;
}

.history-item:last-child {
    border-bottom: none;
}

.history-meta {
    display: flex;
    flex-direction: column;
}

.h-time {
    font-size: 12px;
    color: var(--md-sys-color-secondary);
}

.h-res {
    font-family: 'Roboto Mono';
    color: var(--md-sys-color-primary);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 19, 24, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.md-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-primary);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: rotation 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 3D Visualization Styles */
.hero-3d-card {
    padding: 0 !important;
    overflow: hidden;
    height: 500px;
    position: relative;
    background: #000 !important;
    border-color: var(--md-sys-color-primary-container) !important;
}

.orbital-3d-container {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.orbital-3d-container:active {
    cursor: grabbing;
}

.viewport-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
    z-index: 5;
}

.status-badge {
    background: rgba(17, 19, 24, 0.7);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-sys-color-primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid var(--md-sys-color-primary-container);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #34A853;
    border-radius: 50%;
}

.dot.pulse {
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(52, 168, 83, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0);
    }
}

.viewport-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    pointer-events: auto;
    z-index: 5;
}

.view-toggle-btn {
    background: rgba(30, 32, 37, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-background);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-color: var(--md-sys-color-primary);
    font-weight: 500;
}

.view-toggle-btn:hover {
    background: var(--md-sys-color-surface-container-high);
}

/* Sidebar Satellite List */
.satellite-sidebar-list {
    list-style: none;
    margin-top: 12px;
}

.sat-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--md-sys-color-on-background);
    border: 1px solid transparent;
}

.sat-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.sat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #81C784;
    box-shadow: 0 0 6px rgba(129, 199, 132, 0.5);
}

.sat-name {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}