/* Скрываем элементы в неподдерживаемых браузерах */
html.no-speech-recognition .voice-recognition-container,
html.no-speech-recognition .voice-recognition-controls,
html.no-speech-recognition .voice-recognition-button,
html.no-speech-recognition .voice-recognition-description {
    display: none !important;
}

/* Стили для контейнера */
.voice-recognition-container {
    position: relative;
    margin: 10px 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Стили для кнопки */
.voice-recognition-button {
    position: absolute;
    right: 10px;
    bottom: -50px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: #25D366;
    color: white;
    cursor: pointer;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    -webkit-box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    margin: 0;
    opacity: 0.9;
    z-index: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.voice-recognition-button:hover {
    background-color: #128C7E;
    -webkit-transform: scale(1.05);
    -ms-transform: scale(1.05);
    transform: scale(1.05);
    opacity: 1;
}

.voice-recognition-button.recording {
    background-color: #dc3545;
    -webkit-animation: pulse 1.5s infinite;
    animation: pulse 1.5s infinite;
}

.voice-recognition-button.recording:hover {
    background-color: #c82333;
}

/* Стили для иконки микрофона */
.microphone-icon {
    width: 24px;
    height: 24px;
    position: relative;
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.microphone-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Анимация пульсации */
@-webkit-keyframes pulse {
    0% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.1);
        transform: scale(1.1);
    }
    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.1);
        transform: scale(1.1);
    }
    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

/* Стили для описания */
.voice-recognition-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-align: right;
}

/* Показываем кнопку только если браузер поддерживает распознавание речи */
.speech-recognition-supported .voice-recognition-container {
    display: block;
    position: relative;
    margin: 0;
    padding: 0;
    text-align: right;
}

.voice-recognition-container .voice-recognition-description {
    display: none;
}

.voice-recognition-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    margin: 0;
    padding: 0;
}

/* Стили для textarea контейнера */
.textarea-container {
    position: relative !important;
}

/* Стили для полного ответа */
#postform .voice-recognition-controls {
    right: calc(10px + 5px);
}

/* Медиа-запрос для настольных устройств */
@media screen and (min-width: 768px) {
    #postform .voice-recognition-controls {
        right: 21%;
    }
}

/* Checkmark icon (shown when recording) */
.voice-recognition-button.recording .microphone-icon::before {
    width: 12px;
    height: 6px;
    border-left: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    background: none;
    border-radius: 0;
    -webkit-transform: translate(-50%, -50%) rotate(-45deg);
    -ms-transform: translate(-50%, -50%) rotate(-45deg);
    transform: translate(-50%, -50%) rotate(-45deg);
}

.voice-recognition-button.recording .microphone-icon::after {
    display: none;
}

.voice-recognition-container button {
    margin: 0 auto;
}

.voice-recognition-container .alert {
    margin: 10px 0;
} 