/*
    گفتار به متن (Voice-to-Text) — استایلِ مشترکِ همه‌ی فیلدها.
    اسکریپت voice-input.js هر فیلدِ متنیِ واجدِ شرایط را در یک wrapper می‌گذارد و دکمه‌ی میکروفون را می‌افزاید.
    هیچ مارک‌آپی در ویوها لازم نیست؛ فقط همین فایل + JS در لایه لود می‌شود.
*/
.voice-field {
    position: relative;
    display: block;
}

/* فضای لازم برای دکمه در گوشه‌ی بالا-چپ (RTL) تا متن زیرِ دکمه پنهان نشود */
.voice-field > .voice-target {
    padding-inline-start: 44px;
}

.voice-mic {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-start: 8px;
    width: 30px;
    height: 30px;
    /* بازنشانیِ تهاجمیِ استایلِ دکمه‌ها در قالب عمومی (Creek) تا شکلِ دایره‌ای حفظ شود */
    min-width: 0;
    min-height: 0;
    max-width: none;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line, #e2e8f0);
    background: var(--accent-weak, #eef2ff);
    color: var(--accent, #4f46e5);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    z-index: 3;
    transition: background .15s, transform .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.voice-mic:hover { transform: scale(1.08); }
.voice-mic:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
.voice-mic svg { width: 16px; height: 16px; display: block; }

/* برای فیلدهای تک‌خطیِ کوتاه، دکمه کمی کوچک‌تر و بالاتر می‌نشیند */
.voice-field.is-input > .voice-mic {
    inset-block-start: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
}
.voice-field.is-input > .voice-mic:hover { transform: translateY(-50%) scale(1.08); }

/* حالت در حال ضبط */
.voice-mic.recording {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    animation: voice-pulse 1.2s infinite;
}
@keyframes voice-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); }
    70%  { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* راهنمای شناور کوچک هنگام ضبط */
.voice-hint {
    position: absolute;
    inset-block-start: 6px;
    inset-inline-start: 44px;
    background: #111827;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 9px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity .15s, transform .15s;
}
.voice-field.listening .voice-hint {
    opacity: 1;
    transform: translateY(0);
}

/* در موبایل دکمه کمی بزرگ‌تر برای لمسِ راحت */
@media (max-width: 576px) {
    .voice-mic { width: 34px; height: 34px; }
    .voice-field.is-input > .voice-mic { width: 32px; height: 32px; }
    .voice-field > .voice-target { padding-inline-start: 48px; }
}

/* برای ویرایشگرِ متنِ غنی (Quill) — دکمه گوشه‌ی پایین-چپِ کادر */
.voice-field.is-editor > .voice-mic {
    inset-block-start: auto;
    inset-block-end: 10px;
    inset-inline-start: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.voice-field.is-editor > .voice-mic.recording { background: #ef4444; }
