/**
 * SyncSim – OFDM Time-Frequency Synchronization Visualization
 * Local-scoped styles. Simulation max-width: 800px. Courier New, dark theme.
 */

#syncsim-root {
    font-family: 'Courier New', monospace;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    background-color: #000000;
    color: #00ff00;
    border: 1px solid #333333;
    border-radius: 4px;
    box-sizing: border-box;
}

#syncsim-root * {
    box-sizing: border-box;
}

/* Control Panel – CSS Grid */
.syncsim-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

#syncsim-root .syncsim-setup-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #00ffaa;
    opacity: 0.9;
}

#syncsim-root .syncsim-setup-row .syncsim-setup-item {
    font-family: 'Courier New', monospace;
}

#syncsim-root .syncsim-presets-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

#syncsim-root .syncsim-presets-row label {
    min-width: auto;
    color: #00ffff;
    font-size: 12px;
    margin: 0;
}

#syncsim-root .syncsim-sliders {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.syncsim-control-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

#syncsim-root .syncsim-control-row label {
    min-width: 100px;
    color: #00ffff;
    font-size: 12px;
}

/* Spin box wrapper */
#syncsim-root .syncsim-spin-wrapper {
    position: relative;
    display: inline-block;
}

/* Number input (spin box) styling */
#syncsim-root .syncsim-control-row input[type="number"] {
    width: 100px;
    padding: 4px 28px 4px 8px;
    background: #1a1a1a;
    border: 1px solid #444444;
    border-radius: 3px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    text-align: left;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Hide default spin buttons */
#syncsim-root .syncsim-control-row input[type="number"]::-webkit-outer-spin-button,
#syncsim-root .syncsim-control-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#syncsim-root .syncsim-control-row input[type="number"]:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 4px rgba(0, 255, 255, 0.3);
}

#syncsim-root .syncsim-control-row .syncsim-val {
    min-width: 48px;
    color: #00ff00;
    font-size: 12px;
}

#syncsim-root .syncsim-control-with-unit {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

#syncsim-root .unit-readout {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #00ffaa;
    margin: 0;
    opacity: 0.85;
    white-space: nowrap;
}

/* Custom spin buttons container */
#syncsim-root .syncsim-spin-buttons {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1px;
    pointer-events: none;
}

/* Custom spin button styling - well blended with dark background */
#syncsim-root .syncsim-spin-up,
#syncsim-root .syncsim-spin-down {
    width: 18px;
    height: 11px;
    padding: 0;
    margin: 0;
    background: #2a2a2a;
    border: 1px solid #444444;
    border-radius: 2px;
    color: #666666;
    font-size: 8px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#syncsim-root .syncsim-spin-up:hover,
#syncsim-root .syncsim-spin-down:hover {
    background: #3a3a3a;
    border-color: #555555;
    color: #00ffff;
}

#syncsim-root .syncsim-spin-up:active,
#syncsim-root .syncsim-spin-down:active {
    background: #1a1a1a;
    border-color: #00ffff;
    color: #00ff00;
}

/* Presets & Toggles */
#syncsim-root .syncsim-presets-row select {
    background: #1a1a1a;
    color: #00ffff;
    border: 1px solid #444444;
    border-radius: 3px;
    padding: 6px 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
}

#syncsim-root .syncsim-presets-row select:hover {
    border-color: #00ffff;
}

#syncsim-root .syncsim-presets-row select option {
    background: #0a0a0a;
    color: #00ff00;
}

.syncsim-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

#syncsim-root .syncsim-toggle-row label {
    color: #00ffff;
    font-size: 12px;
}

/* Correction mode: Auto / Manual */
#syncsim-root .syncsim-correction-mode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

#syncsim-root .syncsim-correction-mode-row > label {
    min-width: 100px;
    color: #00ffff;
    font-size: 12px;
}

#syncsim-root .syncsim-radio-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

#syncsim-root .syncsim-radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #00ffaa;
    min-width: auto;
}

#syncsim-root .syncsim-radio-option input[type="radio"] {
    accent-color: #00ffff;
    cursor: pointer;
}

#syncsim-root .syncsim-radio-option:hover {
    color: #00ffff;
}

/* Strength row: disabled when Auto */
#syncsim-root .syncsim-strength-row.disabled {
    opacity: 0.5;
    pointer-events: none;
}

#syncsim-root .syncsim-strength-row.disabled input,
#syncsim-root .syncsim-strength-row.disabled .syncsim-spin-up,
#syncsim-root .syncsim-strength-row.disabled .syncsim-spin-down {
    cursor: not-allowed;
}

/* Animation controls */
.syncsim-anim-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

#syncsim-root .syncsim-anim-row label {
    color: #00ffff;
    font-size: 12px;
    min-width: 60px;
}

.syncsim-step-btn,
.syncsim-play-btn {
    background: #1a1a1a;
    color: #00ffff;
    border: 1px solid #444444;
    border-radius: 3px;
    padding: 4px 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
}

#syncsim-root .syncsim-step-btn:hover,
#syncsim-root .syncsim-play-btn:hover {
    border-color: #00ffff;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.3);
}

#syncsim-root .syncsim-play-btn {
    color: #00ff00;
}

/* Canvas layout */
.syncsim-canvases {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#syncsim-root .syncsim-time-section {
    border: 1px solid #444444;
    border-radius: 4px;
    overflow: hidden;
    background: #050505;
}

#syncsim-root .syncsim-time-section .syncsim-label {
    padding: 4px 8px;
    font-size: 11px;
    color: #00aaff;
    background: #0a0a0a;
    border-bottom: 1px solid #333333;
}

#syncsim-root .syncsim-time-canvas-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

#syncsim-root .syncsim-time-section canvas {
    display: block;
    width: 100%;
    max-width: 800px;
    height: 120px;
    background: #000000;
}

/* Zoom controls overlay on time domain plot */
#syncsim-root .syncsim-time-zoom-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}

#syncsim-root .syncsim-zoom-btn {
    width: 32px;
    height: 20px;
    padding: 0;
    margin: 0;
    background: #2a2a2a;
    border: 1px solid #555555;
    border-radius: 2px;
    color: #888888;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#syncsim-root .syncsim-zoom-btn:hover {
    background: #3a3a3a;
    border-color: #00ffff;
    color: #00ffff;
}

#syncsim-root .syncsim-zoom-btn:active {
    background: #1a1a1a;
    border-color: #00ff00;
    color: #00ff00;
}

#syncsim-root .syncsim-freq-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

#syncsim-root .syncsim-freq-mag-section,
#syncsim-root .syncsim-freq-phase-section {
    border: 1px solid #444444;
    border-radius: 4px;
    overflow: hidden;
    background: #050505;
}

#syncsim-root .syncsim-freq-mag-section .syncsim-label,
#syncsim-root .syncsim-freq-phase-section .syncsim-label {
    padding: 4px 8px;
    font-size: 11px;
    color: #00aaff;
    background: #0a0a0a;
    border-bottom: 1px solid #333333;
}

#syncsim-root .syncsim-freq-mag-section canvas,
#syncsim-root .syncsim-freq-phase-section canvas {
    display: block;
    width: 100%;
    height: 160px;
    background: #000000;
}

#syncsim-root .syncsim-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

#syncsim-root .syncsim-constellation-section,
#syncsim-root .syncsim-phase-section {
    border: 1px solid #444444;
    border-radius: 4px;
    overflow: hidden;
    background: #050505;
}

#syncsim-root .syncsim-constellation-section .syncsim-label,
#syncsim-root .syncsim-phase-section .syncsim-label {
    padding: 4px 8px;
    font-size: 11px;
    color: #00aaff;
    background: #0a0a0a;
    border-bottom: 1px solid #333333;
}

#syncsim-root .syncsim-constellation-section canvas,
#syncsim-root .syncsim-phase-section canvas {
    display: block;
    width: 100%;
    height: 200px;
    background: #000000;
}

/* History trail toggle */
#syncsim-root .syncsim-ghost-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

#syncsim-root .syncsim-ghost-row label {
    color: #00ffff;
    font-size: 12px;
}
