/* Main Application Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    background: #000000;
    color: #00ff00;
    overflow: hidden;
    height: 100vh;
    text-shadow: 0 0 5px #00ff00;
}

#app {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-areas:
        "header header header"
        "controls graph info";
    grid-template-columns: 20vw 1fr 25vw;
    grid-template-rows: 60px 1fr;
    gap: 0;
    overflow: hidden;
}

/* Header */
.app-header {
    grid-area: header;
    background: #000000;
    border-bottom: 2px solid #00ff00;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.3);
    gap: 20px;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    letter-spacing: 1px;
    flex-shrink: 0;
    margin: 0;
}

.app-header h1::before {
    content: '> ';
    color: #00ff00;
    animation: blink 1s infinite;
}

.header-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

.header-stats span {
    padding: 4px 8px;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 3D Graph Container */
#3d-graph {
    grid-area: graph;
    background: #000000;
    position: relative;
    overflow: hidden;
    border: 1px solid #00ff00;
    box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.2);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: #00ff00;
    font-family: 'Courier New', monospace;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 255, 0, 0.3);
    border-top: 4px solid #00ff00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    letter-spacing: 2px;
}

.loading-content h2::before {
    content: '[INIT] ';
    color: #00ff00;
}

.loading-content p {
    color: #00ff00;
    font-size: 1rem;
    text-shadow: 0 0 5px #00ff00;
}

.loading-content p::before {
    content: '> ';
    animation: blink 1s infinite;
}

/* Mobile Toggle Buttons */
.mobile-toggle {
    display: none;
    position: fixed;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff00;
    border-radius: 8px;
    color: #00ff00;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1002;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.mobile-controls-toggle {
    top: 70px;
    left: 10px;
}

.mobile-info-toggle {
    top: 70px;
    right: 10px;
}

.mobile-toggle:active {
    transform: scale(0.95);
    background: rgba(0, 255, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 1200px) {
    #app {
        grid-template-columns: 280px 1fr 320px;
    }
}

@media (max-width: 900px) {
    #app {
        grid-template-areas:
            "header"
            "graph";
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
    }

    /* Show mobile toggles */
    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .controls-panel,
    .info-panel {
        position: fixed;
        top: 60px;
        z-index: 1001;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(10px);
    }

    .controls-panel {
        left: -300px;
        width: 300px;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 255, 0, 0.3);
    }

    .controls-panel.open {
        left: 0;
    }

    .info-panel {
        right: -350px;
        width: 350px;
        transition: right 0.3s ease;
        box-shadow: -2px 0 20px rgba(0, 255, 0, 0.3);
    }

    .info-panel.open {
        right: 0;
    }

    /* Hide header stats on mobile to save space */
    .header-stats {
        display: none;
    }

    /* Adjust header for mobile */
    .app-header {
        padding: 0 10px;
    }

    .app-header h1 {
        font-size: 1rem;
    }
}

/* Desktop - make info panel an overlay */
@media (min-width: 901px) {
    .info-panel {
        position: fixed !important;
        top: 60px !important;
        right: 0 !important;
        width: 350px !important;
        height: calc(100vh - 60px) !important;
        z-index: 1000 !important;
        display: none !important;
    }

    .info-panel.open {
        display: flex !important;
    }
}

/* Smaller mobile screens */
@media (max-width: 600px) {
    .controls-panel,
    .info-panel {
        width: 100%;
    }

    .controls-panel {
        left: -100%;
    }

    .info-panel {
        right: -100%;
    }

    /* Make graph full screen on mobile */
    #3d-graph {
        border: none;
        box-shadow: none;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}