/* ========================================
   CHAT VOICE - Voice Recording Styles
   ======================================== */

.voice-recording-ui {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.2s ease;
}

.voice-recording-ui.cancelling {
    opacity: 0.6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cancel Button */
.voice-cancel-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

/* Send Button */
.voice-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    animation: pulse 1.5s infinite;
}

.voice-send-btn:hover {
    background: #764ba2;
    transform: scale(1.05);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(102, 126, 234, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* Recording Info Center */
.voice-recording-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    height: 44px;
}

.voice-recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

.recording-text {
    font-size: 13px;
    color: #ef4444;
    font-weight: 500;
}

.voice-timer {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    min-width: 45px;
    text-align: right;
}

.voice-waveform {
    width: 100px;
    height: 30px;
}

/* Upload Bubbles */
.voice-upload-bubble {
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    max-width: 250px !important;
}

.voice-upload-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
}

.voice-upload-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-upload-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.voice-upload-info {
    flex: 1;
}

.voice-upload-text {
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}

.voice-upload-text.voice-upload-error {
    color: #ef4444;
}

.voice-upload-duration {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   VOICE MESSAGE BUBBLE - WhatsApp/Telegram Style
   ======================================== */

.voice-message-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    min-width: 200px;
    max-width: 280px;
    cursor: pointer;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    margin: 4px 0;
}

.voice-message-bubble:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Play Button */
.voice-bubble-play-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.voice-bubble-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.voice-bubble-play-btn svg {
    color: white;
    width: 20px;
    height: 20px;
}

.voice-bubble-play-btn .voice-play-icon {
    display: block;
    transform: translateX(2px);
}

.voice-bubble-play-btn .voice-pause-icon {
    display: none;
}

/* Playing State */
.voice-message-bubble.playing .voice-bubble-play-btn .voice-play-icon {
    display: none;
}

.voice-message-bubble.playing .voice-bubble-play-btn .voice-pause-icon {
    display: block;
}

.voice-message-bubble.playing .voice-bubble-play-btn {
    animation: voicePulse 1.5s infinite ease-in-out;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
    }
}

/* Content Area */
.voice-bubble-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Waveform Container */
.voice-waveform-container {
    position: relative;
    height: 28px;
    overflow: hidden;
    cursor: pointer;
}

.voice-waveform-bars {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 2px;
}

.voice-bar {
    width: 3px;
    min-height: 3px;
    border-radius: 2px;
}

/* Background bars (unplayed) - gray/monochrome */
.voice-waveform-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.voice-waveform-bg .voice-bar {
    background: rgba(150, 150, 150, 0.5);
}

/* Played portion container - clips the foreground bars */
.voice-waveform-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    overflow: hidden;
    transition: width 0.1s linear;
    z-index: 2;
}

/* Foreground bars (played) - accent color */
.voice-waveform-fg {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px; /* Wide enough to cover max voice bubble width */
    height: 100%;
}

.voice-waveform-fg .voice-bar {
    background: #34B7F1; /* WhatsApp-style teal blue */
}

/* Info row */
.voice-bubble-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.voice-bubble-time {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: rgba(255, 255, 255, 0.7);
    min-width: 40px;
}

.voice-mic-icon {
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

/* Right bubble adjustments (sender's messages) */
.bubbleRight .voice-message-bubble,
.bubbleRightEx .voice-message-bubble {
    background: transparent;
}

.bubbleRight .voice-message-bubble:hover,
.bubbleRightEx .voice-message-bubble:hover {
    background: rgba(0, 0, 0, 0.15);
}

.bubbleRight .voice-waveform-bg .voice-bar,
.bubbleRightEx .voice-waveform-bg .voice-bar {
    background:darkgray;
}

.bubbleRight .voice-waveform-fg .voice-bar,
.bubbleRightEx .voice-waveform-fg .voice-bar {
    background: #34B7F1; /* Same accent color for consistency */
}

.bubbleRight .voice-bubble-time,
.bubbleRightEx .voice-bubble-time {
    color: rgba(0, 0, 0, 0.6);
}

.bubbleRight .voice-mic-icon,
.bubbleRightEx .voice-mic-icon {
    color: rgba(0, 0, 0, 0.4);
}

.bubbleRight .voice-bubble-play-btn,
.bubbleRightEx .voice-bubble-play-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.bubbleRight .voice-bubble-play-btn:hover,
.bubbleRightEx .voice-bubble-play-btn:hover {
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

.bubbleRight .voice-message-bubble.playing .voice-bubble-play-btn,
.bubbleRightEx .voice-message-bubble.playing .voice-bubble-play-btn {
    animation-name: voicePulseBlue;
}

@keyframes voicePulseBlue {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(79, 172, 254, 0.5);
    }
}


/* Responsive adjustments */
@media (max-width: 480px) {
    .voice-message-bubble {
        min-width: 160px;
        max-width: 220px;
        padding: 6px 10px;
        gap: 8px;
    }

    .voice-bubble-play-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .voice-bubble-play-btn svg {
        width: 16px;
        height: 16px;
    }

    .voice-waveform-container {
        height: 24px;
    }

    .voice-bar {
        width: 2px;
    }
}