/* ═══════════════════════════════════════════════════════════════
   gtk-ticket.css — GTK HablaIP · Pantalla de edición de ticket

   Se carga después de gtk-custom.css y reorganiza el modal de edición:
   cabecera única, columnas con scroll propio y notas que crecen con la
   ventana. Solo afecta a lo que está dentro de #mModalContenido.
   ═══════════════════════════════════════════════════════════════ */

/* ── Cabecera única ──────────────────────────────────────────────
   Reemplaza a las tres bandas apiladas (encabezado, título y
   solicitante) que consumían la parte alta de la pantalla. */
.tk-modal-hd {
    align-items: flex-start;
    padding: .7rem 1.15rem;
    gap: .75rem 1rem;
}

.tk-hd-main {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    flex: 1;
    min-width: 0;
}

.tk-hd-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
}

.tk-hd-sep {
    flex: 1;
    min-width: .5rem;
}

.tk-hd-titulo {
    margin: 0;
    font-size: .96rem;
    font-weight: 650;
    letter-spacing: -.011em;
    line-height: 1.3;
    color: var(--bs-body-color);
}

.tk-hd-sol {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.tk-hd-sol > .ti {
    font-size: 1rem;
    color: var(--gtk-primary, #696cff);
}

.tk-hd-sol-emp {
    font-weight: 600;
    color: var(--bs-body-color);
}

.tk-hd-acciones {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Cuerpo: cada columna scrollea por su cuenta ─────────────────
   Antes el modal entero scrolleaba, así que al bajar a las notas se
   perdían de vista la cabecera y el historial.

   El :has() limita estos ajustes al modal cuando contiene el editor
   de ticket; el resto de las pantallas que usan el mismo modal no se
   ven afectadas. Si el navegador no soporta :has(), todo cae al
   comportamiento anterior sin romperse. */
#mModalVistaPrevia .modal-body:has(.tk-modal-hd) {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* Subtítulo del modal: siempre vacío en esta pantalla, solo ocupaba alto. */
#mModalVistaPrevia .modal-body:has(.tk-modal-hd) > p {
    display: none;
}

#mModalVistaPrevia .modal-body:has(.tk-modal-hd) > #mModalContenido {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#mModalVistaPrevia .modal-dialog.modal-fullscreen .modal-content {
    height: 100vh;
}

.tk-modal-body-row {
    flex: 1;
    min-height: 0;
}

.tk-modal-left,
.tk-modal-right {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tk-modal-left-inner {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .9rem 1rem;
    min-height: 100%;
}

/* ── Bloques del formulario ──────────────────────────────────── */
.tk-ms {
    padding: .8rem .9rem;
}

.tk-ms-hd {
    margin-bottom: .55rem;
}

/* Transcripción plegable */
.tk-detalle > summary {
    cursor: pointer;
    list-style: none;
    margin-bottom: 0;
    align-items: center;
}

.tk-detalle > summary::-webkit-details-marker {
    display: none;
}

.tk-detalle[open] > summary {
    margin-bottom: .55rem;
}

.tk-detalle-flecha {
    margin-left: auto;
    transition: transform var(--gtk-dur, .16s) var(--gtk-ease, ease);
}

.tk-detalle[open] .tk-detalle-flecha {
    transform: rotate(180deg);
}

.tk-transcripcion {
    background-color: rgba(0, 0, 0, .04);
    cursor: default;
    resize: vertical;
}

html.dark-style .tk-transcripcion {
    background-color: rgba(255, 255, 255, .05);
}

/* Notas: ocupan todo el alto sobrante de la columna en vez de tener
   una altura fija que dejaba huecos o forzaba scroll doble. */
.tk-ms-notas {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 13rem;
}

.tk-notas {
    flex: 1;
    resize: vertical;
    min-height: 11rem;
}

/* ── Historial: encabezado fijo mientras se recorre la actividad ── */
.tk-modal-right .card-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-tertiary-bg, #f5f5f9);
}

/* ── Móvil ───────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* Sin dos columnas: vuelve el scroll normal de la página. */
    #mModalVistaPrevia .modal-body:has(.tk-modal-hd) {
        overflow: auto;
    }

    .tk-modal-left,
    .tk-modal-right {
        height: auto;
        overflow-y: visible;
    }

    .tk-notas {
        min-height: 14rem;
    }

    .tk-hd-acciones {
        width: 100%;
    }

    .tk-hd-acciones .tk-sol-hero-btn {
        flex: 1;
        justify-content: center;
    }
}
