/**
 * Voice Recorder Component Styles
 * Premium dark theme with waveform visualization
 */

.voice-recorder {
    background: var(--color-surface-glass, rgba(30, 30, 50, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1rem 0;
}

/* Status Bar */
.recorder-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4a5568;
    transition: all 0.3s ease;
}

.status-indicator.recording {
    background: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.6);
    animation: pulse 1.2s infinite;
}

.status-indicator.error {
    background: #ff9500;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.status-text {
    font-size: 0.95rem;
    color: var(--color-text-muted, #a0a0a0);
}

/* Waveform Canvas */
.waveform-canvas {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.8);
    margin-bottom: 1rem;
}

/* Timer */
.recorder-timer {
    text-align: center;
    margin-bottom: 1rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.timer-display {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text, #fff);
}

.timer-max {
    font-size: 1rem;
    color: var(--color-text-muted, #888);
    margin-left: 0.25rem;
}

/* Control Buttons */
.recorder-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.recorder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text, #fff);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.recorder-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

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

.recorder-btn.primary {
    background: linear-gradient(135deg, var(--color-primary, #6c5ce7), var(--color-secondary, #a78bfa));
}

.recorder-btn.primary:hover {
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4);
}

.recorder-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-weight: 500;
}

/* Record button special styling */
.record-btn {
    background: linear-gradient(135deg, #ff5252, #ff1744);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

.record-btn .btn-text {
    display: none;
}

.record-btn .btn-icon {
    font-size: 2rem;
}

.record-btn:hover {
    box-shadow: 0 8px 24px rgba(255, 82, 82, 0.4);
    transform: scale(1.05);
}

.record-btn:active {
    transform: scale(0.95);
}

.pause-btn,
.stop-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
}

.stop-btn {
    background: rgba(255, 82, 82, 0.2);
    border: 2px solid #ff5252;
}

/* Auto-Submit Toggle */
.auto-submit-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.auto-submit-label {
    font-size: 0.9rem;
    color: var(--color-text-muted, #a0a0a0);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--color-primary, #6c5ce7);
}

input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* Playback Section */
.recorder-playback {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    margin-top: 1rem;
}

.audio-player {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Style native audio player for dark theme */
.audio-player::-webkit-media-controls-panel {
    background: rgba(30, 30, 50, 0.9);
}

.playback-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Transcription Section */
.recorder-transcription {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    margin-top: 1rem;
}

.transcription-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--color-text-muted, #888);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(108, 92, 231, 0.2);
    border-top-color: var(--color-primary, #6c5ce7);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.transcription-result label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text, #fff);
}

.transcription-text {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(26, 26, 46, 0.8);
    color: var(--color-text, #fff);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 1rem;
}

.transcription-text:focus {
    outline: none;
    border-color: var(--color-primary, #6c5ce7);
}

/* Interviewer Mode */
.interviewer-question {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(167, 139, 250, 0.1));
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-left: 4px solid var(--color-primary, #6c5ce7);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.interviewer-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-secondary, #a78bfa);
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-text {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #fff;
    font-weight: 500;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .voice-recorder {
        padding: 1.25rem;
    }

    .timer-display {
        font-size: 1.5rem;
    }

    /* Keep record button large on mobile */
    .record-btn {
        width: 72px;
        height: 72px;
    }

    .record-btn .btn-icon {
        font-size: 1.8rem;
    }

    .recorder-btn:not(.record-btn):not(.stop-btn):not(.pause-btn) {
        padding: 0.8rem 1.2rem;
        /* Larger touch target */
        font-size: 1rem;
    }

    .playback-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .playback-actions .recorder-btn {
        width: 100%;
        justify-content: center;
    }
}