/**
 * Accessible Chile — Estilos TTS
 * Desarrollado por Gloomer.cl
 *
 * Usa las mismas variables CSS del panel principal (--ac-icon, --ac-bg, etc.)
 * sin tocar ni sobreescribir nada del archivo accessible-chile.css existente.
 * Todos los selectores están prefijados con .ac-tts-* para aislamiento total.
 */

/* ============================================================
   SECCIÓN TTS — separador visual
   ============================================================ */

#ac-tts-section {
    border-top: 1px solid var(--ac-gray-200) !important;
    padding-top: 20px !important;
    margin-top: 4px !important;
}

/* ============================================================
   FILAS DE BOTONES
   ============================================================ */

.ac-tts-row {
    display: flex !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
}

.ac-tts-row:last-child {
    margin-bottom: 0 !important;
}

/* ============================================================
   BOTONES TTS
   Heredan la estética de .ac-feature pero con su propio selector
   para no depender de la clase existente.
   ============================================================ */

.ac-tts-btn {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 10px 8px !important;
    background: var(--ac-gray-50) !important;
    border: 1px solid var(--ac-gray-200) !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
    color: var(--ac-gray-700) !important;
    transition: background 0.2s ease, transform 0.15s ease !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

.ac-tts-btn:hover {
    background: var(--ac-gray-100) !important;
    transform: translateY(-1px) !important;
}

.ac-tts-btn:focus-visible {
    outline: 2px solid var(--ac-icon) !important;
    outline-offset: 2px !important;
}

.ac-tts-btn:active {
    transform: translateY(0) !important;
}

/* Botón "Detener" — color rojo suave para diferenciarlo */
.ac-tts-btn--stop {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

.ac-tts-btn--stop:hover {
    background: #fee2e2 !important;
    border-color: #f87171 !important;
}

/* Botón "Continuar" — tono verde suave */
.ac-tts-btn--resume {
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    color: #16a34a !important;
}

.ac-tts-btn--resume:hover {
    background: #dcfce7 !important;
    border-color: #86efac !important;
}

/* ============================================================
   STATUS — región live
   ============================================================ */

.ac-tts-status {
    font-size: 12px !important;
    color: var(--ac-gray-500) !important;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
    min-height: 18px !important;
    margin-top: 6px !important;
    text-align: center !important;
    font-style: italic !important;
    transition: opacity 0.3s !important;
    line-height: normal !important;
}

/* ============================================================
   MENSAJE DE NO SOPORTE
   ============================================================ */

.ac-tts-unsupported {
    font-size: 12px !important;
    color: #92400e !important;
    background: #fffbeb !important;
    border: 1px solid #fcd34d !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.4 !important;
    margin-top: 8px !important;
}

/* ============================================================
   REDUCED MOTION — respetar preferencia del usuario
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .ac-tts-btn {
        transition: none !important;
    }
}

/* ============================================================
   AISLAMIENTO: proteger botones TTS de funcionalidades del plugin
   (wordSpacing, lineHeight, readableFont, showLinks)
   Misma técnica que el toolbar principal.
   ============================================================ */

html.ac-readableFont  .ac-tts-btn,
html.ac-lineHeight    .ac-tts-btn,
html.ac-wordSpacing   .ac-tts-btn,
html.ac-showLinks     .ac-tts-btn {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-decoration: none !important;
}

/* Dark mode — restaurar colores TTS */
html.ac-theme-dark .ac-tts-btn {
    background: var(--ac-gray-50) !important;
    color: var(--ac-gray-700) !important;
    border-color: var(--ac-gray-200) !important;
}

html.ac-theme-dark .ac-tts-btn--stop {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
}

html.ac-theme-dark .ac-tts-btn--resume {
    background: #f0fdf4 !important;
    color: #16a34a !important;
    border-color: #bbf7d0 !important;
}

html.ac-theme-dark .ac-tts-status {
    color: var(--ac-gray-500) !important;
}
