/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

:root {
    /* Modern 2025 Color Palette */
    --color-primary: #1a1a1a;      /* Deep charcoal */
    --color-secondary: #2563eb;    /* Vibrant blue */
    --color-background: #fafafa;   /* Light gray background */
    --color-surface: #ffffff;      /* Pure white */
    --color-dark: #0f172a;         /* Very dark blue-gray */
    --color-light: #f8fafc;        /* Subtle light gray */
    --color-accent: #64748b;       /* Cool gray */
    --color-text: #1e293b;         /* Dark slate */
    --color-text-light: #ffffff;   /* Pure white text */
    --color-text-muted: #64748b;   /* Muted gray text */
    
    /* Component Colors */
    --color-tube: #f97316;         /* Orange for tubes */
    --color-resistor: #eab308;     /* Yellow for resistors */
    --color-capacitor: #3b82f6;    /* Blue for capacitors */
    --color-transformer: #7c3aed;  /* Purple for transformers */
    --color-wire: #475569;         /* Slate gray for wires */
    --color-highlight: #fbbf24;    /* Amber highlight */
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    
    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-xxl: 1.5rem;
    --font-size-xxxl: 2rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(93, 78, 55, 0.1);
    --shadow-md: 0 4px 6px rgba(93, 78, 55, 0.1);
    --shadow-lg: 0 10px 15px rgba(93, 78, 55, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Main Layout */
.main {
    padding: var(--spacing-md) 0;
    height: 100vh;
}

.container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--spacing-xl);
    align-items: start;
    max-width: 1600px;
    height: calc(100vh - 2 * var(--spacing-md));
}

/* Diagram Section */
.diagram-section {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-accent);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Modern Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0;
    margin-bottom: var(--spacing-xl);
    background-color: #f1f5f9;
    padding: 6px;
    border-radius: 16px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.tab-indicator {
    position: absolute;
    height: calc(100% - 12px);
    background-color: var(--color-surface);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 24px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    font-family: var(--font-family);
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    color: var(--color-secondary);
}

.tab-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.tab-btn:hover .tab-icon {
    transform: scale(1.1);
}

.tab-btn.active .tab-icon {
    color: var(--color-secondary);
    transform: scale(1.15);
}

.tab-label {
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.tab-description {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

/* Diagram Views */
.diagram-view {
    display: none;
    width: 100%;
    height: 100%;
}

.diagram-view.active {
    display: block;
}

.diagram-container {
    background-color: var(--color-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--color-accent);
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.diagram-container:active {
    cursor: grabbing;
}

.amp-diagram {
    width: 100%;
    height: 100%;
    display: block;
    background-color: var(--color-light);
    min-height: 600px;
    transition: transform 0.2s ease;
}

/* Controls */
.controls {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.zoom-controls {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
}

.zoom-level {
    font-size: var(--font-size-sm);
    color: var(--color-dark);
    min-width: 50px;
    text-align: center;
}

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.btn--primary {
    background-color: var(--color-secondary);
    color: var(--color-text-light);
}

.btn--primary:hover {
    background-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--secondary {
    background-color: var(--color-accent);
    color: var(--color-text-light);
}

.btn--secondary:hover {
    background-color: var(--color-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:focus {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Component Panel */
.component-panel {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-accent);
    position: sticky;
    top: var(--spacing-lg);
    max-height: calc(100vh - 2 * var(--spacing-lg));
    overflow-y: auto;
}

.component-panel__header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.component-panel__header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.component-panel__close {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: var(--font-size-xxl);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.component-panel__close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.component-panel__content {
    padding: var(--spacing-lg);
}

.welcome-message h3 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-xl);
}

.welcome-message p {
    margin-bottom: var(--spacing-lg);
    color: var(--color-text);
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
    position: relative;
    color: var(--color-text);
}

.feature-list li::before {
    content: "🔧";
    position: absolute;
    left: 0;
    top: var(--spacing-sm);
}

/* SVG Styles */
.component {
    cursor: pointer;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.component:hover {
    filter: brightness(1.15) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    opacity: 0.9;
}

.component.highlighted {
    filter: drop-shadow(0 0 8px var(--color-highlight));
    stroke: var(--color-highlight);
    stroke-width: 2;
}

.wire {
    stroke: var(--color-wire);
    stroke-width: 2;
    fill: none;
}

.wire.signal-path {
    stroke: var(--color-highlight);
    stroke-width: 3;
    animation: signal-flow 2s ease-in-out infinite;
}

@keyframes signal-flow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}


/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        height: auto;
    }
    
    .diagram-section {
        height: 70vh;
        min-height: 500px;
    }
    
    .component-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header__title {
        font-size: var(--font-size-xxl);
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
    }
    
    .controls {
        justify-content: center;
    }
    
    .btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .diagram-section,
    .component-panel {
        padding: var(--spacing-md);
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #000000;
        --color-secondary: #0000FF;
        --color-background: #FFFFFF;
        --color-text: #000000;
        --color-accent: #666666;
    }
}

/* Focus visible for better keyboard navigation */
.btn:focus-visible,
.component:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Enhanced Layout View Styles */
.physical-component {
    transition: all 0.2s ease;
}

.physical-component:hover {
    filter: brightness(1.1);
    stroke-width: 3;
}

.physical-component.highlighted {
    filter: drop-shadow(0 0 8px var(--color-highlight));
    stroke: var(--color-highlight);
    stroke-width: 4;
}

.terminal-strip {
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-strip:hover {
    filter: brightness(1.1);
}

.wire-hot,
.wire-ground,
.wire-power,
.wire-filament {
    transition: all 0.2s ease;
    cursor: pointer;
}

.wire-hot:hover,
.wire-ground:hover,
.wire-power:hover,
.wire-filament:hover {
    stroke-width: 5;
    opacity: 0.8;
}

.wire-hot.highlighted,
.wire-ground.highlighted,
.wire-power.highlighted,
.wire-filament.highlighted {
    stroke-width: 6;
    filter: drop-shadow(0 0 4px currentColor);
}

/* Safety warning styles */
.safety-warning {
    background-color: #fef2f2;
    border: 2px solid #dc2626;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin: var(--spacing-sm) 0;
    color: #991b1b;
    font-weight: 600;
}

/* Animation View Enhanced Styles */
.stage-box.active {
    animation: stage-pulse 2s ease-in-out infinite;
}

@keyframes stage-pulse {
    0%, 100% { 
        fill: rgba(251, 191, 36, 0.2);
        stroke: #f59e0b;
    }
    50% { 
        fill: rgba(251, 191, 36, 0.4);
        stroke: #d97706;
    }
}

.math-display.highlighted {
    animation: text-highlight 1s ease-in-out;
}

@keyframes text-highlight {
    0%, 100% { 
        fill: #059669;
        font-weight: 700;
    }
    50% { 
        fill: #10b981;
        font-weight: 900;
    }
}

/* Volume indicators */
.volume-bar {
    transition: width 0.5s ease;
}

/* Animation Control buttons */
.control-btn {
    transition: all 0.2s ease;
    cursor: pointer;
    fill: #2563eb;
    stroke: #1e40af;
    stroke-width: 2;
}

.control-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    fill: #1d4ed8;
}

.control-btn:active {
    transform: translateY(0);
    fill: #1e40af;
}

.control-text {
    fill: white;
    font: 14px sans-serif;
    font-weight: 600;
    text-anchor: middle;
    cursor: pointer;
    pointer-events: none; /* Let clicks go through to the button */
}

/* Animation controls container */
#animationControls {
    opacity: 1;
    z-index: 100;
}

/* Speed button highlighting */
.control-btn.active {
    fill: #059669;
    stroke: #047857;
}

/* Improved spacing for layout elements */
.layout-component-group {
    margin: var(--spacing-md);
}

.terminal-connection {
    stroke-dasharray: 2,2;
    animation: terminal-flow 3s linear infinite;
}

@keyframes terminal-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 20; }
}

/* Component panel improvements */
.component-panel {
    min-width: 320px;
    max-width: 400px;
}

.component-panel__content {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.component-spec {
    background-color: var(--color-light);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    margin: var(--spacing-xs) 0;
    border-left: 4px solid var(--color-secondary);
}

.component-spec strong {
    color: var(--color-secondary);
}

/* Enhanced tooltip */
.tooltip {
    max-width: 300px;
    white-space: normal;
    line-height: 1.4;
}

/* Frequency response chart */
#frequencyResponse {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

#frequencyResponse:hover {
    opacity: 1;
}

/* Frequency response curves */
#frequencyCurves path {
    transition: opacity 0.5s ease-in-out, stroke-width 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

#frequencyCurves path:hover {
    stroke-width: 4;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Stage information styling */
.stage-note {
    font-style: italic;
    color: var(--color-secondary);
    font-size: 0.9em;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-xs);
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-secondary);
}

/* Formula section styling */
.formula-section {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background-color: rgba(16, 185, 129, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.formula-section h5 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-xs);
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.formula-display {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    color: var(--color-text);
    background-color: rgba(255, 255, 255, 0.8);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-secondary);
}

.formula-display br {
    margin-bottom: var(--spacing-xs);
}

/* Stage indicator */
#stageIndicator {
    font-weight: 600;
    font-size: 16px;
}

/* Enhanced signal particle animations */
.signal-particle {
    transition: all 0.2s ease;
    filter: drop-shadow(0 0 4px #fbbf24);
    animation: particle-glow 2s ease-in-out infinite;
}

@keyframes particle-glow {
    0%, 100% { 
        filter: drop-shadow(0 0 4px #fbbf24);
        opacity: 0.9;
    }
    50% { 
        filter: drop-shadow(0 0 8px #fbbf24);
        opacity: 1;
    }
}

/* Stage particle for step-through animation */
.stage-particle {
    filter: drop-shadow(0 0 6px #059669);
    transition: all 0.5s ease;
}

/* Math display enhancements */
.signal-math {
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.signal-math.highlighted {
    font-weight: 700;
    fill: #059669;
    text-shadow: 1px 1px 3px rgba(5, 150, 105, 0.3);
}

/* Enhanced responsive design */
@media (max-width: 1024px) {
    .component-panel {
        min-width: 280px;
        max-width: 320px;
    }
    
    .diagram-container {
        touch-action: pinch-zoom;
    }
}

@media (max-width: 768px) {
    .layout-component-group {
        margin: var(--spacing-sm);
    }
    
    .control-btn {
        min-height: 44px; /* Touch-friendly size */
    }
    
    .terminal-strip {
        stroke-width: 2; /* Easier to tap */
    }
    
    .physical-component {
        stroke-width: 3; /* Easier to tap */
    }
}

/* Thin wire connections (realistic component leads) */
.thin-wire {
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s ease;
    cursor: pointer;
    opacity: 0.8;
}

.thin-wire:hover {
    stroke-width: 2;
    opacity: 1;
    filter: brightness(1.2);
}

.thin-wire.highlighted {
    stroke-width: 2;
    opacity: 1;
    filter: drop-shadow(0 0 3px currentColor);
    animation: thin-wire-glow 2s ease-in-out infinite;
}

@keyframes thin-wire-glow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Legacy component lead styling (remove thick leads) */
.component-lead {
    stroke-linecap: round;
    transition: all 0.2s ease;
    stroke-width: 1;
    opacity: 0.6;
}

.component-lead:hover {
    stroke-width: 2;
    opacity: 1;
    filter: brightness(1.2);
}

/* New Circuit Layout Styles */
.layout-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--spacing-lg);
    height: 100%;
}

.layout-diagram {
    width: 100%;
    height: 100%;
    background-color: var(--color-light);
    border-radius: var(--radius-md);
}

.section-label {
    font-size: 14px;
    font-weight: 600;
    fill: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.component {
    cursor: pointer;
    transition: filter 0.2s ease, opacity 0.2s ease, stroke-width 0.2s ease;
}

.component:hover {
    filter: brightness(1.1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
    opacity: 0.95;
}

.component.selected {
    filter: drop-shadow(0 0 8px var(--color-secondary));
}

.component-label {
    font-size: 12px;
    font-weight: 500;
    fill: var(--color-text);
}

.terminal-lug {
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-lug:hover {
    r: 7;
    fill: var(--color-secondary);
}

.wire {
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s ease;
    cursor: pointer;
}

.wire:hover {
    stroke-width: 3;
    filter: drop-shadow(0 0 4px currentColor);
}

.signal-wire {
    stroke: #dc2626;
}

.ground-wire {
    stroke: #16a34a;
}

.power-wire {
    stroke: #2563eb;
}

.layout-info-panel {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    min-height: 300px;
    overflow-y: auto;
}

.layout-info-panel h3 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-md);
}

.layout-info-panel p {
    color: var(--color-text);
    line-height: 1.6;
}

/* Animation Container Styles */
.animation-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    gap: var(--spacing-lg);
    height: 100%;
    padding: var(--spacing-lg);
}

.animation-controls {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    background: var(--color-surface);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.control-button,
.speed-button {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--color-secondary);
    background: var(--color-secondary);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-button:hover,
.speed-button:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.speed-button {
    background: transparent;
    color: var(--color-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
}

.speed-button.active {
    background: var(--color-secondary);
    color: white;
}

.speed-controls {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    margin-left: var(--spacing-md);
}

.speed-controls label {
    font-weight: 600;
    color: var(--color-text);
}

.stage-indicator {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    margin-left: auto;
    font-weight: 600;
}

.stage-indicator label {
    color: var(--color-text-muted);
}

#currentStage {
    color: var(--color-secondary);
    font-size: var(--font-size-lg);
}

.signal-flow-display {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    cursor: grab;
    position: relative;
}

.signal-flow-display:active {
    cursor: grabbing;
}

/* Animation zoom controls */
.zoom-controls {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.zoom-controls label {
    font-weight: 600;
    color: var(--color-text);
    margin-right: var(--spacing-xs);
}

.zoom-button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
    border: 2px solid var(--color-secondary);
    background: var(--color-secondary);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-button:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#signalFlowDiagram {
    width: 100%;
    height: 100%;
    display: block;
}

.animation-info-panel {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
}

.animation-info-panel h3 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-md);
}

.animation-info-panel p {
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
}

/* Signal flow SVG styles */
.stage-label {
    font-size: 16px;
    font-weight: 600;
    fill: var(--color-text);
}

.component-label {
    font-size: 12px;
    fill: var(--color-text);
}

.tube-label {
    font-size: 14px;
    font-weight: 600;
    fill: white;
}

.math-display {
    font-size: 14px;
    font-weight: 600;
    fill: var(--color-secondary);
}

.wave-label {
    font-size: 11px;
    fill: var(--color-text-muted);
}

.signal-stage {
    transition: all 0.3s ease;
}

.signal-stage.active rect {
    stroke-width: 3;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.signal-path {
    stroke-dasharray: 5, 5;
    stroke-dashoffset: 0;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.signal-path.active {
    opacity: 1;
    stroke-width: 4;
    animation: signal-flow-dash 1s linear infinite;
}

@keyframes signal-flow-dash {
    0% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -10;
    }
}

/* Animated particle styles */
.signal-particle {
    fill: var(--color-highlight);
    filter: drop-shadow(0 0 6px var(--color-highlight));
}

/* Waveform animation */
.waveform-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-wave 2s ease-out forwards;
}

@keyframes draw-wave {
    to {
        stroke-dashoffset: 0;
    }
}

/* Responsive Design for Tabs */
@media (max-width: 768px) {
    .tab-navigation {
        padding: 4px;
        margin-bottom: var(--spacing-md);
    }
    
    .tab-btn {
        padding: 12px 16px;
    }
    
    .tab-icon {
        width: 20px;
        height: 20px;
    }
    
    .tab-label {
        font-size: 0.875rem;
    }
    
    .tab-description {
        display: none;
    }
}

@media (max-width: 480px) {
    .tab-navigation {
        gap: 0;
        background-color: transparent;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        border-bottom: 2px solid #e2e8f0;
    }
    
    .tab-indicator {
        display: none;
    }
    
    .tab-btn {
        flex-direction: row;
        gap: 8px;
        padding: 12px;
        border-radius: 0;
    }
    
    .tab-btn.active {
        border-bottom: 3px solid var(--color-secondary);
        background-color: transparent;
    }
    
    .tab-icon {
        width: 18px;
        height: 18px;
    }
}

/* Tab transition animations */
.diagram-view {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.diagram-view.active {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced tab button animations */
.tab-btn {
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.tab-btn:active::before {
    width: 200px;
    height: 200px;
}