/* Microphone Test CSS */
/* Styles specific to microphone testing functionality */

.mic-container, .microphone-container {
    width: 90%; /* Matching camera container style from TODO.txt */
    max-width: 1200px; /* Matching camera container style from TODO.txt */
    margin: 0 auto; /* Removed top margin */
    text-align: center;
    padding: 0; /* Removed horizontal padding to match camera container */
}

.mic-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0; /* Removed top margin */
    background: rgba(255, 255, 255, 0.1);
    padding: 20px; /* Consistent 20px padding all around */
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.mic-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    text-align: left;
}

.mic-device-select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 12px auto;
}

.recording-controls {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    margin-bottom: 24px;
    justify-content: center;
}

.recording-controls button {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-family: 'Montserrat', Arial, sans-serif;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.record-btn {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.1) 0%, rgba(255, 68, 68, 0.2) 100%);
    border-color: rgba(255, 68, 68, 0.3);
}

.record-btn:hover {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.2) 0%, rgba(255, 68, 68, 0.4) 100%);
}

.record-btn.recording {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.3) 0%, rgba(255, 68, 68, 0.5) 100%);
    animation: pulse 1.5s infinite;
}

.play-btn {
    background: linear-gradient(135deg, rgba(42, 82, 152, 0.1) 0%, rgba(42, 82, 152, 0.2) 100%);
    border-color: rgba(42, 82, 152, 0.3);
}

.play-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(42, 82, 152, 0.2) 0%, rgba(42, 82, 152, 0.4) 100%);
}

.play-btn:disabled, .reset-btn:disabled {
    background: rgba(200, 200, 200, 0.1);
    border-color: rgba(200, 200, 200, 0.2);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.reset-btn {
    background: linear-gradient(135deg, rgba(102, 102, 102, 0.1) 0%, rgba(102, 102, 102, 0.2) 100%);
    border-color: rgba(102, 102, 102, 0.3);
}

.reset-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(102, 102, 102, 0.2) 0%, rgba(102, 102, 102, 0.4) 100%);
}

.visualization-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 8px;
}

.visualization-label {
    font-size: 1rem;
    font-weight: bold;
    color: white;
    margin-bottom: 8px;
    text-align: left;
}

.waveform-canvas, .spectrogram-canvas {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spectrogram-canvas {
    height: 200px; /* Match height from home.css */
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

label {
    color: white;
    font-size: 1rem;
    display: block;
    margin-bottom: 8px;
}

/* Permission note styling - matching TODO.txt */
.permission-note {
    margin-top: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(42, 82, 152, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

/* Fixing container spacing */
.main-container {
    margin-top: 0;
    padding-top: 20px; /* Added 20px top spacing as requested */
}

/* Ensure microphone test starts at the top */

/* Responsive styles */
@media (max-width: 1200px) {
    .mic-container, .microphone-container {
        width: 95%; /* Slightly wider on medium screens */
    }
}

/* Mobile optimizations */
@media screen and (max-width: 768px) {
    .mic-container, .microphone-container {
        width: 100%;
        margin: 8px auto;
        padding: 0 8px;
    }

    .recording-controls {
        flex-wrap: wrap;
        flex-direction: column;
        gap: 8px;
    }
    
    .recording-controls button {
        flex: 1;
        min-width: 100px;
        padding: 10px 16px;
        font-size: 0.95rem;
    }
      .mic-grid {
        max-width: 100%;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        margin-top: 16px;
    }
}

/* Spectrogram Fullscreen Button */
.spectrogram-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    padding-right: 50px; /* Make room for frequency markers */
    box-sizing: border-box;
}

.spectrogram-fullscreen-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.spectrogram-fullscreen-btn:hover {
    opacity: 1;
}

/* Fullscreen Styles */
.spectrogram-wrapper:fullscreen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    background: #000;
}

.spectrogram-wrapper:fullscreen .spectrogram-canvas {
    flex: 1;
    height: 100%;
    max-height: none;
    width: 100%;
}

.spectrogram-wrapper:fullscreen .visualization-label {
    position: absolute;
    top: 16px;
    left: 16px;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 8px;
}

.spectrogram-wrapper:fullscreen .spectrogram-fullscreen-btn {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
}

/* Frequency markers styling */
.frequency-markers {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    pointer-events: none;
    z-index: 5;
}

.frequency-marker {
    position: absolute;
    right: 5px;
    transform: translateY(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    background-color: rgba(0, 0, 0, 0.4);
    padding: 2px 4px;
    border-radius: 3px;
    user-select: none;
    text-align: left; /* Make text left-aligned */
    min-width: 36px; /* Optional: ensure enough space for all labels */
}

.frequency-marker::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 50%;
    width: 20px;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.3);
}

.spectrogram-wrapper:fullscreen .frequency-markers {
    width: 70px;
}

.spectrogram-wrapper:fullscreen .frequency-marker {
    font-size: 14px;
    right: 10px;
    padding: 3px 6px;
}

.spectrogram-wrapper:fullscreen .frequency-marker::before {
    left: -40px;
    width: 35px;
    height: 1px;
}
