/* Voice Recording Interface Styles */

/* Microphone button styling */
.mic-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    /* Mobile touch optimizations */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.mic-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.mic-btn.recording {
    background: #ef4444;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Inline Voice Recording (inside input-controls) */
.voice-recording-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    /* background: #f8f9fa;
    border-radius: 12px;
    padding: 8px 16px;
    border: 2px solid #e5e7eb; */
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Normal controls container */
.normal-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Cancel and Confirm Buttons (for inline recording) */
.voice-recording-inline .voice-cancel-btn,
.voice-recording-inline .voice-confirm-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.voice-recording-inline .voice-cancel-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.voice-recording-inline .voice-cancel-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

.voice-recording-inline .voice-confirm-btn {
    background: #1f2937;
    color: white;
}

.voice-recording-inline .voice-confirm-btn:hover {
    background: #111827;
    transform: scale(1.05);
}

/* Waveform Display (for inline recording) */
.voice-recording-inline .voice-waveform-display {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: stretch;
    padding: 0;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.waveform-canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    background: transparent;
    border-radius: 4px;
    display: block !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

.waveform-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    height: 100%;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.waveform-bar {
    width: 2px;
    background: #000000;
    border-radius: 1px;
    transition: height 0.1s ease;
    animation: waveAnimation 1.2s ease-in-out infinite;
    min-height: 4px;
}

.waveform-bar:nth-child(2n) {
    animation-delay: -0.1s;
}

.waveform-bar:nth-child(3n) {
    animation-delay: -0.2s;
}

.waveform-bar:nth-child(4n) {
    animation-delay: -0.3s;
}

.waveform-bar:nth-child(5n) {
    animation-delay: -0.4s;
}

.waveform-bar:nth-child(6n) {
    animation-delay: -0.5s;
}

.waveform-bar:nth-child(7n) {
    animation-delay: -0.6s;
}

@keyframes waveAnimation {
    0%, 100% {
        height: 4px;
        opacity: 0.8;
    }
    50% {
        height: 28px;
        opacity: 1;
    }
}

/* Voice Timer (for inline recording) */
.voice-recording-inline .voice-timer {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}


/* Ensure the overlay covers the entire input area including quick actions */
.centered-inner-container {
    position: relative;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .voice-recording-container {
        gap: 15px;
        padding: 15px;
        border-radius: 50px;
    }
    
    .voice-cancel-btn,
    .voice-confirm-btn {
        width: 44px;
        height: 44px;
        padding: 10px;
        /* Ensure proper touch targets on mobile */
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .mic-btn {
        width: 44px;
        height: 44px;
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .voice-waveform-display {
        padding: 0 15px;
        height: 44px;
    }
    
    .waveform-bars {
        max-width: 250px;
    }
    
    .waveform-bar {
        width: 2px;
    }
    
    .waveform-canvas {
        /* Ensure canvas renders properly on mobile */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        backface-visibility: hidden;
    }
    
    @keyframes waveAnimation {
        0%, 100% {
            height: 6px;
            opacity: 0.5;
        }
        50% {
            height: 28px;
            opacity: 1;
        }
    }
    
    .voice-timer {
        font-size: 16px;
        min-width: 50px;
    }
}

/* Voice confirm button loading state */
.voice-confirm-btn.loading {
    pointer-events: none;
    opacity: 0.95;
    background: #1f2937;
}

.voice-confirm-btn.loading svg {
    display: none;
}

.voice-confirm-btn .loader {
    display: none;
    position: relative;
    width: 20px;
    height: 20px;
}

.voice-confirm-btn.loading .loader {
    display: inline-block;
}

/* Spinner with 8 dots - slower, normal rotation */
.voice-confirm-btn .loader div {
    transform-origin: 10px 10px;
    animation: spin 2s linear infinite;
}

.voice-confirm-btn .loader div:after {
    content: " ";
    display: block;
    position: absolute;
    top: 1px;
    left: 9px;
    width: 2px;
    height: 5px;
    border-radius: 20%;
    background: #ffffff;
}

.voice-confirm-btn .loader div:nth-child(1) { transform: rotate(0deg);   animation-delay: -1.75s; }
.voice-confirm-btn .loader div:nth-child(2) { transform: rotate(45deg);  animation-delay: -1.5s; }
.voice-confirm-btn .loader div:nth-child(3) { transform: rotate(90deg);  animation-delay: -1.25s; }
.voice-confirm-btn .loader div:nth-child(4) { transform: rotate(135deg); animation-delay: -1s; }
.voice-confirm-btn .loader div:nth-child(5) { transform: rotate(180deg); animation-delay: -0.75s; }
.voice-confirm-btn .loader div:nth-child(6) { transform: rotate(225deg); animation-delay: -0.5s; }
.voice-confirm-btn .loader div:nth-child(7) { transform: rotate(270deg); animation-delay: -0.25s; }
.voice-confirm-btn .loader div:nth-child(8) { transform: rotate(315deg); animation-delay: 0s; }

@keyframes spin {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .voice-recording-overlay {
        background: rgba(31, 41, 55, 0.98);
    }
    
    .voice-recording-container {
        background: #374151;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    
    .voice-cancel-btn {
        background: #4b5563;
        color: #d1d5db;
    }
    
    .voice-cancel-btn:hover {
        background: #ef4444;
        color: white;
    }
    
    .voice-confirm-btn {
        background: #f9fafb;
        color: #1f2937;
    }
    
    .voice-confirm-btn:hover {
        background: #e5e7eb;
    }
    
    .waveform-bar {
        background: #f9fafb;
    }
    
    .voice-timer {
        color: #f9fafb;
    }
    
    .mic-btn {
        color: #d1d5db;
    }
    
    .mic-btn:hover {
        background: #374151;
        color: #f9fafb;
    }
}