/* ============================================================
   Read-only profile (Contador)
   ============================================================
   Cuando el body tiene .profile-read-only (perfil Contador), escondemos
   todos los controles que crean/modifican/eliminan datos. Los reportes
   y exportaciones siguen visibles.

   Selectores escondidos por CONVENCIÓN:
     - [data-write] / [data-read-only="hide"]  → opt-in desde HTML
     - .btn-crear, .btn-editar, .btn-eliminar  → AdminLTE legacy
     - botones que contienen "agregar", "crear", "nuevo", "editar",
       "eliminar", "borrar" en su texto son comunes — usar data-write
     - .btnEditCategory, .btnEditProduct, etc. — clases específicas

   Selectores NO escondidos (deliberadamente):
     - .btn-print, .btn-export, .btn-pdf, .btn-excel → el Contador necesita exportar
     - cualquier cosa con data-read-only="keep"
   ============================================================ */

body.profile-read-only .btn-crear,
body.profile-read-only .btn-editar,
body.profile-read-only .btn-eliminar,
body.profile-read-only .btn-activar,
body.profile-read-only .btn-desactivar,
body.profile-read-only [data-write],
body.profile-read-only [data-read-only="hide"],

/* Clases específicas de este ERP (listado mapeado de los módulos) */
body.profile-read-only .btnAgregarCategoria,
body.profile-read-only .btnEditCategory,
body.profile-read-only .btnDeleteCategory,
body.profile-read-only .btnAgregarProducto,
body.profile-read-only .btnEditProduct,
body.profile-read-only .btnDeleteProduct,
body.profile-read-only .btnAgregarCliente,
body.profile-read-only .btnEditClient,
body.profile-read-only .btnDeleteClient,
body.profile-read-only .btnAgregarSupplier,
body.profile-read-only .btnEditSupplier,
body.profile-read-only .btnDeleteSupplier,
body.profile-read-only .btnAgregarUsuario,
body.profile-read-only .btnEditUser,
body.profile-read-only .btnActivate,
body.profile-read-only .btnDelete,
body.profile-read-only .btnEditCompany,
body.profile-read-only .btnEditBranch,
body.profile-read-only .btnEditTerminal,
body.profile-read-only .btnApplyPayment,
body.profile-read-only .btnApplyPaymentCxP,
body.profile-read-only .btnAddOutlay,
body.profile-read-only .btnAddEarn,
body.profile-read-only .btnCreateSale,
body.profile-read-only .btnCancelInvoice,
body.profile-read-only .btnCloseCashClosing,
body.profile-read-only .btnDeleteRow,
body.profile-read-only .btnRestore,
body.profile-read-only [data-toggle="modal"][data-target="#modalAgregarProducto"],
body.profile-read-only [data-toggle="modal"][data-target="#modalAgregarCategoria"],
body.profile-read-only [data-toggle="modal"][data-target="#modalAgregarCliente"],
body.profile-read-only [data-toggle="modal"][data-target="#modalAgregarSupplier"],
body.profile-read-only [data-toggle="modal"][data-target="#modalAgregarUsuario"] {
    display: none !important;
}

/* Inputs sólo-lectura — el Contador puede abrir modales de detalle pero no
   editar los campos. El JS también sella los submits (ver read-only.js). */
body.profile-read-only form input:not([type="hidden"]):not([type="search"]):not([type="button"]):not([type="submit"]):not(.export-keep),
body.profile-read-only form textarea,
body.profile-read-only form select {
    pointer-events: none;
    background: #f8fafc !important;
    color: #4b5563;
}
/* Permitir interacción en filtros / daterangepickers — son para consultar reportes */
body.profile-read-only .reportrange,
body.profile-read-only .datepicker,
body.profile-read-only .daterange,
body.profile-read-only input.reportrange,
body.profile-read-only input[name*="daterange"],
body.profile-read-only input[name*="initialDate"],
body.profile-read-only input[name*="finalDate"],
body.profile-read-only input.filter,
body.profile-read-only .dataTables_filter input,
body.profile-read-only input[type="search"],
body.profile-read-only .select2,
body.profile-read-only .select2 *,
body.profile-read-only [data-read-only="keep"],
body.profile-read-only [data-read-only="keep"] *,
body.profile-read-only .export-keep {
    pointer-events: auto !important;
    background: #fff !important;
    color: var(--fg-1, #0a0e27) !important;
}

/* Banner superior sutil indicando modo solo lectura */
body.profile-read-only::before {
    content: "Perfil solo lectura — podés ver y exportar, pero no crear, modificar ni eliminar registros.";
    display: block;
    position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    color: #fff;
    font-size: 12px; font-weight: 600;
    text-align: center; padding: 4px 12px;
    line-height: 1.4;
    letter-spacing: .02em;
}
body.profile-read-only .shell { padding-top: 24px; }
