/* AstroThink NASA-Style HUD Theme */
:root {
    --astro-primary: #00d4ff;
    --astro-secondary: #ff6b35;
    --astro-accent: #ffd700;
    --astro-bg-dark: #0a0a0a;
    --astro-bg-darker: #050505;
    --astro-text: #ffffff;
    --astro-text-dim: #888888;
    --astro-border: #333333;
    --astro-success: #00ff88;
    --astro-warning: #ffaa00;
    --astro-error: #ff4444;
}

body.astrothink {
    background: linear-gradient(135deg, var(--astro-bg-darker) 0%, var(--astro-bg-dark) 100%);
    color: var(--astro-text);
    font-family: 'Courier New', monospace;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* NASA-style HUD Header */
.astrothink-header {
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 2px solid var(--astro-primary);
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.astrothink-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.astrothink-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--astro-primary);
    text-decoration: none;
}

.astrothink-logo:hover {
    color: var(--astro-accent);
    text-shadow: 0 0 10px var(--astro-primary);
}

.astrothink-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.science-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--astro-primary);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.science-toggle:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.science-toggle.active {
    background: rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.science-toggle input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--astro-primary);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.science-toggle input[type="checkbox"]:checked {
    background: var(--astro-primary);
    box-shadow: 0 0 10px var(--astro-primary);
}

.science-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--astro-bg-dark);
    font-weight: bold;
    font-size: 12px;
}

/* Main Content Area */
.astrothink-main {
    margin-top: 80px;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

.astrothink-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Demo Cards */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.demo-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--astro-border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.demo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.demo-card:hover::before {
    left: 100%;
}

.demo-card:hover {
    border-color: var(--astro-primary);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-5px);
}

.demo-card h3 {
    color: var(--astro-primary);
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.demo-card p {
    color: var(--astro-text-dim);
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.demo-card .demo-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

/* Science Mode Overlay */
.science-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.science-overlay.active {
    display: flex;
}

.science-content {
    background: var(--astro-bg-dark);
    border: 2px solid var(--astro-primary);
    border-radius: 10px;
    padding: 2rem;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.science-content h3 {
    color: var(--astro-primary);
    margin-top: 0;
    text-align: center;
}

.science-content .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--astro-error);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
}

.science-content .close-btn:hover {
    background: #ff6666;
}

/* Interactive Elements */
.astrothink-slider {
    width: 100%;
    height: 6px;
    background: var(--astro-border);
    border-radius: 3px;
    outline: none;
    appearance: none;
    margin: 1rem 0;
}

.astrothink-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--astro-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--astro-primary);
}

.astrothink-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--astro-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--astro-primary);
}

.astrothink-button {
    background: linear-gradient(45deg, var(--astro-primary), var(--astro-secondary));
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.astrothink-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

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

/* Canvas and Visualization Areas */
.astrothink-canvas {
    border: 2px solid var(--astro-border);
    border-radius: 10px;
    background: var(--astro-bg-darker);
    margin: 1rem 0;
}

.astrothink-canvas:hover {
    border-color: var(--astro-primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

/* Data Display */
.telemetry-display {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--astro-border);
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}

.telemetry-value {
    color: var(--astro-primary);
    font-weight: bold;
}

.telemetry-label {
    color: var(--astro-text-dim);
    margin-right: 0.5rem;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--astro-primary); }
    50% { box-shadow: 0 0 20px var(--astro-primary), 0 0 30px var(--astro-primary); }
}

.pulse {
    animation: pulse 2s infinite;
}

.glow {
    animation: glow 2s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .astrothink-header {
        padding: 0.5rem 1rem;
    }
    
    .astrothink-nav {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .astrothink-logo {
        font-size: 1.2rem;
        gap: 0.5rem;
    }
    
    .astrothink-controls {
        gap: 0.5rem;
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }
    
    .science-toggle {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .astrothink-button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .astrothink-main {
        margin-top: 120px;
        padding: 0.5rem;
    }
    
    .astrothink-container {
        padding: 0;
    }
    
    .demo-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    .demo-card {
        padding: 1rem;
    }
    
    .demo-card h3 {
        font-size: 1.1rem;
    }
    
    .demo-card .demo-icon {
        font-size: 1.5rem;
    }
    
    .science-content {
        max-width: 95%;
        padding: 1rem;
        margin: 1rem;
    }
    
    .astrothink-canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        margin: 0.5rem 0;
    }
    
    .telemetry-display {
        padding: 0.5rem;
        margin: 0.5rem 0;
    }
    
    .telemetry-display h4 {
        font-size: 0.9rem;
    }
    
    .telemetry-display div {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .astrothink-header {
        padding: 0.25rem 0.5rem;
    }
    
    .astrothink-main {
        margin-top: 140px;
        padding: 0.25rem;
    }
    
    .astrothink-logo {
        font-size: 1rem;
    }
    
    .astrothink-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }
    
    .science-toggle {
        padding: 0.25rem;
        font-size: 0.7rem;
    }
    
    .astrothink-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .demo-card {
        padding: 0.75rem;
    }
    
    .demo-card h3 {
        font-size: 1rem;
    }
    
    .demo-card p {
        font-size: 0.8rem;
    }
    
    .science-content {
        padding: 0.75rem;
        margin: 0.5rem;
    }
    
    .science-content h3 {
        font-size: 1.1rem;
    }
    
    .telemetry-display {
        padding: 0.4rem;
    }
    
    .telemetry-display h4 {
        font-size: 0.8rem;
    }
    
    .telemetry-display div {
        font-size: 0.7rem;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--astro-border);
    border-radius: 50%;
    border-top-color: var(--astro-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.success {
    background: var(--astro-success);
    box-shadow: 0 0 10px var(--astro-success);
}

.status-indicator.warning {
    background: var(--astro-warning);
    box-shadow: 0 0 10px var(--astro-warning);
}

.status-indicator.error {
    background: var(--astro-error);
    box-shadow: 0 0 10px var(--astro-error);
}

/* Grid Layout for Demos */
.demo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.demo-controls {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--astro-border);
    border-radius: 10px;
    padding: 1.5rem;
}

.demo-visualization {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--astro-border);
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Mobile-specific demo layout */
@media (max-width: 768px) {
    .demo-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    .demo-controls {
        padding: 1rem;
        order: 2;
    }
    
    .demo-visualization {
        padding: 0.5rem;
        order: 1;
        min-height: 300px;
    }
    
    .demo-controls h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .demo-controls label {
        font-size: 0.9rem;
    }
    
    .astrothink-slider {
        margin: 0.5rem 0;
    }
    
    .astrothink-button {
        margin: 0.25rem 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .demo-layout {
        gap: 0.5rem;
        margin: 0.5rem 0;
    }
    
    .demo-controls {
        padding: 0.75rem;
    }
    
    .demo-visualization {
        padding: 0.25rem;
        min-height: 250px;
    }
    
    .demo-controls h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .demo-controls label {
        font-size: 0.8rem;
    }
    
    .astrothink-slider {
        margin: 0.25rem 0;
    }
    
    .astrothink-button {
        margin: 0.2rem 0;
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
}

/* Mobile Canvas and Overlay Styles */
@media (max-width: 768px) {
    .astrothink-canvas {
        max-width: 100%;
        height: auto;
        border-radius: 5px;
    }
    
    /* Mobile overlay positioning */
    .demo-visualization > div[style*="position: absolute"] {
        position: relative !important;
        margin: 0.5rem 0;
        background: rgba(0, 0, 0, 0.8) !important;
        border-radius: 5px;
        padding: 0.5rem;
    }
    
    /* Hide some overlays on mobile to reduce clutter */
    .demo-visualization > div[style*="position: absolute"]:nth-child(n+3) {
        display: none;
    }
    
    /* Make mission objectives responsive */
    .telemetry-display div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    
    /* Responsive status indicators */
    .status-indicator {
        width: 8px;
        height: 8px;
        margin-right: 0.25rem;
    }
}

@media (max-width: 480px) {
    .astrothink-canvas {
        border-radius: 3px;
    }
    
    /* Further reduce overlay clutter on small screens */
    .demo-visualization > div[style*="position: absolute"]:nth-child(n+2) {
        display: none;
    }
    
    /* Single column for mission objectives on very small screens */
    .telemetry-display div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.25rem !important;
    }
    
    /* Smaller status indicators */
    .status-indicator {
        width: 6px;
        height: 6px;
        margin-right: 0.2rem;
    }
}

/* Touch-friendly interactions */
@media (max-width: 768px) {
    .astrothink-button {
        min-height: 44px; /* iOS touch target size */
        touch-action: manipulation;
    }
    
    .astrothink-slider {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .astrothink-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .astrothink-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    /* Make science toggle touch-friendly */
    .science-toggle {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .science-toggle input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }
}
