/* Global Variables & Colors */
:root {
    --bg-dark: #0a0b10;
    --bg-card: rgba(15, 18, 30, 0.7);
    --border-color: rgba(0, 240, 255, 0.15);
    --border-hover: rgba(0, 240, 255, 0.4);
    
    --primary: #00f0ff;
    --primary-glow: rgba(0, 240, 255, 0.3);
    --secondary: #9b5de5;
    
    /* Force colors corresponding to Three.js arrows */
    --color-fg: #ff3344; /* Gravity */
    --color-ft: #00e5ff; /* Tension */
    --color-fc: #39ff14; /* Coriolis */
    --color-path: #ec4899; /* Trajectory */
    
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    
    --font-ui: 'Inter', sans-serif;
    --font-heading: 'Orbitron', sans-serif;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 240, 255, 0.4);
}

/* UI Overlay General Panels */
.sidebar {
    position: absolute;
    top: 100px;
    bottom: 20px;
    width: 320px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover {
    border-color: var(--border-hover);
    box-shadow: 0 8px 32px 0 rgba(0, 240, 255, 0.08);
}

.control-panel {
    left: 20px;
}

.info-panel {
    right: 20px;
    width: 340px;
}

/* Header */
.app-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 64px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

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

.logo-icon {
    font-size: 24px;
    animation: rotateLogo 8s linear infinite;
}

@keyframes rotateLogo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.logo-text p {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(0, 240, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 240, 255, 0.1);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-fc);
    box-shadow: 0 0 8px var(--color-fc);
}

.status-indicator.active {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--color-fc); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* Sections inside Sidebars */
.panel-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 20px;
}

.panel-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.panel-section h2 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Form controls & UI components */
.control-group {
    margin-bottom: 14px;
}

.control-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.neon-text {
    font-family: var(--font-heading);
    color: var(--primary);
    text-shadow: 0 0 6px var(--primary-glow);
    font-size: 13px;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

.help-text {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Button systems */
.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.primary-btn {
    background: rgba(0, 240, 255, 0.1);
    color: var(--primary);
    border-color: rgba(0, 240, 255, 0.3);
    flex: 2;
}

.primary-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.1);
    flex: 1;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Camera focus grids */
.focus-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.focus-btn {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    padding: 8px 6px;
    border-radius: 6px;
    text-align: center;
}

.focus-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.focus-btn.active {
    background: rgba(0, 240, 255, 0.08);
    color: var(--primary);
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

/* Checkboxes for Vectors */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
    color: var(--text-main);
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 16px;
    width: 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: inline-block;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: rgba(0, 240, 255, 0.15);
    border-color: var(--primary);
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark::after {
    display: block;
}

/* Checkbox Color Overrides for Vector indicators */
.checkmark.chk-grav::after { border-color: var(--color-fg); }
.custom-checkbox input:checked ~ .checkmark.chk-grav { border-color: var(--color-fg); background-color: rgba(255, 51, 68, 0.15); }
.checkmark.chk-tens::after { border-color: var(--color-ft); }
.custom-checkbox input:checked ~ .checkmark.chk-tens { border-color: var(--color-ft); background-color: rgba(0, 229, 255, 0.15); }
.checkmark.chk-cor::after { border-color: var(--color-fc); }
.custom-checkbox input:checked ~ .checkmark.chk-cor { border-color: var(--color-fc); background-color: rgba(57, 255, 20, 0.15); }
.checkmark.chk-pth::after { border-color: var(--color-path); }
.custom-checkbox input:checked ~ .checkmark.chk-pth { border-color: var(--color-path); background-color: rgba(236, 72, 153, 0.15); }

/* Realtime Data styling */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.detail-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    color: var(--primary);
}

.badge {
    background: rgba(0, 240, 255, 0.15);
    color: var(--primary);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-heading);
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.data-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.data-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.data-value {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
}

/* Physics Box & Math */
.math-box {
    background: rgba(0, 240, 255, 0.03);
    border: 1px dashed rgba(0, 240, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    text-align: center;
}

.formula {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.formula-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Accordion Info Items */
.accordion-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.accordion-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.accordion-item.open {
    border-color: rgba(0, 240, 255, 0.2);
    background: rgba(0, 240, 255, 0.02);
}

.accordion-header {
    padding: 10px;
}

.accordion-header h4 {
    font-size: 11px;
    font-family: var(--font-heading);
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    padding: 0 10px;
}

.accordion-item.open .accordion-content {
    max-height: 120px;
    padding: 0 10px 10px 10px;
}

.accordion-content p {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Floating Legend panel (Bottom) */
.legend-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 24px;
    z-index: 10;
    display: flex;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 600;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.color-fg { background: var(--color-fg); box-shadow: 0 0 6px var(--color-fg); }
.color-ft { background: var(--color-ft); box-shadow: 0 0 6px var(--color-ft); }
.color-fc { background: var(--color-fc); box-shadow: 0 0 6px var(--color-fc); }
.color-path { background: var(--color-path); box-shadow: 0 0 6px var(--color-path); }

/* Responsive adjustments */
@media(max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
}
/* Mobile Floating Action Buttons (Hidden on desktop) */
.mobile-ui-triggers {
    display: none;
}

@media(max-width: 768px) {
    body {
        overflow: hidden; /* Prevent scrolling outside on mobile */
    }
    
    .mobile-ui-triggers {
        display: flex;
        position: absolute;
        bottom: 20px;
        left: 0;
        right: 0;
        justify-content: space-between;
        padding: 0 15px;
        z-index: 110;
        gap: 10px;
        pointer-events: none; /* Let clicks pass to canvas if not on buttons */
    }
    
    .mobile-trigger-btn {
        pointer-events: auto;
        flex: 1;
        font-family: var(--font-heading);
        font-weight: 600;
        font-size: 10px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        background: rgba(15, 18, 30, 0.9);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--border-color);
        color: var(--primary);
        padding: 12px 14px;
        border-radius: 30px;
        box-shadow: 0 4px 20px rgba(0, 240, 255, 0.15);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.2s ease;
        outline: none;
    }
    
    .mobile-trigger-btn:active {
        transform: scale(0.95);
        border-color: var(--primary);
    }
    
    .mobile-trigger-btn.active {
        background: rgba(0, 240, 255, 0.15);
        border-color: var(--primary);
        color: #ffffff;
        box-shadow: 0 0 15px var(--primary-glow);
    }

    .app-header {
        position: absolute;
        top: 15px;
        left: 15px;
        right: 15px;
        height: 56px;
        padding: 0 15px;
        border-radius: 8px;
    }
    
    .logo-text h1 {
        font-size: 14px;
    }
    
    .logo-text p {
        font-size: 8px;
    }
    
    .header-status {
        display: none; /* Hide badge on mobile to save space */
    }

    /* Sidebars as Slide-in drawers on mobile */
    .sidebar {
        position: fixed !important;
        top: 86px;
        bottom: 80px; /* Space for triggers */
        width: 290px;
        max-width: 85%;
        z-index: 100;
        height: auto !important;
        margin-top: 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .control-panel {
        left: 15px !important;
        transform: translateX(-120%);
    }
    
    .info-panel {
        right: 15px !important;
        transform: translateX(120%);
    }
    
    /* Active slide states */
    .control-panel.mobile-open {
        transform: translateX(0);
        box-shadow: 0 8px 32px rgba(0, 240, 255, 0.2);
    }
    
    .info-panel.mobile-open {
        transform: translateX(0);
        box-shadow: 0 8px 32px rgba(0, 240, 255, 0.2);
    }

    .legend-panel {
        display: none !important;
    }
}

/* Credits Card Style (Sleek, Technical & Discrete) */
.credits-section {
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none !important;
}

.credits-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 6px 10px;
    transition: all 0.2s ease;
}

.credits-link:hover {
    background: rgba(0, 240, 255, 0.03);
    border-color: rgba(0, 240, 255, 0.2);
}

.credits-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: #0b1a30;
}

.credits-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.credits-org {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-main);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.credits-author {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 400;
}

.credits-url {
    font-size: 8px;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
