/* FIR Filter Visualization Simulation - CSS */

.fir-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    font-family: 'Courier New', monospace;
    background-color: #0a0a0a;
    color: #ffffff;
    border-radius: 8px;
}

/* ===== Control Panel ===== */
.control-panel {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.section-label {
    color: #00ffff;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #444444;
    padding-bottom: 10px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    color: #cccccc;
    font-size: 12px;
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}

.control-row input[type="range"] {
    flex: 1;
    min-width: 100px;
    max-width: 200px;
    height: 6px;
    background: #333333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.control-row input[type="range"]::-webkit-slider-thumb:hover {
    background: #00ffff;
    box-shadow: 0 0 8px #00ffff;
    transform: scale(1.1);
}

.control-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-row span {
    color: #00ff00;
    font-size: 12px;
    min-width: 60px;
    text-align: left;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.control-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00ff00;
}

.control-row select {
    background-color: #1a1a1a;
    color: #00ff00;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    min-width: 140px;
}

.control-row select:hover {
    background-color: #222222;
    border-color: #666666;
}

.control-row select:focus {
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.control-row select option {
    background-color: #1a1a1a;
    color: #00ff00;
    padding: 8px;
}

/* ===== Buttons ===== */
.control-row button {
    background-color: #002233;
    color: #00ffff;
    border: 1px solid #00ffff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.control-row button:hover {
    background-color: #00ffff;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
}

.control-row button:active {
    transform: scale(0.95);
}

.preset-btn {
    background-color: #1a1a1a !important;
    border-color: #666666 !important;
    color: #cccccc !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
}

.preset-btn:hover {
    background-color: #333333 !important;
    border-color: #00ff00 !important;
    color: #00ff00 !important;
}

.preset-btn.active {
    background-color: #003300 !important;
    border-color: #00ff00 !important;
    color: #00ff00 !important;
}

/* ===== Preset Dropdown Selects ===== */
.preset-select {
    background-color: #1a1a1a;
    border: 1px solid #666666;
    border-radius: 4px;
    color: #00ffff;
    padding: 6px 10px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    min-width: 140px;
    outline: none;
}

.preset-select:hover {
    border-color: #00ffff;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.preset-select:focus {
    border-color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.preset-select option {
    background-color: #1a1a1a;
    color: #cccccc;
    padding: 8px;
}

.preset-select option:checked {
    background-color: #003333;
    color: #00ffff;
}

/* ===== Coefficient Editor ===== */
.coefficient-section {
    background-color: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.coefficient-section h3 {
    color: #ff6666;
    font-size: 14px;
    margin: 0 0 10px 0;
    text-align: center;
}

#coefficient-container {
    position: relative;
    width: 100%;
    height: 150px;
    background-color: #1a1a1a;
    border: 1px solid #444444;
    border-radius: 4px;
    cursor: crosshair;
}

.coeff-bar {
    position: absolute;
    bottom: 50%;
    width: 20px;
    background: linear-gradient(to top, #ff4444, #ff8888);
    border: 1px solid #ff6666;
    border-radius: 2px 2px 0 0;
    cursor: ns-resize;
    transition: background 0.1s;
}

.coeff-bar:hover {
    background: linear-gradient(to top, #ff6666, #ffaaaa);
    box-shadow: 0 0 8px rgba(255, 100, 100, 0.5);
}

.coeff-bar.negative {
    border-radius: 0 0 2px 2px;
    background: linear-gradient(to bottom, #ff4444, #ff8888);
    top: 50%;
    bottom: auto;
}

.coeff-label {
    position: absolute;
    bottom: 5px;
    font-size: 9px;
    color: #888888;
    text-align: center;
    pointer-events: none;
}

/* Zero line in coefficient display */
.zero-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #555555;
    pointer-events: none;
}

/* ===== Visualization Canvases ===== */
.visualization-section {
    background-color: #000000;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
}

.canvas-wrapper {
    margin-bottom: 10px;
}

.canvas-wrapper:last-child {
    margin-bottom: 0;
}

.canvas-label {
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    padding-left: 5px;
}

.canvas-label.input-label {
    color: #4488ff;
}

.canvas-label.output-label {
    color: #44ff88;
}

.canvas-label.freq-label {
    color: #ffff44;
}

.canvas-label.zplane-label {
    color: #ff88ff;
}

/* ===== Frequency Domain Split Layout ===== */
.freq-section {
    padding: 10px;
}

.freq-split-container {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.freq-plot-wrapper {
    flex: 3;
    min-width: 0;
}

.zplane-plot-wrapper {
    flex: 1;
    min-width: 0;
}

/* Frequency canvas container for toggle button positioning */
.freq-canvas-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

#canvas-freq {
    width: 100%;
    height: 160px;
}

/* Scale toggle button on frequency plot */
.scale-toggle-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 50, 50, 0.85);
    border: 1px solid #00ffff;
    border-radius: 3px;
    color: #00ffff;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    padding: 3px 8px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.scale-toggle-btn:hover {
    background-color: rgba(0, 100, 100, 0.9);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.scale-toggle-btn.active {
    background-color: rgba(0, 80, 0, 0.85);
    border-color: #00ff00;
    color: #00ff00;
}

.scale-toggle-btn.active:hover {
    background-color: rgba(0, 120, 0, 0.9);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

#canvas-zplane {
    width: 100%;
    height: 160px;
    cursor: crosshair;
}

canvas {
    display: block;
    background-color: #0a0a0a;
    border: 1px solid #333333;
    border-radius: 2px;
}

/* ===== Convolution Animation Overlay ===== */
.convolution-overlay {
    position: relative;
}

.kernel-window {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: rgba(255, 100, 100, 0.2);
    border: 2px solid #ff6666;
    border-radius: 4px;
    pointer-events: none;
    transition: left 0.05s linear;
}

/* ===== Info Panel ===== */
.info-display {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.info-display h3 {
    color: #00ffff;
    font-size: 14px;
    margin-top: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #444444;
    padding-bottom: 8px;
}

.info-display .info-row {
    display: flex;
    justify-content: space-between;
    color: #cccccc;
    font-size: 12px;
    margin-bottom: 6px;
    font-family: 'Courier New', monospace;
}

.info-display .info-row:last-child {
    margin-bottom: 0;
}

.info-display .info-label {
    color: #888888;
}

.info-display .info-value {
    color: #00ff00;
    font-weight: bold;
}

/* ===== Math Display ===== */
.equation-display {
    background-color: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 4px;
    padding: 12px;
    margin: 10px 0;
    text-align: center;
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    color: #ffffff;
}

.equation-display .math {
    color: #ffff88;
}

/* ===== Status Indicators ===== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #1a1a1a;
    border-radius: 4px;
    margin-top: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888888;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #444444;
}

.status-dot.active {
    background-color: #00ff00;
    box-shadow: 0 0 6px #00ff00;
}

.status-dot.processing {
    background-color: #ffff00;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Convolution Step Highlight ===== */
.mac-highlight {
    position: absolute;
    background-color: rgba(255, 255, 0, 0.3);
    border: 2px solid #ffff00;
    border-radius: 4px;
    pointer-events: none;
    animation: flash 0.3s ease-in-out;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== Tooltips ===== */
.tooltip {
    position: absolute;
    background-color: #222222;
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #222222;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .fir-container {
        padding: 8px;
    }
    
    .control-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-row label {
        text-align: left;
        min-width: auto;
    }
    
    .control-row button {
        width: 100%;
    }
    
    #coefficient-container {
        height: 120px;
    }
}

/* ===== Legend ===== */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px;
    background-color: #111111;
    border-radius: 4px;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #cccccc;
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.input {
    background-color: #4488ff;
}

.legend-color.kernel {
    background-color: #ff6666;
}

.legend-color.output {
    background-color: #44ff88;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ffff;
}
