/* Metronome Specific Styles */

.metronome-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

/* BPM Display */
.bpm-display {
    text-align: center;
    margin: 2rem 0;
}

.bpm-value {
    font-size: clamp(4rem, 10vw, 6rem);
    font-weight: 800;
    color: var(--primary-color, #4FC3F7);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
    text-shadow: 0 0 20px rgba(79, 195, 247, 0.3);
}

.bpm-label {
    font-size: 1.2rem;
    color: var(--text-secondary, #999);
    font-weight: 600;
    margin-top: 0.5rem;
    letter-spacing: 2px;
}

/* Visualization Toggle */
.visualization-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.viz-toggle-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 12px;
    color: var(--text-secondary, #999);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viz-toggle-btn:hover {
    border-color: var(--primary-color, #4FC3F7);
    transform: translateY(-2px);
}

.viz-toggle-btn.active {
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    border-color: #4FC3F7;
    color: #fff;
}

.viz-toggle-btn i {
    font-size: 1.1rem;
}

/* Compás Clock */
.compas-clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
    padding: 2rem;
}

#compasCanvas {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.3));
}

.clock-legend {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.accent-color {
    background: rgba(255, 107, 107, 0.6);
    border: 2px solid #FF6B6B;
}

.contratiempo-color {
    background: #FFA500;
    border: 2px solid #FFA500;
}

.legend-item span {
    color: var(--text-secondary, #ccc);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Beat Blocks */
.beat-blocks-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    padding: 1rem;
}

.beat-block {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 3px solid #333;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.beat-block:hover {
    border-color: var(--primary-color, #4FC3F7);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(79, 195, 247, 0.3);
}

.beat-block.active {
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    border-color: #4FC3F7;
    box-shadow: 0 0 20px rgba(79, 195, 247, 0.6),
                0 0 40px rgba(79, 195, 247, 0.3);
    transform: scale(1.1);
}

.beat-block.active.accent {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    border-color: #FF6B6B;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6),
                0 0 40px rgba(255, 107, 107, 0.3);
}

.beat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    font-family: 'JetBrains Mono', monospace;
}

.beat-config-icon {
    font-size: 0.7rem;
    color: var(--text-secondary, #999);
    margin-top: 0.2rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.beat-block:hover .beat-config-icon {
    opacity: 1;
}

/* BPM Controls */
.bpm-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.bpm-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    color: var(--text-primary, #fff);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bpm-btn:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    border-color: var(--primary-color, #4FC3F7);
    transform: translateY(-2px);
}

.bpm-btn:active {
    transform: translateY(0);
}

.bpm-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 100%);
    outline: none;
    -webkit-appearance: none;
}

.bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.4);
    transition: all 0.2s ease;
}

.bpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.6);
}

.bpm-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.4);
    transition: all 0.2s ease;
}

.bpm-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.6);
}

/* Time Signature */
.time-signature-section {
    text-align: center;
    margin: 2rem 0;
}

.control-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary, #999);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.time-signature-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.time-sig-input {
    width: 80px;
    padding: 0.8rem;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 12px;
    color: var(--text-primary, #fff);
    text-align: center;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.time-sig-input:hover {
    border-color: var(--primary-color, #4FC3F7);
}

.time-sig-input:focus {
    outline: none;
    border-color: var(--primary-color, #4FC3F7);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.time-sig-input option {
    background: #1a1a1a;
    color: #fff;
}

.time-sig-separator {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color, #4FC3F7);
    font-family: 'JetBrains Mono', monospace;
}

/* Rhythm Preset Section */
.rhythm-preset-section {
    text-align: center;
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(79, 195, 247, 0.05) 0%, rgba(156, 39, 176, 0.05) 100%);
    border: 2px solid rgba(79, 195, 247, 0.2);
    border-radius: 16px;
}

.rhythm-select {
    width: 100%;
    max-width: 400px;
    padding: 0.8rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    color: var(--text-primary, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    margin-top: 0.5rem;
}

.rhythm-select:hover {
    border-color: #5fd3ff;
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
}

.rhythm-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
}

.rhythm-select option {
    background: #1a1a1a;
    color: #fff;
    padding: 0.5rem;
}

.rhythm-select optgroup {
    background: #2a2a2a;
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.control-btn {
    flex: 1;
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.start-btn,
.save-btn {
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    color: #fff;
    border-color: #4FC3F7;
    flex: 1;
    height: 52px;
    min-height: 52px;
    max-height: 52px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    white-space: nowrap;
}

.start-btn:hover,
.save-btn:hover {
    background: linear-gradient(135deg, #5fd3ff 0%, #3fa6ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.4);
}

.start-btn.active {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
    border-color: #FF6B6B;
}

.start-btn.active:hover {
    background: linear-gradient(135deg, #ff7b7b 0%, #ff6a7f 100%);
}

.control-btn:active {
    transform: translateY(0);
}

/* Info Section */
.info-section {
    margin: 3rem 0 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(79, 195, 247, 0.05) 0%, rgba(33, 150, 243, 0.05) 100%);
    border: 2px solid rgba(79, 195, 247, 0.2);
    border-radius: 16px;
}

.info-section h3 {
    color: var(--primary-color, #4FC3F7);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-section li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary, #ccc);
    line-height: 1.6;
}

.info-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color, #4FC3F7);
    font-weight: bold;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #333;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color, #4FC3F7);
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary, #999);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.modal-body {
    padding: 1.5rem;
}

.config-group {
    margin-bottom: 1.5rem;
}

.config-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary, #999);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.config-select {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 2px solid #333;
    border-radius: 12px;
    color: var(--text-primary, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-select:hover {
    border-color: var(--primary-color, #4FC3F7);
}

.config-select:focus {
    outline: none;
    border-color: var(--primary-color, #4FC3F7);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.config-select option {
    background: #1a1a1a;
    color: #fff;
    padding: 0.5rem;
}

.config-select optgroup {
    background: #0a0a0a;
    color: var(--primary-color, #4FC3F7);
    font-weight: bold;
}

.config-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #1a1a1a 0%, #2a2a2a 100%);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 0.5rem;
}

.config-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.4);
    transition: all 0.2s ease;
}

.config-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.config-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.4);
    transition: all 0.2s ease;
}

.config-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.config-value {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 6px;
    color: var(--primary-color, #4FC3F7);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.9rem;
}

.test-sound-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    border: 2px solid #4FC3F7;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.test-sound-btn:hover {
    background: linear-gradient(135deg, #5fd3ff 0%, #3fa6ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.4);
}

.test-sound-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .metronome-content {
        padding: 1rem;
    }

    .bpm-value {
        font-size: 4rem;
    }

    .beat-block {
        width: 70px;
        height: 70px;
    }

    .beat-number {
        font-size: 1.3rem;
    }

    .control-buttons {
        flex-direction: column;
    }

    .control-btn {
        width: 100%;
    }

    .bpm-controls {
        gap: 0.5rem;
    }

    .bpm-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .time-sig-input {
        width: 70px;
        font-size: 1.1rem;
    }

    .info-section {
        padding: 1.5rem;
    }

    .modal-content {
        width: 95%;
    }

    .rhythm-preset-section {
        padding: 1rem;
    }

    .visualization-toggle {
        gap: 0.5rem;
    }

    .viz-toggle-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    #compasCanvas {
        width: 100%;
        max-width: 400px;
    }

    .clock-legend {
        gap: 1rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .bpm-value {
        font-size: 3rem;
    }

    .beat-block {
        width: 60px;
        height: 60px;
    }

    .beat-number {
        font-size: 1.1rem;
    }

    .beat-blocks-container {
        gap: 0.5rem;
    }

    .time-sig-input {
        width: 60px;
        font-size: 1rem;
    }

    .time-sig-separator {
        font-size: 1.5rem;
    }

    .visualization-toggle {
        flex-direction: column;
        gap: 0.5rem;
    }

    .viz-toggle-btn {
        width: 100%;
        justify-content: center;
    }

    #compasCanvas {
        width: 100%;
        max-width: 300px;
    }

    .compas-clock-container {
        padding: 1rem;
    }
}

/* Training Mode Styles */
.training-mode-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.training-toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.training-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.training-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.training-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.training-label i {
    color: var(--accent-blue);
}

.training-controls {
    margin-top: 1rem;
}

.config-training-btn {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.config-training-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

/* Training Modal Styles */
.training-modal-content {
    max-width: 600px;
}

.training-info {
    background: rgba(79, 195, 247, 0.1);
    border-left: 3px solid var(--accent-blue);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.training-info i {
    color: var(--accent-blue);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.training-sequences {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.training-sequence-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-fast);
}

.training-sequence-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
}

.sequence-number {
    background: var(--accent-blue);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sequence-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.sequence-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sequence-input-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sequence-input {
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    transition: var(--transition-fast);
}

.sequence-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.sequence-separator {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 300;
    margin-top: 1.2rem;
}

.remove-sequence-btn {
    background: rgba(255, 107, 107, 0.1);
    color: #FF6B6B;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.remove-sequence-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: #FF6B6B;
}

.add-sequence-btn {
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent-blue);
    border: 2px dashed var(--accent-blue);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    transition: var(--transition-fast);
}

.add-sequence-btn:hover {
    background: rgba(79, 195, 247, 0.2);
    transform: translateY(-2px);
}

.training-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.training-save-btn {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    transition: var(--transition-fast);
}

.training-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.training-clear-btn {
    background: rgba(255, 107, 107, 0.1);
    color: #FF6B6B;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.training-clear-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: #FF6B6B;
}


/* Training Progress Section - Collapsible Container */
.training-progress-section {
    width: 70%;
    margin: 2rem auto 0;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid rgba(79, 195, 247, 0.2);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1200px) {
    .training-progress-section {
        width: 80%;
    }
}

@media (max-width: 992px) {
    .training-progress-section {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .training-progress-section {
        width: 100%;
    }
}

.training-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: rgba(79, 195, 247, 0.05);
    border-bottom: 1px solid rgba(79, 195, 247, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.training-progress-header:hover {
    background: rgba(79, 195, 247, 0.08);
}

.training-progress-header h3 {
    margin: 0;
    color: var(--primary-color, #4FC3F7);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-section-btn {
    background: none;
    border: none;
    color: var(--primary-color, #4FC3F7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.toggle-section-btn:hover {
    background: rgba(79, 195, 247, 0.1);
    transform: scale(1.1);
}

.toggle-section-btn i {
    transition: transform 0.3s ease;
}

.toggle-section-btn.collapsed i {
    transform: rotate(-180deg);
}

.training-progress-content {
    padding: 2rem;
    transition: all 0.3s ease;
    max-height: 2000px;
    overflow: hidden;
}

.training-progress-content.collapsed {
    max-height: 0;
    padding: 0 2rem;
    overflow: hidden;
}

/* Training Progress Display - Circular Visualization */
.training-progress-display {
    background: radial-gradient(circle at center, rgba(15, 15, 20, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
    border: 2px solid rgba(79, 195, 247, 0.3);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(79, 195, 247, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.training-progress-display::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(79, 195, 247, 0.05) 0%, transparent 70%);
    animation: rotateGlow 20s linear infinite;
    pointer-events: none;
}

@keyframes rotateGlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.training-canvas-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    aspect-ratio: 1;
}

#trainingCanvas {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 20px rgba(79, 195, 247, 0.3));
}

/* Center Info Overlay */
.training-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

/* Pulsing Beat Indicator */
.training-beat-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 1;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid var(--accent-blue);
    border-radius: 50%;
    opacity: 0;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-ring.delay-1 {
    animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
    animation-delay: 1s;
}

@keyframes pulse {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Center Text */
.training-center-text {
    position: relative;
    z-index: 2;
    background: radial-gradient(circle, rgba(15, 15, 20, 0.95) 0%, rgba(15, 15, 20, 0.7) 70%, transparent 100%);
    padding: 2rem;
    border-radius: 50%;
}

.center-beat-count {
    font-size: 4rem;
    font-weight: 900;
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(79, 195, 247, 0.5);
    animation: beatPulse 0.6s ease-out;
}

@keyframes beatPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.center-beat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

.center-beat-label span {
    color: var(--accent-blue);
    font-weight: 700;
}

.center-sequence-info {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 20px;
    display: inline-block;
}

.center-sequence-info span {
    color: var(--accent-blue);
    font-weight: 700;
}

.center-bpm-display {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-purple);
    margin-top: 0.5rem;
}

.bpm-unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Training Legend */
.training-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(79, 195, 247, 0.2);
}

.legend-sequence {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 30px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.legend-sequence.active {
    background: rgba(79, 195, 247, 0.15);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(79, 195, 247, 0.3);
    transform: scale(1.05);
}

.legend-sequence.completed {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
    opacity: 0.7;
}

.legend-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.legend-sequence.completed .legend-color-dot {
    background: #4CAF50 !important;
}

.legend-sequence.completed .legend-color-dot::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.legend-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.legend-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-details {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.legend-details .beats {
    color: var(--accent-blue);
}

.legend-details .bpm {
    color: var(--accent-purple);
}

/* Responsive */
@media (max-width: 768px) {
    .training-canvas-container {
        max-width: 400px;
    }

    .training-beat-pulse {
        width: 150px;
        height: 150px;
    }

    .center-beat-count {
        font-size: 3rem;
    }

    .center-bpm-display {
        font-size: 1.2rem;
    }

    .training-legend {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .training-canvas-container {
        max-width: 300px;
    }

    .training-beat-pulse {
        width: 120px;
        height: 120px;
    }

    .center-beat-count {
        font-size: 2.5rem;
    }

    .training-center-text {
        padding: 1.5rem;
    }
}

/* --- Control Panel Redesign (Overrides) --- */
.metronome-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.metronome-control-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.metronome-control-panel {
    width: 70%;
    min-width: 320px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

@media (min-width: 1025px) {
    .metronome-control-panel {
        position: sticky;
        top: 1.5rem;
    }
}

@media (max-width: 1200px) {
    .metronome-control-panel {
        width: 80%;
    }
}

@media (max-width: 992px) {
    .metronome-control-panel {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .metronome-control-panel {
        width: 100%;
        padding: 0.9rem 1rem;
    }
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.panel-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-secondary, #a5a5a5);
}

.panel-tempo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.panel-tempo-display {
    text-align: center;
    min-width: 140px;
}

.panel-tempo-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1 1 260px;
}

.panel-tempo-controls .bpm-slider {
    flex: 1;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 1100px) {
    .panel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.panel-card--visualization {
    grid-column: 1 / -1;
}

@media (max-width: 720px) {
    .panel-card--visualization {
        grid-column: auto;
    }
}

.panel-training {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-visualization {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.visualization-toggle {
    justify-content: center;
    gap: 0.6rem;
    margin: 0;
    flex-wrap: wrap;
}

.panel-card--visualization .visualization-toggle {
    justify-content: flex-start;
}

.viz-toggle-btn {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    flex: 0 1 150px;
}

.visualization-views {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--viz-height);
    height: var(--viz-height);
    width: 100%;
    margin: 0;
    gap: 1.25rem;
    position: relative;
}

.visualization-views > * {
    width: 100%;
    height: 100%;
}

.beat-blocks-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.4rem;
    justify-items: center;
    align-content: center;
    min-height: 320px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

@media (max-width: 1100px) {
    .beat-blocks-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.2rem;
    }
}

.beat-block {
    width: 100%;
    max-width: 170px;
    aspect-ratio: 1;
}

@media (max-width: 1100px) {
    .beat-block {
        max-width: 180px;
    }
}

@media (max-width: 720px) {
    .beat-block {
        max-width: 160px;
    }
}

@media (max-width: 520px) {
    .beat-block {
        max-width: 140px;
    }
}

.compas-clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

#compasCanvas {
    width: min(100%, 380px);
    height: auto;
}

.clock-legend {
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}


.metronome-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .metronome-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .metronome-actions .control-btn {
        width: 100%;
    }
}

.control-btn {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
}

.training-progress-display {
    width: 70%;
    margin: 2rem auto 0;
}

@media (max-width: 1200px) {
    .training-progress-display {
        width: 80%;
    }
}

@media (max-width: 992px) {
    .training-progress-display {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .training-progress-display {
        width: 100%;
    }
}

/* Control panel typography overrides */
.bpm-display {
    margin: 0;
}

.bpm-value {
    font-size: clamp(3.5rem, 6vw, 5rem);
}

.bpm-label {
    font-size: 0.95rem;
    color: var(--text-secondary, #bbb);
    font-weight: 600;
    margin-top: 0.25rem;
    letter-spacing: 0.35em;
}

.bpm-controls {
    margin: 0;
    gap: 0.8rem;
}

.bpm-btn {
    width: 48px;
    height: 48px;
}

.metronome-control-wrapper {
    --viz-height: 430px;
}

.visualization-views {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--viz-height);
    height: var(--viz-height);
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    gap: 1.25rem;
    position: relative;
}

.visualization-views > * {
    width: 100%;
    height: 100%;
}

.beat-blocks-container {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 1.4rem;
    justify-items: center;
    align-content: center;
    height: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

@media (max-width: 1100px) {
    .beat-blocks-container {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }
}

@media (max-width: 900px) {
    .beat-blocks-container {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 520px) {
    .beat-blocks-container {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

.beat-block {
    width: 150px;
    height: 150px;
}

.compas-clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
}

#compasCanvas {
    width: min(100%, 380px);
    height: auto;
}

.clock-legend {
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Save Preset Modal Styles */
.preset-name-input {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #333;
    border-radius: 12px;
    color: var(--text-primary, #fff);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.preset-name-input:hover {
    border-color: var(--primary-color, #4FC3F7);
}

.preset-name-input:focus {
    outline: none;
    border-color: var(--primary-color, #4FC3F7);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.preset-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(79, 195, 247, 0.05);
    border-left: 3px solid var(--primary-color, #4FC3F7);
    border-radius: 8px;
    margin-top: 1rem;
}

.preset-info i {
    color: var(--primary-color, #4FC3F7);
    font-size: 1.1rem;
    margin-top: 0.2rem;
}

.preset-info span {
    color: var(--text-secondary, #ccc);
    font-size: 0.9rem;
    line-height: 1.5;
}

.save-preset-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.save-preset-confirm-btn,
.save-preset-cancel-btn {
    flex: 1;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.save-preset-confirm-btn {
    background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
    color: #fff;
    border-color: #4FC3F7;
}

.save-preset-confirm-btn:hover {
    background: linear-gradient(135deg, #5fd3ff 0%, #3fa6ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.4);
}

.save-preset-cancel-btn {
    background: transparent;
    color: var(--text-secondary, #999);
    border-color: #333;
}

.save-preset-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #555;
    color: var(--text-primary, #fff);
    transform: translateY(-2px);
}

.save-preset-confirm-btn:active,
.save-preset-cancel-btn:active {
    transform: translateY(0);
}


/* Voice Commands Toggle */
.voice-commands-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.voice-commands-switch {
    display: inline-block;
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.voice-commands-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.voice-commands-toggle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.voice-commands-toggle:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary, #999);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.voice-commands-checkbox:checked + .voice-commands-toggle {
    background: var(--accent-blue, #4FC3F7);
    border-color: var(--accent-blue, #4FC3F7);
}

.voice-commands-checkbox:checked + .voice-commands-toggle:before {
    transform: translateX(20px);
    background: white;
}

.voice-commands-switch:hover .voice-commands-toggle {
    background: rgba(79, 195, 247, 0.2);
    border-color: var(--accent-blue, #4FC3F7);
}

.voice-commands-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary, #ccc);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.voice-commands-label:hover {
    color: var(--accent-blue, #4FC3F7);
}

.voice-commands-label i {
    font-size: 1rem;
}


/* Start Beat Selection */
.start-beat-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.start-beat-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #999);
    font-weight: 500;
}

.start-beat-select {
    width: 70px;
    padding: 0.5rem;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 8px;
    color: var(--text-primary, #fff);
    text-align: center;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    cursor: pointer;
}

.start-beat-select:hover {
    border-color: var(--primary-color, #4FC3F7);
}

.start-beat-select:focus {
    outline: none;
    border-color: var(--primary-color, #4FC3F7);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.start-beat-select option {
    background: #1a1a1a;
    color: #fff;
}

