/* ══════════════════════════════════════════════════════
   strong-ia.css
   Estilos del módulo de anotaciones interlineales IA
   ══════════════════════════════════════════════════════ */

/* ── Barra IA bajo los filtros de Strong ─────────────── */
.strong-ia-bar {
    display:      flex;
    align-items:  center;
    gap:          8px;
    padding:      4px 0 2px;
    flex-wrap:    wrap;
    /* Ocupa todo el ancho de .filters */
    grid-column:  1 / -1;
}

.strong-ia-version-wrap {
    display:     flex;
    align-items: center;
    gap:         4px;
    flex:        1;
    min-width:   0;
}

.strong-ia-label {
    font-size:   0.72rem;
    font-weight: 600;
    color:       var(--ia-accent, #7c3aed);
    white-space: nowrap;
}

.strong-ia-version-select,
#strongIaVersion {
    flex:          1;
    min-width:     0;
    font-size:     0.8rem;
    padding:       3px 4px;
    border:        1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    background:    var(--select-bg, #fff);
    color:         var(--text-primary, #111827);
}

/* ── Botón toggle IA ─────────────────────────────────── */
#strongIaToggle {
    display:       inline-flex;
    align-items:   center;
    gap:           4px;
    padding:       3px 8px;
    font-size:     0.75rem;
    border:        1px solid var(--border-color, #d1d5db);
    border-radius: 4px;
    background:    transparent;
    color:         var(--text-muted, #6b7280);
    cursor:        pointer;
    transition:    all 0.2s;
    white-space:   nowrap;
    line-height:   1;
    flex-shrink:   0;
}

#strongIaToggle:hover {
    border-color: var(--ia-accent, #7c3aed);
    color:        var(--ia-accent, #7c3aed);
}

#strongIaToggle.ia-active {
    background:   var(--ia-accent, #7c3aed);
    border-color: var(--ia-accent, #7c3aed);
    color:        #fff;
}

/* ── Filtros clásicos (strong.js) ────────────────────── */
.strong-classic-filters {
    display:  contents; /* se comporta como si no existiera el wrapper */
}

/* ══════════════════════════════════════════════════════
   LÍNEA INTERLINEAL
   ══════════════════════════════════════════════════════ */

/* ── Contenedor de la línea ──────────────────────────── */
.strong-ia-interlinear {
    display:       flex;
    flex-wrap:     wrap;
    gap:           0 6px;
    align-items:   flex-end;
    padding:       5px 6px 4px;
    margin-bottom: 2px;
    background:    var(--ia-bg,     #faf5ff);
    border-left:   2px solid var(--ia-accent, #7c3aed);
    border-radius: 0 4px 4px 0;
    font-size:     0; /* eliminar gap de inline-block */
}

/* ── Columna por token ───────────────────────────────── */
.ia-col {
    display:        inline-flex;
    flex-direction: column;
    align-items:    center;
    gap:            2px;
    padding:        0 3px;
    font-size:      initial;
}

/* ── Fila 1: palabra original (hebreo / griego) ──────── */
.ia-original {
    font-size:   1rem;
    font-weight: 500;
    color:       var(--text-primary, #111827);
    line-height: 1.2;
    white-space: nowrap;
}

/* Hebreo: fuente serif con nikkud, RTL aislado por columna */
.ia-heb {
    font-family:  'SBL Hebrew', 'Ezra SIL', 'Frank Rühl Libre',
                  'Times New Roman', serif;
    font-size:    1.1rem;
    unicode-bidi: isolate; /* RTL solo dentro del span, columna sigue LTR */
    direction:    rtl;
}

/* Griego */
.ia-grk {
    font-family: 'SBL Greek', 'GFS Didot', 'Palatino Linotype',
                 'Times New Roman', serif;
}

/* ── Fila 2: código Strong ───────────────────────────── */
.ia-strong {
    font-family:   monospace;
    font-size:     0.68rem;
    font-weight:   700;
    color:         var(--ia-strong-color, #7c3aed);
    background:    var(--ia-strong-bg,    #ede9fe);
    padding:       1px 3px;
    border-radius: 3px;
    cursor:        pointer;
    white-space:   nowrap;
    transition:    background 0.15s, color 0.15s;
}

.ia-strong:hover {
    background: var(--ia-strong-hover, #c4b5fd);
    color:      #4c1d95;
}

.ia-strong.active {
    background: var(--ia-strong-color, #7c3aed);
    color:      #fff;
}

/* Código null: sin Strong disponible */
.ia-strong-null {
    font-size:   0.65rem;
    color:       var(--text-muted, #d1d5db);
    font-family: monospace;
}

/* ── Fila 3: traducción ──────────────────────────────── */
.ia-trans {
    font-size:     0.7rem;
    color:         var(--text-muted,  #6b7280);
    white-space:   nowrap;
    max-width:     90px;
    overflow:      hidden;
    text-overflow: ellipsis;
    text-align:    center;
    line-height:   1.2;
}

/* ══════════════════════════════════════════════════════
   ESTADOS DE CARGA Y ERROR
   ══════════════════════════════════════════════════════ */

/* ── Fila spinner mientras carga la IA ──────────────── */
.ia-spinner-row {
    display:     flex;
    align-items: center;
    gap:         6px;
    padding:     6px 8px;
    background:  var(--ia-bg, #faf5ff);
    border-left: 2px solid var(--ia-accent, #7c3aed);
    border-radius: 0 4px 4px 0;
    margin-bottom: 2px;
}

.ia-dot-spin {
    display:          inline-block;
    width:            10px;
    height:           10px;
    border:           2px solid var(--ia-accent, #7c3aed);
    border-top-color: transparent;
    border-radius:    50%;
    animation:        ia-spin 0.7s linear infinite;
    flex-shrink:      0;
}

@keyframes ia-spin {
    to { transform: rotate(360deg); }
}

.ia-spin-label {
    font-size:  0.75rem;
    color:      var(--ia-accent, #7c3aed);
    font-style: italic;
}

/* ── Banner de error ─────────────────────────────────── */
.ia-error-banner {
    padding:       6px 12px;
    margin-bottom: 8px;
    background:    #fee2e2;
    color:         #dc2626;
    border-radius: 4px;
    font-size:     0.82rem;
}

/* ══════════════════════════════════════════════════════
   MODO OSCURO
   ══════════════════════════════════════════════════════ */

[data-theme="dark"] .strong-ia-interlinear,
[data-theme="dark"] .ia-spinner-row {
    --ia-bg:     rgba(109, 40, 217, 0.08);
    --ia-accent: #a78bfa;
}

[data-theme="dark"] .ia-strong {
    --ia-strong-color: #a78bfa;
    --ia-strong-bg:    rgba(167, 139, 250, 0.15);
    --ia-strong-hover: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .ia-heb,
[data-theme="dark"] .ia-grk,
[data-theme="dark"] .ia-original {
    color: #e5e7eb;
}

[data-theme="dark"] .ia-trans {
    color: #9ca3af;
}

[data-theme="dark"] #strongIaVersion {
    background: var(--select-bg, #1f2937);
    color:      var(--text-primary, #f9fafb);
    border-color: #374151;
}

[data-theme="dark"] #strongIaToggle {
    border-color: #374151;
    color:        #9ca3af;
}

[data-theme="dark"] #strongIaToggle:hover {
    border-color: #a78bfa;
    color:        #a78bfa;
}

[data-theme="dark"] #strongIaToggle.ia-active {
    background:   #7c3aed;
    border-color: #7c3aed;
    color:        #fff;
}

/* strong-ia.css */

/* ── Fila IA: ocupa toda la anchura disponible ───────── */
.strong-ia-row {
    display:      flex;
    align-items:  center;
    gap:          6px;
    /* Si .filters usa grid, ocupar todas las columnas */
    grid-column:  1 / -1;
}

.strong-ia-label {
    font-size:    0.72rem;
    font-weight:  700;
    color:        var(--ia-accent, #7c3aed);
    white-space:  nowrap;
    flex-shrink:  0;
}

.strong-ia-version-select {
    flex:         1;
    min-width:    0;
    /* Heredar estilos de los selects normales */
    font-size:    inherit;
    padding:      inherit;
    border:       inherit;
    border-radius: inherit;
    background:   inherit;
    color:        inherit;
}

#strongIaToggle {
    display:      inline-flex;
    align-items:  center;
    gap:          4px;
    padding:      4px 12px;
    font-size:    0.78rem;
    font-weight:  600;
    border:       1px solid var(--ia-accent, #7c3aed);
    border-radius: 4px;
    background:   transparent;
    color:        var(--ia-accent, #7c3aed);
    cursor:       pointer;
    transition:   all 0.2s;
    white-space:  nowrap;
    flex-shrink:  0;
}

#strongIaToggle:hover {
    background:   var(--ia-accent-light, #ede9fe);
}

#strongIaToggle.ia-active {
    background:   var(--ia-accent, #7c3aed);
    border-color: var(--ia-accent, #7c3aed);
    color:        #fff;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .strong-ia-bar {
        gap: 6px;
    }

    .ia-trans {
        max-width: 60px;
        font-size: 0.65rem;
    }

    .ia-original {
        font-size: 0.9rem;
    }

    .ia-heb {
        font-size: 1rem;
    }

    .ia-strong {
        font-size: 0.62rem;
    }
}
