/* CSS para Solo Lectura: Oculta botones automáticamente */

/* Cuando el body tiene la clase 'solo-lectura', ocultar botones de acción excepto:
   - Enlaces con href (navegación)
   - Botones que abren modales (data-toggle="modal" o data-target)
   - Botones con clases de excepción (.botonOrientacion, .allow-solo-lectura)
*/

/* Ocultar botones de acción por defecto */
body.solo-lectura button:not(.botonOrientacion):not(.allow-solo-lectura):not([data-toggle="modal"]):not([data-target]),
body.solo-lectura .btn:not(.botonOrientacion):not(.allow-solo-lectura):not([data-toggle="modal"]):not([data-target]):not(a),
body.solo-lectura .hidden-solo-lectura {
    display: none !important;
}

/* Ocultar botones con iconos de edición/acción incluso si tienen modal o href */
body.solo-lectura button:has(.bx-plus),
body.solo-lectura .btn:has(.bx-plus),
body.solo-lectura a.btn:has(.bx-plus),
body.solo-lectura button:has(.bx-edit),
body.solo-lectura .btn:has(.bx-edit),
body.solo-lectura button:has(.bxs-edit-alt),
body.solo-lectura .btn:has(.bxs-edit-alt),
body.solo-lectura button:has(.bx-trash),
body.solo-lectura .btn:has(.bx-trash),
body.solo-lectura button:has(.bx-check):not([href]),
body.solo-lectura .btn:has(.bx-check):not([href]),
body.solo-lectura button .bx-plus,
body.solo-lectura .btn .bx-plus,
body.solo-lectura [class*="bx-plus"] {
    display: none !important;
}

/* NO ocultar: Enlaces con href (navegación) - excepto botones específicos que deben ocultarse */
body.solo-lectura a[href]:not(.btn-mask):not(#sendPass),
body.solo-lectura a.btn[href]:not(.btn-mask):not(#sendPass) {
    display: inline-block !important;
}

/* NO ocultar: Botones que abren modales SOLO si son de navegación (sin iconos de edición) */
/* Los modales de edición se ocultan por las reglas anteriores */
body.solo-lectura [data-toggle="modal"]:not(:has(.bx-plus)):not(:has(.bx-edit)):not(:has(.bxs-edit-alt)):not(:has(.bx-trash)),
body.solo-lectura [data-target]:not(:has(.bx-plus)):not(:has(.bx-edit)):not(:has(.bxs-edit-alt)):not(:has(.bx-trash)) {
    display: inline-block !important;
}

/* Deshabilitar inputs con onclick submit (en lugar de ocultarlos) */
body.solo-lectura input[onclick*="submit"],
body.solo-lectura input[onclick*="Submit"],
body.solo-lectura input[type="submit"],
body.solo-lectura input[type="button"][onclick*="submit"],
body.solo-lectura input[type="button"][onclick*="Submit"] {
    pointer-events: none !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}
body.solo-lectura input[onclick*="submit"]:disabled,
body.solo-lectura input[onclick*="Submit"]:disabled,
body.solo-lectura input[type="submit"]:disabled {
    opacity: 0.5 !important;
}

/* Deshabilitar switches/checkboxes con onClick submit */
body.solo-lectura input[type="checkbox"][onclick*="submit"],
body.solo-lectura input[type="checkbox"][onClick*="submit"],
body.solo-lectura .custom-control-input[onclick*="submit"],
body.solo-lectura .custom-control-input[onClick*="submit"] {
    pointer-events: none !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* También ocultar botones con la clase botonSoloLectura (sistema antiguo) - excepto si tienen href o modal */
body.solo-lectura .botonSoloLectura:not([href]):not([data-toggle="modal"]):not([data-target]),
body.solo-lectura .botonSoloLecturaGeneral:not([href]):not([data-toggle="modal"]):not([data-target]) {
    display: none !important;
}

/* Ocultar botones específicos de gestión de usuarios (tienen prioridad sobre reglas de enlaces) */
body.solo-lectura .btn-mask,
body.solo-lectura a.btn-mask,
body.solo-lectura a.btn-mask[href],
body.solo-lectura #sendPass,
body.solo-lectura a#sendPass,
body.solo-lectura a#sendPass[href] {
    display: none !important;
}

