/* ===== COSMIC MODULE (OSCILLATOR STACK) - INDEPENDENT CSS ===== */

/* Components container */
.component-container {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* ===== AUTO-ROTATING KNOB (Base Pitch) ===== */
.csmc-knob-container {
    width: 140px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-size: contain;
    position: relative;
}

.csmc-knob-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 10px;
}

.csmc-knob {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #111;
    position: relative;
    margin: 1px 0 4px 0;
    transform: rotate(-130deg);
    transition: transform 0.1s ease-out;
    border: 2px solid #00E897; /* Green border for COSMIC theme */
    cursor: pointer; /* Enable manual interaction when no CV */
}

/* CV mode - disable manual interaction */
.csmc-knob.cv-mode {
    pointer-events: none;
    border-color: #FF6600; /* Orange border for CV automation */
}

.csmc-knob .csmc-knob-dot {
    width: 8px;
    height: 8px;
    background: #00E897; /* Green dot for COSMIC */
    border-radius: 50%;
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
}

/* CV mode dot */
.csmc-knob.cv-mode .csmc-knob-dot {
    background: #FF6600; /* Orange dot for CV automation */
}

/* Value display in knob center */
.csmc-knob-value-display {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #00E897; /* Green for manual mode */
    pointer-events: none;
    user-select: none;
}

/* CV mode value display */
.csmc-knob.cv-mode + .csmc-knob-value-display {
    color: #FF6600; /* Orange for CV automation */
}

/* Labels row under knob */
.csmc-labels-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-family: Arial, sans-serif;
    font-weight: bold;
}

.csmc-label-title {
    font-size: 14px;
    color: #00E897; /* Green for manual mode */
    padding: 0 10px;
    margin-bottom: 0px;
    text-align: center;
    flex: 1;
}

/* CV mode title */
.csmc-knob.cv-mode ~ .csmc-labels-row .csmc-label-title {
    color: #FF6600; /* Orange for CV automation */
}

.csmc-label-min,
.csmc-label-max {
    width: 40px;
    font-size: 10px;
    text-align: center;
    color: #999;
}

.csmc-component {
    margin-bottom: 5px;
}

.csmc-component label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 12px;
}

/* Space Divider */
.csmc-space {
    height: 10px; /* Adjust gap size */
    width: 100%;
}

/* Slider Pot Container */
.csmc-slider-pot {
    display: flex;
    flex-direction: column;
}

/* Header row: title left, value right */
.csmc-slider-pot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.csmc-slider-pot-header label {
    font-size: 12px;
    font-weight: bold;
    color: #999;
    margin: 0;
}

.csmc-slider-pot-header .csmc-value-display {
    font-size: 12px;
    color: #00E897; 
    font-family: monospace;
}

/* Slider track and thumb styling */
.csmc-slider-pot input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #ccc;
    border-radius: 3px;
    outline: none;
    margin: 0;
}

/* Webkit browsers track */
.csmc-slider-pot input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #111;
    border-radius: 3px;
}

/* Webkit browsers thumb */
.csmc-slider-pot input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00E897;
    border: 2px solid #00E897;
    cursor: pointer;
    margin-top: -4px;
    transition: background 0.2s;
}

.csmc-slider-pot input[type="range"]::-webkit-slider-thumb:hover {
    background: #555;
}

/* Firefox track */
.csmc-slider-pot input[type="range"]::-moz-range-track {
    height: 6px;
    background: #ccc;
    border-radius: 3px;
}

/* Firefox fill before thumb */
.csmc-slider-pot input[type="range"]::-moz-range-progress {
    background: #007bff;
    height: 6px;
    border-radius: 3px;
}

/* Firefox thumb */
.csmc-slider-pot input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.csmc-slider-pot input[type="range"]::-moz-range-thumb:hover {
    background: #555;
}

/* Dropdown container */
.csmc-dropdown {
    display: flex;
    flex-direction: column;
}

/* Dropdown label (title) */
.csmc-dropdown label {
    color: #999;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Dropdown select styling */
.csmc-dropdown select {
    width: 100%;
    padding: 5px;
    border: 1px solid #222;
    border-radius: 4px;
    background-color: #111;
    font-size: 12px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Toggle Button (Start/Stop combined) */
.csmc-btn.csmc-toggle-btn {
    width: 50%;
    padding: 5px 0;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    background: #444;
    color: white;
    transition: all 0.3s ease;
}

/* ===== OUTPUT SIGNAL INDICATOR ===== */
.output-signal.pulse {
    box-shadow: 0 0 8px #0f0, 0 0 16px #0f0;
    transform: scale(1.2);
    background: #0f0 !important;
}

/* Output signal pulse animation */
@keyframes outputSignalPulse {
    0% {
        box-shadow: 0 0 6px #0f0;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 12px #0f0, 0 0 24px #0f0;
        transform: scale(1.3);
    }
    100% {
        box-shadow: 0 0 6px #0f0;
        transform: scale(1);
    }
}

.csmc-btn.csmc-toggle-btn:hover {
    background: #555;
    border-color: #666;
}

.csmc-btn.csmc-toggle-btn.active {
    background: #04BACC;
    border-color: #04BACC;
    color: #111;
    box-shadow: 0 0 8px rgba(4, 186, 204, 0.4);
}

.csmc-btn.csmc-toggle-btn.active:hover {
    background: #03A5B5;
    border-color: #03A5B5;
}

/* Legacy button styles (keep for compatibility) */
.csmc-btn.csmc-start-btn {
    width: 100%;
    padding: 5px 0;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: #444;
    color: white;
}

.csmc-btn.csmc-start-btn:hover {
    background: #555;
}

.csmc-btn.csmc-start-btn.active {
    background: #04BACC;
    border: 1px solid #111;
}

/* Buttons Stop */
.csmc-btn.csmc-stop-btn {
    width: 100%;
    padding: 5px 0;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: #333;
    color: #eee;
}

.csmc-btn.csmc-stop-btn:hover {
    background: #555;
}

.csmc-btn.csmc-stop-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/*======================== CV INPUTS ===================*/
.csmc-cv-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    height: 25px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #111;
    font-size: 12px;
    color: #999;
}

.csmc-cv-field input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 12px;
    color: #ccc;
    width: 100%;
    font-weight: bold;
}

.csmc-cv-field input::placeholder {
    color: #666;
    font-weight: normal;
}

/* Connection indicator dot */
.csmc-cv-connection-indicator {
    width: 10px;
    height: 10px;
    background: gray;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 6px;
}

.csmc-cv-connection-indicator.connected {
    background: #06F838; /* bright green for valid connection */
    box-shadow: 0 0 4px rgba(6, 248, 56, 0.6);
}

.csmc-cv-connection-indicator.invalid {
    background: red;
    box-shadow: 0 0 4px rgba(255, 0, 0, 0.6);
}