/* Key / Pitch Detector Styles */

/* Key Display */
.key-display-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background: linear-gradient(135deg, rgba(5, 44, 101, 0.05) 0%, rgba(5, 44, 101, 0.1) 100%);
    border-radius: 12px;
    border: 2px solid rgba(5, 44, 101, 0.2);
}

[data-bs-theme="dark"] .key-display-container {
    background: linear-gradient(135deg, rgba(5, 44, 101, 0.15) 0%, rgba(5, 44, 101, 0.25) 100%);
    border-color: rgba(5, 44, 101, 0.4);
}

.key-main {
    text-align: center;
}

.key-value {
    font-size: 4rem;
    font-weight: 700;
    color: var(--bs-primary-text-emphasis);
    line-height: 1;
    font-family: 'Georgia', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.key-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #6c757d;
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Piano Visualization */
.piano-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: #2c2c2c;
    border-radius: 8px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow-x: auto;
}

.piano-keys {
    display: flex;
    position: relative;
    height: 120px;
}

.piano-key {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.white-key {
    width: 40px;
    height: 120px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid #333;
    border-radius: 0 0 4px 4px;
    margin: 0 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.white-key:hover {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 100%);
}

.white-key.active {
    background: linear-gradient(to bottom, #6ea8fe 0%, #0d6efd 100%);
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.5);
}

.black-key {
    width: 28px;
    height: 75px;
    background: linear-gradient(to bottom, #2c2c2c 0%, #000000 100%);
    border: 1px solid #000;
    border-radius: 0 0 3px 3px;
    position: absolute;
    z-index: 2;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

.black-key:hover {
    background: linear-gradient(to bottom, #3c3c3c 0%, #1c1c1c 100%);
}

.black-key.active {
    background: linear-gradient(to bottom, #ffc107 0%, #ff9800 100%);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.6);
}

.key-label-text {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    user-select: none;
}

.white-key.active .key-label-text {
    color: white;
}

.black-key .key-label-text {
    color: #999;
    bottom: 3px;
    font-size: 0.65rem;
}

.black-key.active .key-label-text {
    color: white;
}

/* Real-time Display */
.realtime-display {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, rgba(5, 44, 101, 0.05) 0%, rgba(5, 44, 101, 0.1) 100%);
    border-radius: 10px;
    border: 2px solid rgba(5, 44, 101, 0.2);
}

[data-bs-theme="dark"] .realtime-display {
    background: linear-gradient(135deg, rgba(5, 44, 101, 0.15) 0%, rgba(5, 44, 101, 0.25) 100%);
    border-color: rgba(5, 44, 101, 0.4);
}

.realtime-note {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--bs-primary-text-emphasis);
    line-height: 1;
    font-family: 'Georgia', serif;
    margin-bottom: 10px;
}

.realtime-freq {
    font-size: 1.3rem;
    font-weight: 600;
    color: #6c757d;
    font-family: 'Courier New', monospace;
}

/* Pitch Meter */
.pitch-meter {
    position: relative;
    width: 100%;
    height: 30px;
    background: linear-gradient(to right,
        #dc3545 0%,
        #ffc107 25%,
        #28a745 40%,
        #28a745 60%,
        #ffc107 75%,
        #dc3545 100%
    );
    border-radius: 6px;
    overflow: visible;
    margin-top: 20px;
}

.pitch-meter-bar {
    position: absolute;
    top: -10px;
    left: 50%;
    width: 4px;
    height: 50px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.5);
    transition: left 0.1s linear;
    transform: translateX(-50%);
}

.pitch-meter-center {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
}

/* Audio Preview */
.audio-preview-wrapper {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .audio-preview-wrapper {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

.audio-preview {
    width: 100%;
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {

    .key-value {
        font-size: 3rem;
    }

    .realtime-note {
        font-size: 2.5rem;
    }

    .white-key {
        width: 30px;
        height: 100px;
    }

    .black-key {
        width: 22px;
        height: 65px;
    }

    .key-label-text {
        font-size: 0.65rem;
    }
}
