/* ============================================================
   OkDicom.Chat.UI — Hoja de estilos principal
   Todos los tokens y reglas están scoped bajo .okd-chat.
   NUNCA se usa :root ni selectores de elemento sin prefijo.
   [CANDIDATA A CONVENCIÓN]: patrón scope CSS bajo clase contenedora
   ============================================================ */

/* ------------------------------------------------------------
   Fuentes auto-hospedadas (sin Google Fonts ni CDN externo).
   CA8: src apunta a _content/OkDicom.Chat.UI/fonts/*.woff2
   [CANDIDATA A CONVENCIÓN]: fuentes auto-hospedadas para CSP estricta
   ------------------------------------------------------------ */
@font-face {
    font-family: 'Geist';
    src: url('../fonts/Geist-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist';
    src: url('../fonts/Geist-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'GeistMono';
    src: url('../fonts/GeistMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ------------------------------------------------------------
   Tokens de diseño (warm terracotta). Todos bajo .okd-chat.
   --okd-accent es sobreescribible desde el host.
   ------------------------------------------------------------ */
.okd-chat {
    /* Color de acento principal — sobreescribible desde el host.
       Pareja HEX + RGB: la versión RGB permite usar rgba() en sombras y bordes translúcidos
       (formato moderno `rgb(var(--okd-accent-rgb) / 0.35)`). Si el host sobrescribe --okd-accent
       debe sobrescribir TAMBIÉN --okd-accent-rgb con la misma tripleta. */
    --okd-accent:           #c96442;
    --okd-accent-rgb:       201 100 66;
    --okd-accent-dark:      #a84f32;
    --okd-accent-light:     #f0c4b4;
    --okd-accent-light-rgb: 240 196 180;
    --okd-accent-subtle:    #fdf1ed;

    /* Neutros */
    --okd-surface:        #ffffff;
    --okd-surface-dim:    #faf7f5;
    --okd-border:         #e8ddd8;
    --okd-border-light:   #f2ece9;
    --okd-text-primary:   #1a1210;
    --okd-text-secondary: #6b4f47;
    --okd-text-muted:     #9c8580;
    --okd-text-on-accent: #ffffff;

    /* Burbujas de mensajes */
    --okd-bubble-user-bg: var(--okd-accent);
    --okd-bubble-user-fg: var(--okd-text-on-accent);
    --okd-bubble-ai-bg:   var(--okd-surface-dim);
    --okd-bubble-ai-fg:   var(--okd-text-primary);

    /* Sombras */
    --okd-shadow-dock:    0 4px 24px rgb(var(--okd-accent-rgb) / 0.25), 0 1px 4px rgba(0,0,0,0.08);
    --okd-shadow-panel:   0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

    /* Tipografía */
    --okd-font-sans: 'Geist', system-ui, -apple-system, sans-serif;
    --okd-font-mono: 'GeistMono', ui-monospace, monospace;
    --okd-font-size-base: 14px;
    --okd-font-size-sm:   12px;
    --okd-font-size-lg:   16px;

    /* Radios */
    --okd-radius-sm:   8px;
    --okd-radius-md:   16px;
    --okd-radius-lg:   24px;
    --okd-radius-full: 9999px;

    /* Transiciones */
    --okd-transition-fast:   120ms ease;
    --okd-transition-normal: 220ms ease;
    --okd-transition-morph:  200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index — debe quedar por encima de SfDialog/SfPopup (que llegan a ~10000 en escenarios
       anidados de Syncfusion) y por debajo de SfSpinner y SfToast cuando sean críticos. */
    --okd-z-dock:  99990;
    --okd-z-panel: 99991;
    --okd-z-voice: 99995; /* overlay de voz: por encima de dock y panel */

    /* Orbe de voz */
    --okd-orb-size: 280px;

    font-family: var(--okd-font-sans);
    font-size: var(--okd-font-size-base);
    box-sizing: border-box;
}

.okd-chat *,
.okd-chat *::before,
.okd-chat *::after {
    box-sizing: inherit;
}

/* ------------------------------------------------------------
   Drop-zones (guías visuales durante el arrastre)
   ------------------------------------------------------------ */
.okd-chat__drop-zone {
    position: fixed;
    right: 0;
    width: 72px;
    border: 2px dashed var(--okd-accent-light);
    border-radius: var(--okd-radius-md);
    background: rgb(var(--okd-accent-light-rgb) / 0.08);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--okd-transition-normal);
    z-index: calc(var(--okd-z-dock) - 1);
}

.okd-chat__drop-zone--visible {
    opacity: 1;
}

.okd-chat__drop-zone--top {
    top: 16px;
    height: 80px;
}

.okd-chat__drop-zone--bottom {
    bottom: 16px;
    height: 80px;
}

/* ------------------------------------------------------------
   Dock (manija flotante): burbuja ↔ pestaña
   El morfo se controla con CSS custom properties que JS actualiza.
   ------------------------------------------------------------ */
.okd-chat__dock {
    position: fixed;
    right: var(--okd-dock-right, 24px);
    bottom: var(--okd-dock-bottom, 24px);
    width: var(--okd-dock-w, 56px);
    height: var(--okd-dock-h, 56px);
    border-radius: var(--okd-dock-radius, 28px);
    background: var(--okd-accent);
    color: var(--okd-text-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--okd-z-dock);
    box-shadow: var(--okd-shadow-dock);
    border: none;
    padding: 0;
    transition:
        width  var(--okd-transition-morph),
        height var(--okd-transition-morph),
        border-radius var(--okd-transition-morph),
        right  var(--okd-transition-morph),
        bottom var(--okd-transition-morph),
        background-color var(--okd-transition-fast);
    touch-action: none; /* necesario para pointer events en touch */
    user-select: none;
    -webkit-user-select: none;
}

.okd-chat__dock:hover {
    background: var(--okd-accent-dark);
}

.okd-chat__dock:focus-visible {
    outline: 2px solid var(--okd-accent);
    outline-offset: 3px;
}

/* El dock en modo "arrastrando" elimina transición para respuesta inmediata */
.okd-chat__dock--dragging {
    transition: none !important;
    cursor: grabbing;
}

/* Label vertical en modo pestaña */
.okd-chat__dock-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: var(--okd-font-size-sm);
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: var(--okd-dock-label-opacity, 0);
    transition: opacity var(--okd-transition-normal);
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
}

.okd-chat__dock-icon {
    opacity: var(--okd-dock-icon-opacity, 1);
    transition: opacity var(--okd-transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
}

/* ------------------------------------------------------------
   Panel de chat
   ------------------------------------------------------------ */
.okd-chat__panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 400px;
    /* Altura inicial. Limitada por max-height; tras un resize manual el JS aplica
       height/width inline y el panel se mantiene en ese tamaño hasta nuevo resize. */
    height: 520px;
    max-width: 80vw;
    max-height: 90vh;
    min-width: 360px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    background: var(--okd-surface);
    border-radius: var(--okd-radius-lg);
    border: 1px solid var(--okd-border);
    box-shadow: var(--okd-shadow-panel);
    z-index: var(--okd-z-panel);
    overflow: hidden;
    transform-origin: bottom right;
    transition:
        opacity var(--okd-transition-normal),
        transform var(--okd-transition-normal);
}

/* Handle de redimensionamiento en la esquina superior-izquierda.
   El panel está anclado a bottom-right, así que la esquina opuesta (top-left)
   es la natural para agarrar y arrastrar. */
.okd-chat__resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: transparent;
    z-index: 2;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.okd-chat__resize-handle::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 9px;
    height: 9px;
    border-top: 2px solid var(--okd-text-muted);
    border-left: 2px solid var(--okd-text-muted);
    border-top-left-radius: 3px;
    opacity: 0.45;
    transition: opacity var(--okd-transition-fast), border-color var(--okd-transition-fast);
}

.okd-chat__resize-handle:hover::after,
.okd-chat__resize-handle--active::after {
    opacity: 1;
    border-color: var(--okd-accent);
}

/* Durante el resize, deshabilitar la transition del panel para respuesta inmediata */
.okd-chat__panel--resizing {
    transition: none !important;
}

.okd-chat__panel--hidden {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
    pointer-events: none;
}

.okd-chat__panel--visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Cabecera del panel */
.okd-chat__panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--okd-border-light);
    background: var(--okd-surface-dim);
    flex-shrink: 0;
}

.okd-chat__panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: var(--okd-font-size-base);
    color: var(--okd-text-primary);
}

.okd-chat__panel-title-icon {
    color: var(--okd-accent);
    display: flex;
    align-items: center;
}

.okd-chat__panel-close {
    background: none;
    border: none;
    color: var(--okd-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--okd-radius-sm);
    display: flex;
    align-items: center;
    transition: color var(--okd-transition-fast), background var(--okd-transition-fast);
}

.okd-chat__panel-close:hover {
    color: var(--okd-text-primary);
    background: var(--okd-border-light);
}

/* Área de mensajes */
.okd-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.okd-chat__messages::-webkit-scrollbar {
    width: 4px;
}

.okd-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.okd-chat__messages::-webkit-scrollbar-thumb {
    background: var(--okd-border);
    border-radius: var(--okd-radius-full);
}

/* Mensaje vacío (bienvenida) */
.okd-chat__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--okd-text-muted);
    text-align: center;
    padding: 24px;
}

.okd-chat__empty-icon {
    color: var(--okd-accent-light);
    opacity: 0.7;
}

.okd-chat__empty-title {
    font-weight: 500;
    font-size: var(--okd-font-size-lg);
    color: var(--okd-text-secondary);
}

.okd-chat__empty-subtitle {
    font-size: var(--okd-font-size-sm);
    color: var(--okd-text-muted);
    max-width: 240px;
}

/* Burbujas de mensajes */
.okd-chat__bubble {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.okd-chat__bubble--user {
    align-self: flex-end;
    align-items: flex-end;
}

.okd-chat__bubble--assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.okd-chat__bubble-content {
    padding: 10px 14px;
    border-radius: var(--okd-radius-md);
    font-size: var(--okd-font-size-base);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.okd-chat__bubble--user .okd-chat__bubble-content {
    background: var(--okd-bubble-user-bg);
    color: var(--okd-bubble-user-fg);
    border-bottom-right-radius: 4px;
}

.okd-chat__bubble--assistant .okd-chat__bubble-content {
    background: var(--okd-bubble-ai-bg);
    color: var(--okd-bubble-ai-fg);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--okd-border-light);
}

/* ------------------------------------------------------------
   Markdown dentro de las burbujas del asistente.
   La variante --markdown elimina `white-space: pre-wrap` (rompe el HTML)
   y aporta tipografía para listas, code blocks, tablas y citas.
   ------------------------------------------------------------ */
.okd-chat__bubble-content--markdown {
    white-space: normal;
}

.okd-chat__bubble-content--markdown > *:first-child { margin-top: 0; }
.okd-chat__bubble-content--markdown > *:last-child  { margin-bottom: 0; }

.okd-chat__bubble-content--markdown p {
    margin: 0 0 8px 0;
}

.okd-chat__bubble-content--markdown strong { font-weight: 600; }
.okd-chat__bubble-content--markdown em     { font-style: italic; }
.okd-chat__bubble-content--markdown s      { text-decoration: line-through; }

.okd-chat__bubble-content--markdown ul,
.okd-chat__bubble-content--markdown ol {
    margin: 4px 0 8px 0;
    padding-left: 22px;
}

.okd-chat__bubble-content--markdown li { margin: 2px 0; }
.okd-chat__bubble-content--markdown li > p { margin: 0; }

.okd-chat__bubble-content--markdown h1,
.okd-chat__bubble-content--markdown h2,
.okd-chat__bubble-content--markdown h3,
.okd-chat__bubble-content--markdown h4,
.okd-chat__bubble-content--markdown h5,
.okd-chat__bubble-content--markdown h6 {
    margin: 8px 0 4px 0;
    font-weight: 600;
    line-height: 1.3;
}

.okd-chat__bubble-content--markdown h1 { font-size: 1.20em; }
.okd-chat__bubble-content--markdown h2 { font-size: 1.12em; }
.okd-chat__bubble-content--markdown h3 { font-size: 1.06em; }
.okd-chat__bubble-content--markdown h4,
.okd-chat__bubble-content--markdown h5,
.okd-chat__bubble-content--markdown h6 { font-size: 1.00em; }

.okd-chat__bubble-content--markdown code {
    font-family: var(--okd-font-mono);
    font-size: 0.92em;
    background: var(--okd-border-light);
    padding: 1px 5px;
    border-radius: 4px;
    word-break: break-word;
}

.okd-chat__bubble-content--markdown pre {
    font-family: var(--okd-font-mono);
    font-size: 0.90em;
    background: var(--okd-border-light);
    border: 1px solid var(--okd-border);
    border-radius: var(--okd-radius-sm);
    padding: 8px 10px;
    margin: 6px 0;
    overflow-x: auto;
    white-space: pre;
}

.okd-chat__bubble-content--markdown pre code {
    background: transparent;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
    word-break: normal;
}

.okd-chat__bubble-content--markdown a {
    color: var(--okd-accent);
    text-decoration: underline;
}

.okd-chat__bubble-content--markdown a:hover {
    color: var(--okd-accent-dark);
}

.okd-chat__bubble-content--markdown blockquote {
    border-left: 3px solid var(--okd-border);
    padding-left: 10px;
    margin: 6px 0;
    color: var(--okd-text-secondary);
}

.okd-chat__bubble-content--markdown hr {
    border: 0;
    border-top: 1px solid var(--okd-border);
    margin: 8px 0;
}

.okd-chat__bubble-content--markdown table {
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 0.94em;
}

.okd-chat__bubble-content--markdown th,
.okd-chat__bubble-content--markdown td {
    border: 1px solid var(--okd-border);
    padding: 4px 8px;
    text-align: left;
}

.okd-chat__bubble-content--markdown th {
    background: var(--okd-border-light);
    font-weight: 600;
}

.okd-chat__bubble-content--markdown input[type="checkbox"] {
    margin-right: 4px;
    pointer-events: none;
}

/* Typing dots */
.okd-chat__typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
}

.okd-chat__typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--okd-text-muted);
    animation: okd-chat-bounce 1.2s infinite ease-in-out;
    display: block;
}

.okd-chat__typing-dots span:nth-child(1) { animation-delay: 0s; }
.okd-chat__typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.okd-chat__typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes okd-chat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* Sugerencias rápidas */
.okd-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 0;
    flex-shrink: 0;
}

.okd-chat__suggestion {
    background: var(--okd-accent-subtle);
    border: 1px solid var(--okd-accent-light);
    color: var(--okd-accent-dark);
    border-radius: var(--okd-radius-full);
    padding: 5px 12px;
    font-size: var(--okd-font-size-sm);
    font-family: var(--okd-font-sans);
    cursor: pointer;
    transition:
        background var(--okd-transition-fast),
        border-color var(--okd-transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.okd-chat__suggestion:hover {
    background: var(--okd-accent-light);
    border-color: var(--okd-accent);
}

/* Composer (área de entrada) */
.okd-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--okd-border-light);
    background: var(--okd-surface);
    flex-shrink: 0;
}

.okd-chat__input {
    flex: 1;
    border: 1px solid var(--okd-border);
    border-radius: var(--okd-radius-md);
    padding: 9px 13px;
    font-family: var(--okd-font-sans);
    font-size: var(--okd-font-size-base);
    color: var(--okd-text-primary);
    background: var(--okd-surface);
    resize: none;
    outline: none;
    transition: border-color var(--okd-transition-fast);
    max-height: 120px;
    min-height: 40px;
    line-height: 1.5;
    overflow-y: auto;
}

.okd-chat__input::placeholder {
    color: var(--okd-text-muted);
}

.okd-chat__input:focus {
    border-color: var(--okd-accent);
}

.okd-chat__input:disabled {
    background: var(--okd-surface-dim);
    color: var(--okd-text-muted);
    cursor: not-allowed;
}

/* Botones del composer */
.okd-chat__composer-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--okd-radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background var(--okd-transition-fast),
        opacity var(--okd-transition-fast);
    flex-shrink: 0;
    padding: 0;
}

.okd-chat__composer-btn--send {
    background: var(--okd-accent);
    color: var(--okd-text-on-accent);
}

.okd-chat__composer-btn--send:hover:not(:disabled) {
    background: var(--okd-accent-dark);
}

.okd-chat__composer-btn--send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.okd-chat__composer-btn--stop {
    background: none;
    color: var(--okd-text-muted);
    border: 1px solid var(--okd-border);
}

.okd-chat__composer-btn--stop:hover {
    color: var(--okd-accent);
    background: var(--okd-surface-dim);
    border-color: var(--okd-accent-light);
}

.okd-chat__composer-btn--mic {
    background: none;
    color: var(--okd-text-muted);
    border: 1px solid var(--okd-border);
}

.okd-chat__composer-btn--mic:hover {
    color: var(--okd-text-secondary);
    background: var(--okd-surface-dim);
}

/* Tarjeta inline */
.okd-chat__inline-card {
    background: var(--okd-surface-dim);
    border: 1px solid var(--okd-border);
    border-radius: var(--okd-radius-md);
    overflow: hidden;
    font-size: var(--okd-font-size-sm);
}

.okd-chat__inline-card-title {
    padding: 8px 12px;
    font-weight: 500;
    color: var(--okd-text-secondary);
    background: var(--okd-border-light);
    border-bottom: 1px solid var(--okd-border);
}

.okd-chat__inline-card-body {
    padding: 10px 12px;
    color: var(--okd-text-primary);
}

/* Mensaje de error dentro del chat */
.okd-chat__error-notice {
    font-size: var(--okd-font-size-sm);
    color: #b94040;
    background: #fdf0f0;
    border: 1px solid #f5c6c6;
    border-radius: var(--okd-radius-sm);
    padding: 6px 10px;
    margin-top: 4px;
}

/* Tooltip del botón Mic (Fase A: inerte) */
.okd-chat__mic-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--okd-text-primary);
    color: var(--okd-text-on-accent);
    font-size: var(--okd-font-size-sm);
    padding: 5px 10px;
    border-radius: var(--okd-radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--okd-transition-fast);
    z-index: calc(var(--okd-z-panel) + 1);
}

.okd-chat__mic-wrapper {
    position: relative;
}

.okd-chat__mic-wrapper:hover .okd-chat__mic-tooltip {
    opacity: 1;
}

/* Responsivo: en pantallas muy pequeñas, el panel ocupa casi todo el ancho */
@media (max-width: 480px) {
    .okd-chat__panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
    }
}

/* ============================================================
   FASE B — Voz: overlay, WaterOrb, transcripción
   Todas las reglas bajo .okd-chat (mismo scope que Fase A).
   ============================================================ */

/* ------------------------------------------------------------
   Overlay full-screen del modo voz (R1, R5)
   z-index: --okd-z-voice (3000) — por encima del dock/panel,
   por debajo de SfSpinner (9999) — CA9.
   ------------------------------------------------------------ */
.okd-chat__voice-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--okd-z-voice);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 24px 32px;

    /* Scrim oscuro con radial-gradient + backdrop-blur.
       Fallback: background opaco si backdrop-filter no está soportado. */
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.40), rgba(0, 0, 0, 0.85));
    background-color: rgba(0, 0, 0, 0.75); /* fallback para navegadores sin radial-gradient */
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);

    font-family: var(--okd-font-sans);
    color: var(--okd-text-on-accent);
    box-sizing: border-box;
}

/* Cabecera del overlay */
.okd-chat__voice-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.okd-chat__voice-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: #ffffff;
    text-transform: uppercase;
}

.okd-chat__voice-title-icon {
    color: var(--okd-accent-light);
    display: flex;
    align-items: center;
}

.okd-chat__voice-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--okd-font-size-sm);
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.04em;
    min-height: 20px;
}

.okd-chat__voice-timer {
    font-family: var(--okd-font-mono);
    font-size: var(--okd-font-size-sm);
    color: rgba(255, 255, 255, 0.50);
}

/* Contenedor central del orbe */
.okd-chat__voice-orb-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

/* Área de transcripción */
.okd-chat__voice-transcript {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    flex-shrink: 0;
    text-align: center;
    min-height: 80px;
}

.okd-chat__voice-transcript-label {
    font-size: var(--okd-font-size-sm);
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.50);
    text-transform: uppercase;
}

.okd-chat__voice-transcript-text {
    font-size: 18px;
    line-height: 1.5;
    color: #ffffff;
    word-break: break-word;
}

.okd-chat__voice-transcript-final {
    color: #ffffff;
}

.okd-chat__voice-transcript-interim {
    color: rgba(255, 255, 255, 0.55);
}

/* Sprint 5 — texto de la respuesta del asistente (streaming, mientras suena el TTS) */
.okd-chat__voice-transcript-text--ai {
    color: rgba(255, 255, 255, 0.92);
    font-style: italic;
}

.okd-chat__voice-error {
    font-size: var(--okd-font-size-sm);
    color: #f8a0a0;
    background: rgba(180, 60, 60, 0.25);
    border: 1px solid rgba(200, 80, 80, 0.35);
    border-radius: var(--okd-radius-sm);
    padding: 6px 12px;
    max-width: 360px;
}

.okd-chat__voice-privacy-notice {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.28);
    margin-top: 4px;
}

/* Controles inferiores */
.okd-chat__voice-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-shrink: 0;
    padding-top: 8px;
}

.okd-chat__voice-ctrl-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--okd-radius-full);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.80);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background var(--okd-transition-fast),
        color var(--okd-transition-fast),
        border-color var(--okd-transition-fast);
    padding: 0;
}

.okd-chat__voice-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

.okd-chat__voice-ctrl-btn--close {
    width: 40px;
    height: 40px;
    background: rgba(200, 80, 60, 0.20);
    border-color: rgba(200, 80, 60, 0.35);
    color: rgba(255, 180, 160, 0.90);
}

.okd-chat__voice-ctrl-btn--close:hover {
    background: rgba(200, 80, 60, 0.35);
    border-color: rgba(200, 80, 60, 0.55);
    color: #ffffff;
}

/* ------------------------------------------------------------
   WaterOrb — tres capas concéntricas animadas (R2)
   Sin librerías externas. @keyframes con prefijo okd-chat-orb-*.
   ------------------------------------------------------------ */

.okd-chat__orb {
    position: relative;
    width: var(--okd-orb-size);
    height: var(--okd-orb-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Anillos */
.okd-chat__orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

/* Núcleo central */
.okd-chat__orb-core {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--okd-accent);
    opacity: 0.7;
}

/* -- Estilo: rings (por defecto) -- */
.okd-chat__orb--rings .okd-chat__orb-ring--a {
    width: 100%;
    height: 100%;
    border-color: rgb(var(--okd-accent-rgb) / 0.35);
    animation: okd-chat-orb-pulse-a 3s ease-in-out infinite;
}

.okd-chat__orb--rings .okd-chat__orb-ring--b {
    width: 75%;
    height: 75%;
    border-color: rgb(var(--okd-accent-rgb) / 0.50);
    animation: okd-chat-orb-pulse-b 3s ease-in-out infinite;
    animation-delay: 0.5s;
}

.okd-chat__orb--rings .okd-chat__orb-ring--c {
    width: 50%;
    height: 50%;
    border-color: rgb(var(--okd-accent-rgb) / 0.70);
    animation: okd-chat-orb-pulse-a 3s ease-in-out infinite;
    animation-delay: 1s;
}

/* -- Estilo: glow -- */
.okd-chat__orb--glow .okd-chat__orb-ring--a {
    width: 100%;
    height: 100%;
    border-color: rgb(var(--okd-accent-rgb) / 0.20);
    box-shadow: 0 0 40px 12px rgb(var(--okd-accent-rgb) / 0.25);
    animation: okd-chat-orb-pulse-a 3s ease-in-out infinite;
}

.okd-chat__orb--glow .okd-chat__orb-ring--b {
    width: 70%;
    height: 70%;
    border-color: rgb(var(--okd-accent-rgb) / 0.40);
    box-shadow: 0 0 24px 8px rgb(var(--okd-accent-rgb) / 0.30);
    animation: okd-chat-orb-pulse-b 3s ease-in-out infinite;
    animation-delay: 0.4s;
}

.okd-chat__orb--glow .okd-chat__orb-ring--c {
    width: 45%;
    height: 45%;
    border-color: rgb(var(--okd-accent-rgb) / 0.65);
    box-shadow: 0 0 16px 6px rgb(var(--okd-accent-rgb) / 0.40);
    animation: okd-chat-orb-pulse-a 3s ease-in-out infinite;
    animation-delay: 0.8s;
}

.okd-chat__orb--glow .okd-chat__orb-core {
    box-shadow: 0 0 20px 8px rgb(var(--okd-accent-rgb) / 0.60);
}

/* -- Estilo: wireframe -- */
.okd-chat__orb--wireframe .okd-chat__orb-ring--a {
    width: 100%;
    height: 100%;
    border-color: rgb(var(--okd-accent-rgb) / 0.30);
    border-style: dashed;
    animation: okd-chat-orb-spin 8s linear infinite;
}

.okd-chat__orb--wireframe .okd-chat__orb-ring--b {
    width: 72%;
    height: 72%;
    border-color: rgb(var(--okd-accent-rgb) / 0.45);
    border-style: dashed;
    animation: okd-chat-orb-spin 5s linear infinite reverse;
}

.okd-chat__orb--wireframe .okd-chat__orb-ring--c {
    width: 44%;
    height: 44%;
    border-color: rgb(var(--okd-accent-rgb) / 0.60);
    animation: okd-chat-orb-pulse-b 3s ease-in-out infinite;
}

.okd-chat__orb--wireframe .okd-chat__orb-core {
    background: none;
    border: 2px solid var(--okd-accent);
    opacity: 0.6;
}

/* -- Modificadores de estado (velocidad según EstadoVoz) -- */
.okd-chat__orb--estado-inactivo .okd-chat__orb-ring {
    animation-play-state: paused;
    opacity: 0.30;
}

.okd-chat__orb--estado-escuchando .okd-chat__orb-ring {
    animation-play-state: running;
    animation-duration: 2.5s;
}

.okd-chat__orb--estado-respondiendo .okd-chat__orb-ring {
    animation-play-state: running;
    animation-duration: 1.2s; /* más rápido durante TTS */
    border-color: rgb(var(--okd-accent-light-rgb) / 0.75); /* color más cálido */
}

.okd-chat__orb--estado-respondiendo .okd-chat__orb-core {
    background: var(--okd-accent-light);
}

/* @keyframes con prefijo okd-chat-orb-* para no colisionar con host */
@keyframes okd-chat-orb-pulse-a {
    0%, 100% { transform: scale(1);    opacity: 0.40; }
    50%       { transform: scale(1.08); opacity: 0.80; }
}

@keyframes okd-chat-orb-pulse-b {
    0%, 100% { transform: scale(0.96); opacity: 0.55; }
    50%       { transform: scale(1.04); opacity: 0.90; }
}

@keyframes okd-chat-orb-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Responsivo voz: en pantallas pequeñas reducir el orbe */
@media (max-width: 480px) {
    .okd-chat {
        --okd-orb-size: 200px;
    }

    .okd-chat__voice-overlay {
        padding: 24px 16px 20px;
    }

    .okd-chat__voice-title {
        font-size: 18px;
    }
}

/* ============================================================
   Modo voz COMPACTO — burbuja flotante en esquina bottom-right.
   Se activa con _modoCompacto en VoiceMode.razor.cs. Mantiene el
   orb (mini), el timer pequeño, una transcripción ultra-resumida
   y los controles esenciales. NO usa backdrop ni inset:0.
   ============================================================ */
.okd-chat__voice-overlay--compact {
    inset: auto;
    bottom: 24px;
    right: 24px;
    width: 280px;
    max-height: 380px;
    padding: 16px 14px 12px;

    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95));
    background-color: rgba(0, 0, 0, 0.90);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--okd-radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

    /* anula el backdrop-filter heredado: el viewport detrás queda totalmente operable */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* Cabecera compacta: título y status en una línea */
.okd-chat__voice-overlay--compact .okd-chat__voice-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-title {
    font-size: 13px;
    letter-spacing: 0.06em;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-status {
    font-size: 11px;
}

/* Orb muy reducido */
.okd-chat__voice-overlay--compact {
    --okd-orb-size: 96px;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-orb-container {
    flex: 0 0 auto;
    padding: 8px 0;
}

/* Transcripción: solo 1 línea con elipsis para no inflar la burbuja */
.okd-chat__voice-overlay--compact .okd-chat__voice-transcript {
    max-width: 100%;
    min-height: 0;
    gap: 4px;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-transcript-label {
    display: none;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-transcript-text {
    font-size: 12px;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-privacy-notice {
    display: none;   /* en compacto sobra; reaparece en full */
}

.okd-chat__voice-overlay--compact .okd-chat__voice-error {
    font-size: 11px;
    padding: 4px 8px;
}

/* Controles más pequeños y juntos */
.okd-chat__voice-overlay--compact .okd-chat__voice-controls {
    gap: 8px;
    padding-top: 4px;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-ctrl-btn {
    width: 36px;
    height: 36px;
}

.okd-chat__voice-overlay--compact .okd-chat__voice-ctrl-btn--close {
    width: 30px;
    height: 30px;
}

/* ============================================================
   Highlight de elementos del DOM — Sprint 5
   NO anidado bajo .okd-chat porque destaca elementos del HOST.
   Triple capa de visibilidad:
     1. box-shadow expansivo (halo que pulsa hacia afuera).
     2. outline grueso navy/amarillo con --offset animado.
     3. background-color suave para que se vea en cualquier fondo.
   Usar !important para superar estilos inline o de Syncfusion.
   ============================================================ */
.okai-highlight-pulse {
    position: relative !important;
    z-index: 9999 !important;
    animation: okai-highlight-pulse-all 3.5s ease-in-out 1 !important;
}

@keyframes okai-highlight-pulse-all {
    0% {
        outline: 4px solid rgba(255, 196, 0, 0.95);
        outline-offset: 2px;
        box-shadow: 0 0 0 0    rgba(255, 196, 0, 0.85),
                    0 0 24px 6px rgba(255, 196, 0, 0.60);
        background-color: rgba(255, 240, 180, 0.35);
    }
    50% {
        outline: 4px solid rgba(255, 196, 0, 0.95);
        outline-offset: 7px;
        box-shadow: 0 0 0 18px rgba(255, 196, 0, 0.00),
                    0 0 32px 12px rgba(255, 196, 0, 0.45);
        background-color: rgba(255, 240, 180, 0.18);
    }
    100% {
        outline: 4px solid rgba(255, 196, 0, 0.00);
        outline-offset: 10px;
        box-shadow: 0 0 0 0 rgba(255, 196, 0, 0),
                    0 0 0 0 rgba(255, 196, 0, 0);
        background-color: rgba(255, 240, 180, 0.00);
    }
}

@media (prefers-reduced-motion: reduce) {
    .okai-highlight-pulse {
        animation: none !important;
        outline: 4px solid rgba(255, 196, 0, 0.9) !important;
        outline-offset: 4px !important;
        background-color: rgba(255, 240, 180, 0.30) !important;
    }
}
