/* قارئ النص الآلي (TTS) — multi-5mod-refsam */
#m5mod-tts {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 999999;
    direction: rtl;
    font-family: inherit;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}
#m5mod-tts * { box-sizing: border-box; }

#m5mod-tts .m5mod-tts-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: linear-gradient(135deg, #7c3aed, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
    transition: transform .2s ease, box-shadow .2s ease;
    padding: 0;
    outline: none;
}
#m5mod-tts .m5mod-tts-btn:hover { transform: scale(1.07); box-shadow: 0 8px 26px rgba(0, 0, 0, .45); }

#m5mod-tts .m5mod-tts-panel {
    position: absolute;
    bottom: 68px;
    left: 0;
    width: 250px;
    background: #fff;
    color: #111;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .28);
    padding: 12px;
    display: none;
    animation: m5modTtsFade .18s ease;
}
#m5mod-tts[data-state="open"] .m5mod-tts-panel { display: block; }

@keyframes m5modTtsFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

#m5mod-tts .m5mod-tts-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 6px;
}
#m5mod-tts .m5mod-tts-title { font-weight: 700; font-size: 14px; color: #1f2937; }
#m5mod-tts .m5mod-tts-voice {
    font-size: 10px;
    color: #6b7280;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
}

#m5mod-tts .m5mod-tts-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 10px;
}
#m5mod-tts .m5mod-tts-play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(22, 163, 74, .4);
    transition: transform .15s ease;
    outline: none;
}
#m5mod-tts .m5mod-tts-play:hover { transform: scale(1.06); }
#m5mod-tts .m5mod-tts-stop {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
    outline: none;
}
#m5mod-tts .m5mod-tts-stop:hover { background: #e5e7eb; }

#m5mod-tts .m5mod-tts-speed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 8px;
}
#m5mod-tts .m5mod-tts-speed button {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    font-size: 11px;
    font-weight: 700;
    border-radius: 8px;
    padding: 5px 7px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    outline: none;
}
#m5mod-tts .m5mod-tts-speed button:hover { background: #eef2ff; border-color: #a5b4fc; color: #4338ca; }
#m5mod-tts .m5mod-tts-rate {
    font-size: 12px;
    font-weight: 800;
    color: #4338ca;
    background: #eef2ff;
    border-radius: 8px;
    padding: 5px 6px;
    min-width: 52px;
    text-align: center;
    direction: ltr;
}

#m5mod-tts .m5mod-tts-select {
    display: block;
    width: 100%;
    border: none;
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: transform .15s ease;
    outline: none;
}
#m5mod-tts .m5mod-tts-select:hover { transform: translateY(-1px); }
#m5mod-tts .m5mod-tts-select[hidden] { display: none; }

#m5mod-tts .m5mod-tts-progress {
    height: 6px;
    border-radius: 6px;
    background: #e5e7eb;
    overflow: hidden;
    margin-bottom: 8px;
}
#m5mod-tts .m5mod-tts-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #16a34a, #2563eb);
    transition: width .3s ease;
}

#m5mod-tts .m5mod-tts-status {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    min-height: 16px;
}

/* تظليل الفقرة الجاري قراءتها */
.m5mod-tts-active {
    background: rgba(255, 213, 0, .22) !important;
    box-shadow: 0 0 0 3px rgba(255, 213, 0, .3) !important;
    border-radius: 6px;
    transition: background .25s ease;
}

@media (max-width: 480px) {
    #m5mod-tts .m5mod-tts-panel { width: 225px; }
}