/* Tone Generator Styles */

.tone-generator {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Controls Section */
.controls-section {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.control-group {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.control-group h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

/* Frequency Controls */
.frequency-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.frequency-input {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.frequency-input label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

#frequencySlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#frequencySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

#frequencySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

#frequencyInput {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    font-family: monospace;
}

.frequency-presets {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.preset-btn {
    padding: 10px 8px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.preset-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
}

.preset-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Waveform Controls */
.waveform-controls {
    display: flex;
    justify-content: center;
}

.waveform-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 600px;
}

.waveform-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.waveform-option:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.waveform-option input[type="radio"] {
    display: none;
}

.waveform-option input[type="radio"]:checked + .waveform-visual {
    border-color: #007bff;
    background: #007bff;
}

.waveform-option input[type="radio"]:checked ~ .waveform-label {
    color: #007bff;
    font-weight: 600;
}

.waveform-visual {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.waveform-visual::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #666;
    transform: translateY(-50%);
}

.waveform-visual.sine::before {
    background: linear-gradient(90deg, 
        transparent 0%, #666 10%, transparent 20%,
        #666 30%, transparent 40%, #666 50%,
        transparent 60%, #666 70%, transparent 80%,
        #666 90%, transparent 100%);
    height: 20px;
    border-radius: 10px;
}

.waveform-visual.square::before {
    background: repeating-linear-gradient(90deg,
        #666 0%, #666 25%, transparent 25%, transparent 50%,
        #666 50%, #666 75%, transparent 75%, transparent 100%);
    height: 20px;
}

.waveform-visual.sawtooth::before {
    background: repeating-linear-gradient(45deg,
        #666 0%, transparent 50%);
    height: 20px;
}

.waveform-visual.triangle::before {
    background: repeating-linear-gradient(90deg,
        transparent 0%, #666 25%, transparent 50%,
        #666 75%, transparent 100%);
    height: 20px;
    clip-path: polygon(0 100%, 25% 0%, 50% 100%, 75% 0%, 100% 100%);
}

.waveform-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

/* Volume and Duration Controls */
.volume-duration-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.volume-control,
.duration-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.volume-control label,
.duration-control label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

#volumeSlider,
#durationSlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#volumeSlider::-webkit-slider-thumb,
#durationSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #28a745;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

#volumeSlider::-moz-range-thumb,
#durationSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #28a745;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

#volumeValue,
#durationValue {
    font-family: monospace;
    font-weight: 600;
    color: #333;
    text-align: center;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Playback Controls */
.playback-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.playback-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.playback-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.play-btn,
.stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 16px;
    min-width: 120px;
}

.play-btn {
    background: #28a745;
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.play-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.play-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.stop-btn {
    background: #dc3545;
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.stop-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.stop-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 18px;
}

.btn-text {
    font-size: 14px;
}

/* Status Display */
.status-display {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.status-text {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.status-text.playing {
    color: #28a745;
    font-weight: 600;
}

.status-text.stopped {
    color: #dc3545;
    font-weight: 600;
}

/* Visualizer Section */
.visualizer-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.visualizer-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

.visualizer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.visualizer-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.visualizer-placeholder {
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Info Section */
.info-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
}

.info-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.info-section p {
    margin: 0 0 10px 0;
    color: #666;
    line-height: 1.6;
}

.info-section ul {
    margin: 10px 0;
    padding-left: 20px;
    color: #666;
}

.info-section li {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tone-generator {
        padding: 15px;
    }
    
    .control-group,
    .playback-section,
    .visualizer-section,
    .info-section {
        padding: 20px;
    }
    
    .frequency-presets {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .preset-btn {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .waveform-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .volume-duration-controls {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .playback-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .play-btn,
    .stop-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .slider-container {
        flex-direction: column;
        gap: 10px;
    }
    
    #frequencyInput {
        width: 100%;
    }
    
    .frequency-presets {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .waveform-options {
        grid-template-columns: 1fr;
    }
    
    .waveform-option {
        flex-direction: row;
        justify-content: flex-start;
        padding: 15px;
    }
    
    .waveform-visual {
        width: 40px;
        height: 30px;
    }
}