/* ALPHA HORIZON - INSIGHTS PORTAL CSS */

:root {
    --void-black: #020408;
    --alpha-cyan: #00D4FF;
    --neural-purple: #9D00FF;
    --horizon-gold: #FF9F1C;
    --glass-bg: rgba(6, 11, 25, 0.7);
    --glass-border: rgba(0, 212, 255, 0.15);
    --glass-blur: 16px;
    --card-bg: rgba(255, 255, 255, 0.03);
}

body {
    background-color: var(--void-black);
    font-family: 'Inter', sans-serif;
    color: #F0F0F0;
    overflow-x: hidden;
    /* Subtle mesh gradient background */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(157, 0, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(0, 212, 255, 0.08) 0%, transparent 40%);
    min-height: 100vh;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    /* transform: translateY(-2px); */
}

/* Typography */
h1,
h2,
h3,
.brand-font {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

.text-gradient-cyan {
    background: linear-gradient(90deg, #fff, var(--alpha-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-gold {
    background: linear-gradient(90deg, #fff, var(--horizon-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Auth Overlay */
#auth-overlay {
    background: rgba(2, 4, 8, 0.9);
    backdrop-filter: blur(20px);
    transition: opacity 0.5s ease-in-out;
}

.login-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
}

.login-input:focus {
    border-color: var(--alpha-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
    outline: none;
}

.login-btn {
    background: linear-gradient(45deg, rgba(0, 212, 255, 0.1), rgba(157, 0, 255, 0.1));
    border: 1px solid var(--alpha-cyan);
    color: var(--alpha-cyan);
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: var(--alpha-cyan);
    color: black;
    box-shadow: 0 0 20px var(--alpha-cyan);
}

/* Dashboard Elements */
.run-selector {
    background: black;
    color: white;
    border: 1px solid #333;
    padding: 0.5rem;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    min-width: 250px;
}

/* Loading Spinner */
.loader {
    border: 3px solid rgba(0, 212, 255, 0.1);
    border-top: 3px solid var(--alpha-cyan);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--alpha-cyan);
}

/* Markdown / Prose Styling */
#markdown-container h1,
#markdown-container h2,
#markdown-container h3 {
    margin-bottom: 1.5rem !important;
    margin-top: 2rem !important;
}

#markdown-container p {
    margin-bottom: 1rem;
}

/* Plotly Modebar horizontal and at top */
.modebar-container {
    display: flex !important;
    flex-direction: row !important;
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    z-index: 1001;
}

.modebar-group {
    display: flex !important;
    flex-direction: row !important;
}

/* Network Control Panel [NEW] */
#network-controls {
    margin-top: 1rem;
}

#network-controls input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    height: 4px;
    border-radius: 2px;
}

#network-controls input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--alpha-cyan);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    border: 2px solid rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

#network-controls input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--alpha-cyan);
}

/* Agent Inspector Styles [REFINED] */
#agent-inspector {
    margin-top: 1rem;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    padding-top: 1rem;
}

#inspector-details {
    margin-top: 1rem;
    max-height: 800px;
}

/* THREE.JS ROOM SYSTEM & OVERLAYS */
#three-container canvas {
    display: block;
    outline: none;
}

#room-content.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.room-wireframe {
    position: fixed;
    inset: 0;
    border: 4px solid rgba(6, 182, 212, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, border-color 0.3s;
    z-index: 100;
}

.room-wireframe.active {
    opacity: 1;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: rgba(6, 182, 212, 0.2);
    }

    50% {
        border-color: rgba(6, 182, 212, 0.6);
    }
}

#current-node.visible {
    opacity: 1 !important;
}

/* Custom Scrollbar for Room Content */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Tutorial Accordion */
.tutorial-section.open .tutorial-content {
    display: block !important;
}

.tutorial-section.open .tutorial-chevron {
    transform: rotate(180deg);
}

.tutorial-section.open .tutorial-accordion {
    border-color: rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.05);
}

/* --- SIDEBAR CATEGORY SYSTEM --- */

.sidebar-add-cat-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.05);
    color: var(--alpha-cyan);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-add-cat-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}

.category-input,
.rename-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 10px;
    font-family: 'Inter', sans-serif;
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.category-input:focus,
.rename-input:focus {
    border-color: var(--alpha-cyan);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}

.category-input::placeholder,
.rename-input::placeholder {
    color: #555;
    font-family: monospace;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.05em;
}

.sidebar-category {
    margin-bottom: 2px;
}

.sidebar-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
}

.sidebar-category-header:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.sidebar-category-name {
    font-size: 10px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-category-count {
    font-size: 9px;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    color: #6B7280;
    padding: 0 5px;
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-chevron {
    color: #555;
    transition: transform 0.2s ease;
}

.sidebar-category.open .sidebar-chevron {
    transform: rotate(90deg);
}

.sidebar-category-delete {
    opacity: 0;
    color: #6B7280;
    padding: 2px;
    transition: all 0.15s ease;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
}

.sidebar-category-header:hover .sidebar-category-delete {
    opacity: 1;
}

.sidebar-category-delete:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

.sidebar-category-runs {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    padding-left: 8px;
    border-left: 1px solid rgba(0, 212, 255, 0.08);
    margin-left: 10px;
    margin-bottom: 6px;
}

.sidebar-category-runs.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.sidebar-category-runs.drag-over {
    border-left-color: var(--alpha-cyan);
    background: rgba(0, 212, 255, 0.03);
    border-radius: 0 6px 6px 0;
}

.run-item[draggable="true"] {
    cursor: grab;
}

.run-item[draggable="true"]:active {
    cursor: grabbing;
}

.sidebar-category-empty {
    padding: 12px 8px;
    text-align: center;
    font-size: 9px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #3B3B3B;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin: 4px 0;
}

.sidebar-uncat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 4px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-uncat-header span:first-child {
    font-size: 10px;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

.sidebar-uncat-zone {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}