/**
 * File: audio-io.css
 * Desc: Audio I/O Module Styles
 * Date: 2026-01-11
 *
 * Includes:
 * - Speaker icon button styles
 * - Audio settings panel styles
 * - Animations for speaking state
 */

/* ========================================
   Speaker Icon Button (Header)
   ======================================== */

.speaker-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.speaker-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.speaker-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Speaker Icon SVG */
.speaker-icon {
    width: 22px;
    height: 22px;
    transition: all 0.3s ease;
}

/* Disabled state (gray) */
.speaker-icon.disabled {
    fill: rgba(255, 255, 255, 0.5);
    opacity: 0.6;
}

/* Enabled state (purple gradient via filter) */
.speaker-icon.enabled {
    fill: #ffffff;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

/* Speaking animation */
.speaker-icon.speaking {
    animation: speakerPulse 1.5s ease-in-out infinite;
}

.speaker-icon.speaking .speaker-waves {
    animation: soundWaves 1s ease-in-out infinite;
}

@keyframes speakerPulse {
    0%, 100% {
        filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 1));
        transform: scale(1.05);
    }
}

@keyframes soundWaves {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* Tooltip */
.speaker-toggle-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
}

/* ========================================
   Audio Settings Panel (in User Settings)
   ======================================== */

.audio-settings-section {
    padding: 0;
}

.audio-settings-group {
    margin-bottom: 24px;
}

.audio-settings-group:last-child {
    margin-bottom: 0;
}

.audio-settings-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Voice Select Dropdown */
.voice-select-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--gray-medium);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.voice-select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.2);
}

.voice-select optgroup {
    font-weight: 600;
    color: var(--text-dark);
}

.voice-select option {
    padding: 8px;
}

.test-voice-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.test-voice-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 126, 200, 0.3);
}

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

/* Sliders */
.audio-slider-group {
    margin-bottom: 16px;
}

.audio-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-dark);
}

.audio-slider-value {
    font-weight: 600;
    color: var(--primary-purple);
    min-width: 45px;
    text-align: right;
}

.audio-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-medium);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.audio-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.audio-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Auto-speak Checkboxes */
.auto-speak-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auto-speak-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.auto-speak-option:hover {
    background: var(--purple-xlight);
}

.auto-speak-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-purple);
    cursor: pointer;
}

.auto-speak-option span {
    flex: 1;
    font-size: 14px;
    color: var(--text-dark);
}

.auto-speak-option small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Master Toggle */
.audio-master-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.1), rgba(127, 176, 105, 0.1));
    border-radius: 12px;
    margin-bottom: 24px;
}

.audio-master-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-master-toggle-label span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.audio-master-toggle-label small {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-medium);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
}

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

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.3);
}

/* Privacy Notice */
.audio-privacy-notice {
    padding: 16px;
    background: var(--gray-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-green);
}

.audio-privacy-notice h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-privacy-notice p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Reset Button */
.audio-reset-btn {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--gray-medium);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-reset-btn:hover {
    background: var(--gray-light);
    color: var(--text-dark);
    border-color: var(--gray-dark);
}

/* ========================================
   Keyboard Shortcut Indicator
   ======================================== */

.audio-shortcut-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.audio-shortcut-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--gray-light);
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dark);
}

/* ========================================
   Unsupported Browser Notice
   ======================================== */

.audio-unsupported {
    padding: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    text-align: center;
}

.audio-unsupported h4 {
    color: #ef4444;
    font-size: 16px;
    margin-bottom: 8px;
}

.audio-unsupported p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
    .speaker-toggle-btn {
        width: 36px;
        height: 36px;
    }

    .speaker-icon {
        width: 20px;
        height: 20px;
    }

    .voice-select-container {
        flex-direction: column;
        align-items: stretch;
    }

    .test-voice-btn {
        width: 100%;
    }

    .auto-speak-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ========================================
   Reduced Motion Support
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .speaker-icon.speaking {
        animation: none;
    }

    .speaker-icon.speaking .speaker-waves {
        animation: none;
        opacity: 1;
    }

    .toggle-slider,
    .toggle-slider::before,
    .speaker-toggle-btn,
    .audio-slider::-webkit-slider-thumb {
        transition: none;
    }
}

/* ========================================
   Voice Input (STT) - Phase 2
   ======================================== */

/* Floating Voice Input Button Container */
.voice-input-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Floating Mic Button */
.voice-input-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(139, 126, 200, 0.4);
    position: relative;
    overflow: hidden;
}

.voice-input-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(139, 126, 200, 0.5);
}

.voice-input-btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(139, 126, 200, 0.3), 0 4px 16px rgba(139, 126, 200, 0.4);
}

.voice-input-btn:active {
    transform: scale(0.98);
}

/* Mic Icon */
.voice-input-btn .mic-icon {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.3s ease;
}

/* Listening state */
.voice-input-btn.listening {
    animation: micPulse 1.5s ease-in-out infinite;
}

.voice-input-btn.listening .mic-icon {
    animation: micBounce 0.6s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(139, 126, 200, 0.4),
                    0 0 0 0 rgba(139, 126, 200, 0.4);
    }
    50% {
        box-shadow: 0 6px 24px rgba(139, 126, 200, 0.6),
                    0 0 0 12px rgba(139, 126, 200, 0);
    }
}

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

/* Listening Waves Animation */
.listening-waves {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
}

.voice-input-btn.listening .listening-waves {
    opacity: 1;
}

.listening-waves span {
    width: 4px;
    height: 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    animation: waveBar 0.8s ease-in-out infinite;
}

.listening-waves span:nth-child(1) {
    animation-delay: 0s;
}

.listening-waves span:nth-child(2) {
    animation-delay: 0.15s;
}

.listening-waves span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes waveBar {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
}

/* Hide mic icon when listening waves are shown */
.voice-input-btn.listening .mic-icon {
    opacity: 0;
}

.voice-input-btn.listening .listening-waves {
    opacity: 1;
}

/* ========================================
   Transcript Overlay
   ======================================== */

.voice-transcript-overlay {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 48px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 16px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.voice-transcript-overlay.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.transcript-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.transcript-status {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-purple);
    display: flex;
    align-items: center;
    gap: 8px;
}

.transcript-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: recordingDot 1s ease-in-out infinite;
}

@keyframes recordingDot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.transcript-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.transcript-close:hover {
    background: var(--gray-medium);
    color: var(--text-dark);
}

.transcript-content {
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    padding: 12px;
    background: var(--gray-light);
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-dark);
}

.transcript-content .interim-text {
    color: var(--text-muted);
}

.transcript-content .final-text {
    color: var(--text-dark);
}

.transcript-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ========================================
   Voice Commands Hints (Phase 3)
   ======================================== */

.transcript-commands-hint {
    margin-top: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.08), rgba(127, 176, 105, 0.08));
    border-radius: 10px;
    border: 1px solid rgba(139, 126, 200, 0.15);
}

.commands-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.command-example {
    display: inline-block;
    padding: 4px 10px;
    margin: 3px 4px 3px 0;
    background: white;
    border: 1px solid rgba(139, 126, 200, 0.25);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-purple);
    transition: all 0.2s ease;
}

.command-example:hover {
    background: rgba(139, 126, 200, 0.1);
    border-color: var(--primary-purple);
    transform: translateY(-1px);
}

/* Command execution feedback */
.voice-command-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    padding: 20px 32px;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 2500;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.voice-command-feedback.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.voice-command-feedback .feedback-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.voice-command-feedback .feedback-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

/* ========================================
   Privacy Notice Modal
   ======================================== */

.voice-privacy-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.voice-privacy-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.privacy-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.voice-privacy-modal.visible .privacy-content {
    transform: scale(1);
}

.privacy-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.privacy-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.privacy-text {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.privacy-text strong {
    color: var(--text-dark);
}

.privacy-note {
    font-size: 13px;
    color: var(--primary-green);
    padding: 12px;
    background: rgba(127, 176, 105, 0.1);
    border-radius: 8px;
    margin-bottom: 24px;
}

.privacy-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.privacy-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.privacy-btn-secondary {
    background: var(--gray-light);
    color: var(--text-dark);
}

.privacy-btn-secondary:hover {
    background: var(--gray-medium);
}

.privacy-btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    color: white;
}

.privacy-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(139, 126, 200, 0.4);
}

/* ========================================
   Mode Selector Popover
   ======================================== */

.voice-mode-selector {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 220px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 8px;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1002;
}

.voice-mode-selector.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--text-dark);
    text-align: left;
}

.mode-option:hover {
    background: var(--gray-light, #f5f5f5);
}

.mode-option.active {
    background: linear-gradient(135deg, rgba(139, 126, 200, 0.12), rgba(127, 176, 105, 0.12));
}

.mode-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mode-option svg {
    flex-shrink: 0;
    color: var(--primary-purple);
}

.record-dot-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    position: relative;
}

.record-dot-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
}

.mode-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.mode-option-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========================================
   Mode Badge
   ======================================== */

.mode-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    z-index: 1;
    pointer-events: none;
}

.mode-badge-dictate {
    background: var(--primary-purple);
    color: white;
    padding: 0 4px;
}

.mode-badge-record {
    background: #ef4444;
    width: 18px;
    padding: 0;
}

.mode-badge-record::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* ========================================
   Mode Switch Chevron
   ======================================== */

.mode-switch-chevron {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    z-index: 2;
}

.voice-input-btn:hover .mode-switch-chevron {
    opacity: 0.8;
}

.mode-switch-chevron:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.4);
}

/* ========================================
   Recording Button State
   ======================================== */

.voice-input-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    animation: recordingPulse 1.5s ease-in-out infinite;
}

.voice-input-btn.recording:hover {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.5);
}

.voice-input-btn.recording .mic-icon {
    opacity: 0;
}

.voice-input-btn.recording .listening-waves span {
    background: rgba(255, 255, 255, 0.8);
}

.voice-input-btn.recording .listening-waves {
    opacity: 1;
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4),
                    0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6),
                    0 0 0 12px rgba(239, 68, 68, 0);
    }
}

/* ========================================
   Recording Overlay
   ======================================== */

.voice-recording-overlay {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 280px;
    max-width: calc(100vw - 48px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 16px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.voice-recording-overlay.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.recording-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.recording-status {
    font-size: 14px;
    font-weight: 600;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: recordingDot 1s ease-in-out infinite;
}

.recording-dot.paused {
    animation: none;
    opacity: 0.4;
}

.recording-timer {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}

/* Recording Level Bars */
.recording-level-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 44px;
    padding: 8px 0;
    margin-bottom: 12px;
}

.recording-level-bars span {
    width: 4px;
    height: 4px;
    min-height: 4px;
    background: linear-gradient(to top, var(--primary-purple), var(--primary-green));
    border-radius: 2px;
    transition: height 0.08s ease;
}

/* Recording Controls */
.recording-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.recording-control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-light, #f5f5f5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.recording-control-btn:hover {
    background: var(--gray-medium, #e0e0e0);
}

.recording-stop-btn {
    width: 48px;
    height: 48px;
    background: #ef4444;
    color: white;
}

.recording-stop-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.recording-privacy-hint {
    font-size: 11px;
    color: var(--primary-green, #7FB069);
    text-align: center;
    padding: 6px 0 0;
    border-top: 1px solid var(--gray-light, #f5f5f5);
}

/* ========================================
   Review Overlay
   ======================================== */

.voice-review-overlay {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 300px;
    max-width: calc(100vw - 48px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 16px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1001;
}

.voice-review-overlay.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.review-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.review-duration {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.review-audio {
    width: 100%;
    height: 36px;
    margin-bottom: 8px;
    border-radius: 8px;
}

.review-format {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
}

.review-actions {
    display: flex;
    gap: 8px;
}

.review-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-btn-discard {
    background: var(--gray-light, #f5f5f5);
    color: var(--text-muted);
}

.review-btn-discard:hover {
    background: var(--gray-medium, #e0e0e0);
    color: var(--text-dark);
}

.review-btn-rerecord {
    background: var(--gray-light, #f5f5f5);
    color: var(--text-dark);
}

.review-btn-rerecord:hover {
    background: var(--gray-medium, #e0e0e0);
}

.review-btn-download {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-green));
    color: white;
}

.review-btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 126, 200, 0.3);
}

/* Save to Blossom button */
.review-btn-blossom {
    background: linear-gradient(135deg, #8B7EC8, #A78BFA);
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-btn-blossom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 126, 200, 0.4);
}

.review-btn-blossom.upload-done {
    background: var(--primary-green, #7FB069);
    cursor: default;
}

.review-btn-blossom:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Upload status area */
.upload-status {
    margin-top: 12px;
    padding: 0 4px;
}

.upload-progress-bar {
    height: 4px;
    background: rgba(139, 126, 200, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-purple, #8B7EC8), var(--primary-green, #7FB069));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.upload-progress-fill.indeterminate {
    width: 40%;
    animation: uploadIndeterminate 1.2s ease-in-out infinite;
}

@keyframes uploadIndeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.upload-status-text {
    font-size: 12px;
    color: var(--primary-purple, #8B7EC8);
    text-align: center;
}

.upload-status-text.error {
    color: #e53e3e;
}

.upload-success-link {
    color: var(--primary-green, #7FB069);
    text-decoration: underline;
    font-weight: 500;
    margin-left: 4px;
}

.upload-success-link:hover {
    color: #6a9a55;
}

/* Drive connection prompt (inside review overlay) */
.drive-connection-prompt {
    margin-top: 12px;
    padding: 12px;
    background: rgba(139, 126, 200, 0.06);
    border-radius: 10px;
    border: 1px solid rgba(139, 126, 200, 0.15);
}

.drive-prompt-message {
    font-size: 12px;
    color: var(--text-muted, #666);
    margin: 0 0 10px 0;
    line-height: 1.4;
    text-align: center;
}

.drive-prompt-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ========================================
   Voice Input Settings Section
   ======================================== */

.voice-input-settings-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-medium);
}

.voice-input-settings-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-input-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.voice-input-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--gray-light);
    border-radius: 12px;
}

.voice-input-option-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.voice-input-option-label span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

.voice-input-option-label small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Language Select */
.stt-language-select {
    padding: 10px 12px;
    border: 1px solid var(--gray-medium);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    cursor: pointer;
    min-width: 150px;
}

.stt-language-select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(139, 126, 200, 0.2);
}

/* ========================================
   Voice Input Responsive
   ======================================== */

@media (max-width: 768px) {
    .voice-input-container {
        bottom: 80px;
        right: 16px;
    }

    .voice-input-btn {
        width: 52px;
        height: 52px;
    }

    .voice-transcript-overlay,
    .voice-recording-overlay,
    .voice-review-overlay {
        width: calc(100vw - 32px);
        right: -8px;
    }

    .voice-mode-selector {
        right: -8px;
    }

    .privacy-content {
        padding: 24px;
    }

    .privacy-actions {
        flex-direction: column;
    }
}

/* ========================================
   Voice Input Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .voice-input-btn.listening,
    .voice-input-btn.recording {
        animation: none;
    }

    .voice-input-btn.listening .mic-icon {
        animation: none;
    }

    .listening-waves span {
        animation: none;
        height: 16px;
    }

    .transcript-status::before,
    .recording-dot {
        animation: none;
    }

    .voice-transcript-overlay,
    .voice-recording-overlay,
    .voice-review-overlay,
    .voice-mode-selector,
    .voice-privacy-modal,
    .privacy-content {
        transition: none;
    }

    .recording-level-bars span {
        transition: none;
    }
}

/* ========================================
   Sync Across Devices Section
   ======================================== */

.audio-sync-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-medium, rgba(139, 126, 200, 0.2));
}

.audio-sync-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-hint {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin: 12px 0 0 0;
    padding: 8px 12px;
    background: var(--bg-subtle, rgba(139, 126, 200, 0.05));
    border-radius: 6px;
    transition: color 0.3s ease;
}

.sync-hint.synced {
    color: var(--primary-green, #7FB069);
    background: rgba(127, 176, 105, 0.08);
}
