/* site-09-records.css: Violence form and AI assistant, record files, directive button, record viewer (26-29).
   Part of the old site.css, split by sections (same order: _Styles.cshtml links them one after the other,
   so the cascade is exactly the same). */

/* =====================================================================
   26. VIOLENCE COMPLAINT FORM (Ley 9283) AND AI WRITING ASSISTANT
   ===================================================================== */

/* --- Preguntas del formulario (Ley 9283) --- */
.q-help {
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.5;
    margin: -6px 0 16px;
}

.q-list {
    display: flex;
    flex-direction: column;
}

.q-subtitle {
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
}

.q-note {
    margin: 12px 0 4px;
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* Una fila = pregunta + respuesta. La respuesta va al lado; si no entra, baja sola. */
.q-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.q-list .q-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

/* Texto de la pregunta (pisa el "label" global, que es más chico y gris) */
.q-row .q-text {
    flex: 1 1 340px;
    min-width: 0;
    margin-bottom: 0;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
}

/* Desplegable de respuesta: alto y ancho propios.
   Necesita dos clases para ganarle a "form .cool-input { width: 100% }". */
.q-row .q-select {
    flex: 0 0 auto;
    width: 175px;
    min-height: 38px;
    height: 38px;
    padding: 0.3rem 2.1rem 0.3rem 0.75rem;
    font-size: 0.9rem;
    background-position: right 0.6rem center;
    background-size: 14px;
}

/* Preguntas clave: las que el formulario marca con asterisco */
.q-flag {
    margin-right: 4px;
    color: var(--text-soft);
    font-weight: 700;
}

/* Preguntas de texto o número: la respuesta va debajo del enunciado */
.q-row-text {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

    .q-row-text .q-text {
        flex: none;
    }

    /* Los textarea del cuestionario son de 2 renglones, no los de 280px del relato */
    .q-row-text textarea.cool-input {
        min-height: 76px;
        padding: 0.5rem 0.75rem;
        line-height: 1.5;
    }

.q-row .q-number {
    width: 140px;
    flex: 0 0 auto;
}

/* Preguntas que dependen de otra respuesta */
.q-children {
    margin: 2px 0 8px 14px;
    padding-left: 14px;
    border-left: 2px solid rgba(34, 211, 238, 0.35);
}

/* Fines estadísticos: clases de violencia */
.q-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.q-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

    .q-check:has(input:checked) {
        border-color: var(--accent);
        background: rgba(34, 211, 238, 0.08);
    }


/* --- Asistente de redacción (IA local) --- */
.story-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.btn-ai {
    background: var(--gradient-vivid);
    color: #fff;
    border: 0;
    font-weight: 600;
}

    .btn-ai:hover {
        color: #fff;
        filter: brightness(1.1);
    }

    .btn-ai:disabled {
        opacity: 0.6;
    }

.ai-panel {
    margin-top: 14px;
    background: var(--panel-2);
    border: 1px solid rgba(168, 85, 247, 0.45);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px rgba(79, 109, 245, 0.15), 0 10px 30px -12px rgba(168, 85, 247, 0.35);
    overflow: hidden;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(168, 85, 247, 0.08);
    border-bottom: 1px solid var(--border-light);
}

.ai-panel-title {
    color: var(--text);
    font-weight: 700;
}

    .ai-panel-title i {
        color: #c084fc;
    }

.ai-view-switch {
    display: inline-flex;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    overflow: hidden;
}

    .ai-view-switch button {
        padding: 4px 12px;
        background: none;
        border: 0;
        color: var(--text-soft);
        font-size: 0.78rem;
    }

        .ai-view-switch button.active {
            background: var(--panel-3);
            color: var(--text);
        }

.ai-loading,
.ai-error {
    padding: 18px 14px;
    font-size: 0.9rem;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-soft);
}

.ai-error {
    color: var(--danger);
}

#aiResult {
    padding: 14px;
}

.ai-diff,
.ai-text {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.7;
}

.ai-diff {
    max-height: 420px;
    padding: 12px;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.ai-del {
    color: #f87171;
    text-decoration: line-through;
    background: rgba(244, 80, 107, 0.10);
}

.ai-ins {
    color: #4ade80;
    background: rgba(22, 201, 141, 0.14);
    border-radius: 3px;
}

.ai-hint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.ai-warnings {
    margin: 0 0 12px;
    padding: 10px 14px 10px 30px;
    background: rgba(247, 166, 59, 0.10);
    border: 1px solid rgba(247, 166, 59, 0.35);
    border-radius: var(--radius);
    color: var(--warning);
    font-size: 0.85rem;
}

.ai-panel-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-light);
}

.ai-undo {
    margin-top: 10px;
    color: var(--success);
    font-size: 0.85rem;
}


/* =====================================================================
   27. RECORD FILES (expediente)
   ===================================================================== */

/* Aviso de que el expediente ya fue enviado a la Fiscalía */
.record-sealed-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-soft);
    font-size: 0.82rem;
    line-height: 1.5;
}

    .record-sealed-note i {
        margin-top: 2px;
        color: var(--muted);
    }

/* El botón de eliminar va dentro de un form: se lo saca de la regla global de "form" */
.record-delete {
    display: inline-flex;
    width: auto;
    max-width: none;
    margin: 0;
}

/* Toda la fila abre el documento: se avisa con el cursor y un realce al pasar */
tr[data-file].is-clickable {
    cursor: pointer;
}

    tr[data-file].is-clickable:hover td {
        background: rgba(255, 255, 255, 0.035);
    }

    tr[data-file].is-clickable:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

/* Candado de los documentos que ya no se pueden eliminar */
.record-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

    /* No reacciona al pasar por encima: no es un botón */
    .record-locked:hover {
        background: var(--panel-2);
        border-color: var(--border);
        color: var(--text);
    }


/* =====================================================================
   28. DIRECTIVE BUTTON (operator card)
   ===================================================================== */

/* En la tarjeta del operador la directiva es sólo un aviso con acceso:
   el detalle y los tildes viven en el expediente. */
.directive-open {
    width: auto;
    max-width: none;
    margin: 0;
}

.btn-directive {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: rgba(247, 166, 59, 0.10);
    border: 1px solid rgba(247, 166, 59, 0.35);
    border-radius: 9px;
    color: var(--warning);
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    transition: var(--transition);
}

    .btn-directive:hover {
        background: rgba(247, 166, 59, 0.18);
        border-color: rgba(247, 166, 59, 0.55);
    }

    /* Ya se cumplieron todos los puntos */
    .btn-directive.is-done {
        background: rgba(22, 201, 141, 0.10);
        border-color: rgba(22, 201, 141, 0.35);
        color: var(--success);
    }

        .btn-directive.is-done:hover {
            background: rgba(22, 201, 141, 0.18);
        }

/* Avance de la directiva, al lado del estado de la tarjeta */
.state-note-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 1px 8px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

    .state-note-badge.is-done {
        background: rgba(22, 201, 141, 0.16);
        color: var(--success);
    }

.btn-directive-badge {
    margin-left: auto;
    padding: 2px 9px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}


/* =====================================================================
   29. RECORD VIEWER (expediente)
   ===================================================================== */

    .file-viewer {
        position: sticky;
        top: 16px;
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        background: rgba(255,255,255,.02);
        overflow: hidden;
    }

    .file-viewer-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px 12px;
        padding: 10px 14px;
        border-bottom: 1px solid var(--border-light);
    }

    /* El título se lee entero: baja de renglón en vez de cortarse */
    .file-viewer-title {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        flex: 1 1 190px;
        min-width: 0;
        padding-top: 7px;
        font-size: .85rem;
        font-weight: 600;
        line-height: 1.35;
        color: var(--text);
    }

        .file-viewer-title i {
            flex: 0 0 auto;
            margin-top: 1px;
            color: var(--accent);
        }

        .file-viewer-title span {
            min-width: 0;
            white-space: normal;
            overflow-wrap: anywhere;
        }

    /* Alto de referencia hasta que el JS lo ajusta a una hoja A4 según el ancho.
       El tope evita que en pantallas anchas el visor se vaya de la ventana. */
    .file-viewer-body {
        height: 70vh;
        min-height: 360px;
        max-height: 88vh;
        background: #525659; /* mismo gris que el visor de PDF del navegador */
    }

        .file-viewer-body iframe {
            width: 100%;
            height: 100%;
            border: 0;
            display: block;
        }

        .file-viewer-body img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }

    .file-viewer-actions {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        margin-left: auto;
    }

    /* Separa las acciones del expediente de las del documento que se está viendo */
    .file-viewer-sep {
        width: 1px;
        height: 22px;
        margin: 0 2px;
        background: var(--border-light);
    }

    /* El botón de eliminar se ve como los demás y sólo se pinta al pasar por encima */
    .file-viewer-actions .btn-delete {
        background: var(--panel-2);
        border-color: var(--border);
        color: var(--text-soft);
    }

        .file-viewer-actions .btn-delete:hover {
            background: var(--danger);
            border-color: var(--danger);
            color: #fff;
        }

    .file-viewer-actions .record-locked {
        background: var(--panel-2);
    }

    .file-viewer.is-book .file-viewer-header {
        background: rgba(77,163,255,.10);
    }

    /* Pantalla completa: el visor ocupa todo, como leer un libro */
    .file-viewer:fullscreen {
        border-radius: 0;
        display: flex;
        flex-direction: column;
        background: #1e1e1e;
    }

        .file-viewer:fullscreen .file-viewer-body {
            flex: 1;
            height: auto;
            max-height: none;
        }

    .doc-order {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        font-size: .75rem;
        font-weight: 700;
        color: var(--text-soft);
        border: 1px solid var(--border-light);
    }

    .docs-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
        padding: 14px 18px;
        border-bottom: 1px solid var(--border);
    }

    .docs-toolbar-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        color: var(--text);
    }

        .docs-toolbar-title i { color: var(--accent); }

    .docs-count {
        font-size: .72rem;
        font-weight: 700;
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--panel-3);
        color: var(--text-soft);
    }

    .docs-empty {
        text-align: center;
        padding: 45px 20px;
        color: var(--muted);
    }

        .docs-empty i { font-size: 2.5rem; }
        .docs-empty h5 { margin: 12px 0 6px; color: var(--text); }
        .docs-empty p { font-size: .85rem; margin: 0; }

    .add-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        flex-wrap: wrap;
    }

    .add-content-head {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 220px;
        flex: 1 1 260px;
    }

    .add-content-form {
        display: flex;
        gap: 10px;
        flex: 1 1 340px;
    }

        .add-content-form select { flex: 1; }
        .add-content-form .add-content-menu { flex: 1; }
        .add-content-menu .dropdown-menu { max-height: 320px; overflow-y: auto; }
        .add-content-form .btn { white-space: nowrap; }

    /* "Agregar contenido" stays still: without the glow and the lift of .card-modern:hover */
    .add-content.card-modern:hover {
        box-shadow: var(--shadow-sm);
        border-color: var(--border);
        transform: none;
    }

    .panel-help {
        color: var(--muted);
        font-size: .85rem;
        margin-bottom: 18px;
    }

    /* ----- Foja útil ----- */
    .drop-zone {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 26px 16px;
        border: 2px dashed var(--border-light);
        border-radius: var(--radius);
        color: var(--text-soft);
        text-align: center;
        cursor: pointer;
        transition: var(--transition-fast);
    }

        .drop-zone i { font-size: 1.8rem; color: var(--accent); }
        .drop-zone small { color: var(--muted); }

        .drop-zone.is-over,
        .drop-zone:hover {
            border-color: var(--accent);
            background: rgba(34,211,238,.06);
        }

    .page-sheet-preview {
        background: #fff;
        color: #000;
        font-family: 'Courier New', monospace;
        font-size: .72rem;
        padding: 14px 16px 40px;
        border-radius: var(--radius-sm);
        line-height: 1.3;
    }

        .page-sheet-preview .sheet-head { display: inline-block; font-weight: 700; }
        .page-sheet-preview .sheet-center { text-align: center; }
        .page-sheet-preview .sheet-legend { margin-top: 8px; text-decoration: underline; }

    .images-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 12px;
        min-height: 220px;
    }

    .images-empty {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 30px;
        text-align: center;
        color: var(--muted);
        border: 1px dashed var(--border-light);
        border-radius: var(--radius);
        font-size: .85rem;
    }

        .images-empty i { font-size: 2rem; }

    .image-card {
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        background: var(--panel-2);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

        .image-card img {
            width: 100%;
            height: 130px;
            object-fit: cover;
            display: block;
            background: #000;
        }

        .image-card .image-tools {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 6px 8px;
            font-size: .75rem;
            color: var(--text-soft);
        }

            .image-card .image-tools button {
                background: none;
                border: 0;
                color: var(--text-soft);
                padding: 2px 5px;
                border-radius: 6px;
            }

                .image-card .image-tools button:hover { background: var(--panel-3); color: var(--text); }
                .image-card .image-tools button:disabled { opacity: .3; }

        .image-card input {
            border: 0;
            border-bottom: 1px solid var(--border-light);
            border-radius: 0;
            font-size: .75rem;
        }

    .image-card.is-processing img { opacity: .4; }

    tr.file-row-active td {
        background: rgba(77,163,255,.08);
    }

    /* ===== Order of the documents (attachmentOrder.js) ===== */
    .docs-reorder-help {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 10px;
        font-size: .78rem;
        color: var(--muted);
    }

        .docs-reorder-help > .bi { color: var(--primary); }

    .doc-order-cell {
        white-space: nowrap;
    }

    .doc-drag {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        margin-right: 4px;
        padding: 0;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: var(--muted);
        font-size: 1rem;
        vertical-align: middle;
        cursor: grab;
        touch-action: none;
    }

        button.doc-drag:hover,
        button.doc-drag:focus-visible {
            color: var(--text);
            background: rgba(148,163,184,.15);
            outline: none;
        }

        button.doc-drag:active { cursor: grabbing; }

    .doc-drag--fixed {
        font-size: .7rem;
        opacity: .55;
        cursor: default;
    }

    tr.doc-row-ghost td {
        background: rgba(77,163,255,.14);
        opacity: .6;
    }

    tr.doc-row-chosen td {
        background: rgba(77,163,255,.08);
    }

    #documentsBody.is-saving {
        opacity: .7;
        pointer-events: none;
    }

    @media (max-width: 991.98px) {
        .file-viewer { position: static; }
        .file-viewer-body { height: 60vh; min-height: 360px; }
    }


/* "Agregar contenido" in its own tab (?open=foja-util / nota / directiva): the modal is the whole page */
.content-tab-modal .modal-dialog.modal-fullscreen .modal-content {
    border-radius: 0;
}

.content-tab-modal .modal-dialog.modal-fullscreen .modal-body {
    padding: 28px clamp(20px, 4vw, 64px);
}

.content-tab-modal .modal-dialog.modal-fullscreen .modal-header,
.content-tab-modal .modal-dialog.modal-fullscreen .modal-footer {
    padding-left: clamp(20px, 4vw, 64px);
    padding-right: clamp(20px, 4vw, 64px);
}

/* The summary behind it is never seen: no scroll of the page underneath */
body.content-tab-page {
    overflow: hidden;
}


/* Pages of "Agregar contenido" (Content/UsefulPage, Content/Note): the whole width, bigger photos */
.content-page {
    max-width: 1500px;
    margin: 0 auto;
}

.useful-page .images-list {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    min-height: 420px;
}

    .useful-page .image-card img {
        height: 220px;
    }

.useful-page .drop-zone {
    min-height: 200px;
}

.content-page .note-body {
    font-family: 'Courier New', monospace;
    min-height: 420px;
}


/* ----- Signed copy of a document (optional) ----- */
/* Column "Firma": the signed copy as a small file card, or a dash */
.signed-cell { text-align: center; }

.signed-file {
    display: inline-flex;
    text-decoration: none;
    border-radius: 9px;
    transition: transform .15s ease, box-shadow .15s ease;
}

    .signed-file:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15, 23, 42, .15); }

.signed-file-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 93, 115, .12);
    color: var(--danger);
    border: 1px solid rgba(255, 93, 115, .2);
    font-size: 1rem;
}

.signed-none { color: var(--muted); opacity: .6; }

.row-menu { width: 44px; text-align: center; }

.signed-doc {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.signed-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 93, 115, .12);
    color: var(--danger);
    border: 1px solid rgba(255, 93, 115, .2);
    flex-shrink: 0;
}

.signed-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

    .signed-list:empty { display: none; }

.signed-sheet {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--panel-2);
    overflow: hidden;
}

    .signed-sheet img { width: 100%; height: 160px; object-fit: cover; display: block; }

.signed-sheet-pdf {
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--danger);
    font-size: 2rem;
}

    .signed-sheet-pdf span { font-size: .8rem; font-weight: 700; }

.signed-sheet-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    font-size: .75rem;
    color: var(--text-soft);
}

    .signed-sheet-tools span { margin-right: auto; }

    .signed-sheet-tools button {
        background: none;
        border: 0;
        color: var(--text-soft);
        padding: 2px 5px;
    }

        .signed-sheet-tools button:disabled { opacity: .35; }

.signed-status { margin-top: 10px; font-size: .82rem; color: var(--text-soft); min-height: 1.2em; }
    .signed-status.is-error { color: var(--danger); font-weight: 600; }
    .signed-status.is-warn { color: var(--warning); font-weight: 600; }

.signed-help { margin: 12px 0 0; font-size: .8rem; color: var(--muted); }
