:root {
    --primary: #1a1a1a;
    --secondary: #f5f5f5;
    --accent: #3b82f6;
    --layer1: #242424;
    --layer2: #2a2a2a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--primary);
    color: var(--secondary);
    overflow: hidden;
}

.font-geist-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#transformerCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    transition: opacity 0.5s ease;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--primary);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Transformer logo animation */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

#transformerLogo {
    animation: pulse 2s infinite ease-in-out;
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background-color: rgba(42, 42, 42, 0.9);
    backdrop-filter: blur(8px);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    max-width: 200px;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    transform: translate(-50%, -110%);
}

.tooltip:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(42, 42, 42, 0.9);
}

/* Component highlight */
.highlight-pulse {
    animation: highlight-pulse 2s infinite;
}

@keyframes highlight-pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

/* Data token animation */
.data-token {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent);
    filter: blur(2px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.9;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

/* Animation for component info panel */
@keyframes fadeScale {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#componentInfo {
    animation: fadeScale 0.3s ease forwards;
}

/* Data visualization panel slide-in animation */
@keyframes slideInRight {
    0% { transform: translate(100%, -50%); opacity: 0; }
    100% { transform: translate(0, -50%); opacity: 1; }
}

#dataVisualization.visible {
    animation: slideInRight 0.5s ease forwards;
    display: block !important;
    transform: translateX(0) translateY(-50%);
    opacity: 1;
}

/* Encoding flow animation effects */
.active-component {
    filter: drop-shadow(0 0 8px var(--accent));
}

.token-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 1) 0%, rgba(59, 130, 246, 0.4) 70%, rgba(59, 130, 246, 0) 100%);
    pointer-events: none;
    z-index: 10;
}

.pulse-animation {
    animation: pulse-glow 1.5s ease infinite;
}

@keyframes pulse-glow {
    0% { filter: brightness(1) drop-shadow(0 0 2px rgba(59, 130, 246, 0.5)); }
    50% { filter: brightness(1.2) drop-shadow(0 0 8px rgba(59, 130, 246, 0.8)); }
    100% { filter: brightness(1) drop-shadow(0 0 2px rgba(59, 130, 246, 0.5)); }
}

/* Data text highlighting animation */
@keyframes highlightText {
    0% { background-color: transparent; }
    50% { background-color: rgba(59, 130, 246, 0.2); }
    100% { background-color: transparent; }
}

.highlight-text {
    animation: highlightText 1.5s ease;
    border-radius: 3px;
    padding: 1px 2px;
}

/* Data flow visualization */
.data-flow-container {
    position: relative;
    width: 100%;
    height: 20px; 
    margin: 8px 0;
}

.data-flow-step {
    position: absolute;
    height: 100%;
    background-color: var(--accent);
    opacity: 0.2;
    transition: width 0.5s ease, opacity 0.5s ease;
    border-radius: 4px;
}

.data-flow-step.active {
    opacity: 0.7;
}

.data-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    margin-top: 4px;
}

.matrix-cell {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    font-size: 9px;
    padding: 2px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.matrix-cell.highlighted {
    background-color: rgba(59, 130, 246, 0.4);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #componentInfo {
        width: 85%;
    }
    
    #controlPanel {
        padding: 8px 12px;
        flex-direction: column;
    }
    
    #controlPanel button {
        font-size: 12px;
        padding: 6px 10px;
        margin-bottom: 8px;
    }
    
    #controlPanel .flex.space-x-4 {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #interactionHelp {
        display: none;
    }
    
    #dataVisualization {
        width: 90%;
        left: 5%;
        right: auto;
        transform: translateY(-50%);
    }
}
