:root {
    --primary: #00f3ff;
    --secondary: #7b00ff;
    --accent: #ff00c8;
    --dark: #0a0a1a;
    --darker: #050510;
    --panel: rgba(15, 15, 35, 0.85);
    --light: #f0f8ff;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --bundle-connection: #ff7b00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body, html {
    font-family: 'Exo 2', sans-serif;
    background-color: var(--darker);
    color: var(--light);
    line-height: 1.6;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.dashboard {
    position: relative;
    width: 100%;
    height: 100%;
}

.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel);
    color: var(--light);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    z-index: 10000;
    font-size: 0.9em;
}

/* Live Camera Feed */
#video-feed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    transform: scaleX(-1);
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(5,5,16,0.3) 0%, rgba(5,5,16,0.1) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Error container inside video */
.video-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 20px;
    z-index: 10;
}

.video-error-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.video-error-details {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
    color: #ccc;
}

/* video-feed default style */
#video-feed.video-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    color: white;
    font-family: sans-serif;
    text-align: center;
}

/* Status Indicators */
.status-bar {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.8rem;
    z-index: 100;
}

.modality-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(240, 248, 255, 0.2);
    position: relative;
    transition: var(--transition);
}

.modality-indicator.active {
    box-shadow: 0 0 10px currentColor;
}

.modality-indicator[data-modality="visual"] { color: var(--primary); }
.modality-indicator[data-modality="audio"] { color: var(--accent); }
.modality-indicator[data-modality="text"] { color: var(--secondary); }

.modality-indicator.active[data-modality="visual"] { background: var(--primary); }
.modality-indicator.active[data-modality="audio"] { background: var(--accent); }
.modality-indicator.active[data-modality="text"] { background: var(--secondary); }

/* Connection Mode Indicator */
.connection-mode {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: var(--panel);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--primary);
    display: none;
    z-index: 100;
}

.connection-mode.active {
    display: block;
}

/* Bundle Mode Indicator */
.bundle-mode {
    position: fixed;
    top: 3.5rem;
    left: 1rem;
    background: var(--panel);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--accent);
    display: none;
    z-index: 100;
}

.bundle-mode.active {
    display: block;
}

.adding-bundle{
    box-shadow: 0 0 20px rgba(123, 0, 255, 0.6);
    cursor: copy;
}

/* Thought Cards */
.thought-card {
    position: absolute;
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    width: 280px;
    max-height: 320px;
    cursor: grab;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 5;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, width 0.3s ease, height 0.3s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    touch-action: none;
    overflow: hidden;
}

.thought-card:active, .thought-card.dragging {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.thought-card.connecting {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}

.thought-card.selected {
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

.thought-card.expanded {
    width: 80vw;
    height: 80vh;
    max-width: 800px;
    max-height: 600px;
    z-index: 200;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.thought-card.minimized {
    height: auto;
    width: 200px;
}

.thought-card.focused {
    z-index: 150;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.5);
    border-width: 2px;
}

.thought-card.bundle-card {
    border: 2px dashed var(--accent);
    background: rgba(123, 0, 255, 0.1);
}

.thought-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
}

.thought-type {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.thought-time {
    font-size: 0.7rem;
    color: rgba(240, 248, 255, 0.6);
}

.thought-content {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.8rem;
    padding-right: 0.5rem;
    transition: opacity 0.3s ease;
}

.thought-card.minimized .thought-content {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.message {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.message.user {
    background: rgba(0, 243, 255, 0.1);
    border-left: 3px solid var(--primary);
}

.message.centrigon {
    background: rgba(123, 0, 255, 0.1);
    border-left: 3px solid var(--secondary);
}
.message.thinking {
    opacity: 0.7;
    font-style: italic;
    color: var(--accent);
}

.thought-input-container {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    transition: opacity 0.3s ease;
}

.thought-card.minimized .thought-input-container {
    opacity: 0;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.thought-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--light);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    resize: none;
    min-height: 40px;
    max-height: 100px;
}

.thought-input:focus {
    outline: none;
    border-color: var(--primary);
}

.send-btn {
    background: rgba(0, 243, 255, 0.2);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--light);
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.send-btn:hover {
    background: rgba(0, 243, 255, 0.3);
}

.thought-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.action-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--light);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: var(--transition);
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Moment Bundle Container */
.moment-bundle {
    position: absolute;
    background: rgba(123, 0, 255, 0.1);
    border: 2px dashed var(--accent);
    border-radius: 16px;
    padding: 15px;
    z-index: 8;
    transition: all 0.3s ease;
    min-width: 200px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    cursor: grab;
    user-select: none;
    backdrop-filter: blur(10px);
}

.moment-bundle:active, .moment-bundle.dragging {
    cursor: grabbing;
    border: 2px solid var(--accent);
    box-shadow: 0 8px 30px rgba(123, 0, 255, 0.4);
    z-index: 100;
    transition: none; /* Remove transition during drag for better performance */
}

.moment-bundle.expanded {
    background: rgba(123, 0, 255, 0.2);
    border: 2px solid var(--accent);
    z-index: 50;
}

.bundle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
    cursor: grab;
}

.bundle-header:active {
    cursor: grabbing;
}

.bundle-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.bundle-badge {
    background: var(--accent);
    color: var(--light);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.bundle-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.bundle-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Connection Lines */
.connection-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(to right, var(--primary), transparent);
    transform-origin: 0 0;
    z-index: 4;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.connection-line.minimized {
    opacity: 0.3;
}

.connection-line.internal {
    background: linear-gradient(to right, var(--accent), transparent);
    height: 1px;
}

/* Bundle connection lines */
.connection-line.bundle-connection {
    background: linear-gradient(to right, var(--bundle-connection), transparent);
    height: 3px;
    z-index: 7;
}

.connection-line.internal-bundle {
    background: linear-gradient(to right, var(--accent), transparent);
    height: 2px;
    z-index: 6;
}

/* Expanded bundle layout - FIXED VISIBILITY */
.bundle-expanded-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.95);
    z-index: 400;
    display: none;
    flex-direction: column;
    padding: 2rem;
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

.bundle-expanded-layout.active {
    display: flex;
}

.bundle-layout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bundle-layout-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

.bundle-layout-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    flex: 1;
    position: relative;
}

.bundle-card-container {
    background: var(--panel);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    max-height: 400px;
    overflow-y: auto;
    position: relative;
}

.bundle-card-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.bundle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bundle-card-type {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.bundle-card-time {
    font-size: 0.7rem;
    color: rgba(240, 248, 255, 0.6);
}

.bundle-card-message {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(123, 0, 255, 0.1);
    border-left: 3px solid var(--secondary);
}

.bundle-layout-close {
    background: none;
    border: none;
    color: var(--light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bundle-layout-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Connection lines for expanded bundle view */
.bundle-connection-line {
    position: absolute;
    background: linear-gradient(to right, var(--accent), transparent);
    height: 2px;
    transform-origin: 0 0;
    z-index: 1;
    pointer-events: none;
}

/* Visual indicator for bundle membership */
.thought-card.in-bundle {
    border-left: 4px solid var(--accent);
}

/* Memory Timeline */
.timeline-container {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    z-index: 300;
    width: 80%;
    max-width: 600px;
    display: none;
    flex-direction: column;
    max-height: 50vh;
}

.timeline-container.active {
    display: flex;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.timeline-close {
    background: none;
    border: none;
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
}

.timeline-content {
    overflow-y: auto;
    flex: 1;
}

.timeline-item {
    padding: 0.8rem;
    border-left: 2px solid var(--primary);
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: var(--transition);
}

.timeline-item:hover {
    background: rgba(0, 243, 255, 0.1);
}

.timeline-item-time {
    font-size: 0.7rem;
    color: rgba(240, 248, 255, 0.6);
    margin-bottom: 0.3rem;
}

.timeline-item-content {
    font-size: 0.9rem;
}

/* Input System */
.input-system {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    z-index: 100;
    transition: var(--transition);
}

.input-indicator {
    width: 100%;
    height: 4px;
    background: rgba(240, 248, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
}

.input-level {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.input-hint {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(240, 248, 255, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-system.listening .input-hint {
    opacity: 1;
}

.input-system.listening .input-level {
    width: 30%;
    animation: inputPulse 1.5s infinite;
}

.input-system.recording .input-level {
    width: 80%;
    background: var(--accent);
    animation: inputPulse 0.8s infinite;
}

@keyframes inputPulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Controls */
.controls {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.control-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
}

.control-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 0, 200, 0.5);
}

/* Scrollbar styling */
.thought-content::-webkit-scrollbar,
.timeline-content::-webkit-scrollbar,
.bundle-card-container::-webkit-scrollbar {
    width: 5px;
}

.thought-content::-webkit-scrollbar-track,
.timeline-content::-webkit-scrollbar-track,
.bundle-card-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.thought-content::-webkit-scrollbar-thumb,
.timeline-content::-webkit-scrollbar-thumb,
.bundle-card-container::-webkit-scrollbar-thumb {
    background: rgba(0, 243, 255, 0.3);
    border-radius: 10px;
}

.thought-content::-webkit-scrollbar-thumb:hover,
.timeline-content::-webkit-scrollbar-thumb:hover,
.bundle-card-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.5);
}

/* Touch device adjustments */
@media (hover: none) and (pointer: coarse) {
    .thought-card {
        cursor: default;
    }
    
    .thought-card:active, .thought-card.dragging {
        cursor: default;
    }
    
    .action-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .thought-input {
        font-size: 16px;
    }
    
    .moment-bundle {
        cursor: default;
    }
    
    .moment-bundle:active, .moment-bundle.dragging {
        cursor: default;
    }
    
    .bundle-header {
        cursor: default;
    }
}

/* Pulse animation for visual feedback */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Visual feedback for bundle interactions */
.moment-bundle.dragging {
    border: 2px solid var(--accent) !important;
}

/* Make sure dashed border is preserved */
.moment-bundle {
    border: 2px dashed var(--accent) !important;
}

/* Selected card styling */
.thought-card.selected {
    border: 2px solid var(--accent) !important;
    box-shadow: 0 0 15px rgba(123, 0, 255, 0.5) !important;
}

/* Different connection styles for clarity */
.connection-line.bundle-external {
    background: linear-gradient(to right, var(--bundle-connection), transparent);
    height: 3px;
    z-index: 7;
    opacity: 0.7;
}

.connection-line.bundle-to-card {
    background: linear-gradient(to right, var(--accent), var(--primary));
    height: 2px;
    z-index: 6;
    opacity: 0.8;
}

.connection-line.bundle-to-bundle {
    background: linear-gradient(to right, var(--secondary), var(--accent));
    height: 4px;
    z-index: 8;
    opacity: 0.9;
    border: 1px solid rgba(123, 0, 255, 0.3);
}






/* Ensure proper z-index layering for connections */
.connection-line {
    z-index: 4; /* Behind cards but above background */
}

.connection-line.internal {
    z-index: 3; /* Behind regular connections */
}

.connection-line.bundle-to-bundle {
    z-index: 5; /* Above regular connections */
}

/* Fix for bundle translucency - make sure background is opaque enough */
.moment-bundle {
    background: rgba(123, 0, 255, 0.15) !important; /* Increased opacity */
    backdrop-filter: blur(15px); /* Stronger blur to hide lines behind */
}

/* Ensure thought cards have solid enough background */
.thought-card {
    background: rgba(15, 15, 35, 0.9) !important; /* More opaque */
}





/* === PERCEPTION ENHANCEMENTS === */
/* Enhance your existing modality indicators */
.modality-indicator.active {
    animation: pulse 2s infinite;
}

.modality-indicator[data-modality="visual"].active {
    box-shadow: 0 0 10px var(--primary);
}

.modality-indicator[data-modality="audio"].active {
    box-shadow: 0 0 10px var(--accent);
}

/* Input system enhancements for perception */
.input-system.perceiving .input-level {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    animation: pulse 1s infinite;
}

/* Special styling for AI-generated association thoughts */
.thought-card[data-modality="internal"] {
    border-left: 4px solid var(--bundle-connection);
    background: rgba(255, 123, 0, 0.1) !important;
}

.thought-card[data-modality="internal"] .thought-type {
    color: var(--bundle-connection);
}

/* Enhanced pulse animation */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Salience-based glow effects */
.high-salience {
    box-shadow: 0 0 20px currentColor !important;
    animation: glowPulse 0.5s infinite;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 10px currentColor; }
    50% { box-shadow: 0 0 20px currentColor; }
    100% { box-shadow: 0 0 10px currentColor; }
}

