/* ============================================================
   AppBAGC - Ajustes sobre la plantilla Paces (2026-11-28)
   Portado de appbat.css (AppBAT, 2026-08-04 .. 2026-11-28).
   Se carga despues de app.min.css en todas las paginas Paces.
   ============================================================ */

/* Modo compacto que usaba la app: las paginas llevan la clase
   .content en el container-fluid para que sus estilos antiguos
   (.content .card-body, etc.) sigan aplicando */
/* Tamaños subidos un punto el 2026-08-05 (el usuario los veia pequeños) y
   unificados: antes convivian paginas a 0.75rem y a 0.8rem. Si hay que volver
   a tocarlos, estan tambien repetidos en el $page_style de cada pagina. */
.content .card-body { font-size: 0.8rem; }
.content .form-control, .content .form-select { font-size: 0.8rem; }
.content .form-label { font-size: 0.8rem; margin-bottom: 0.2rem; }
.content .btn { font-size: 0.8rem; }
.content table { font-size: 0.75rem; }

/* Menu lateral: texto mas pequeño que el de serie de Paces (peticion 2026-08-04) */
html, :root {
    --theme-sidenav-item-font-size: 0.72rem;
    /* Logo del menu/topbar: Paces lo fija por CSS (.logo-lg img { height: var(...) }),
       el atributo height del <img> NO manda. De serie era 22px/26px. */
    --theme-logo-lg-height: 42px;
    --theme-logo-sm-height: 35px;
}
.sidenav-menu .side-nav .side-nav-title {
    font-size: 0.62rem;
}
.sidenav-menu .side-nav .menu-icon i {
    font-size: 1rem;
}

/* Separacion del contenido respecto a la franja del topbar */
.content-page > .container-fluid.content { padding-top: 1.1rem; }

/* Margenes laterales: de serie Paces deja 10px (.content-page) + 10px
   (gutter del container-fluid) y el texto queda pegado al borde (2026-08-05) */
.content-page { padding-inline: 1rem; }
.content-page > .container-fluid.content { --theme-gutter-x: 1.5rem; }
@media (max-width: 767.98px) {
    .content-page { padding-inline: 0.5rem; }
    .content-page > .container-fluid.content { --theme-gutter-x: 1rem; }
}

/* Pie de pagina discreto */
.footer, .footer a { font-size: 0.7rem; }

/* ============================================================
   Badges: pildora con fondo tenue y texto del color (2026-08-05)
   Peticion del usuario: las cifras dentro de un badge (stock,
   precios, contadores, niveles) quedaban apretadas y con las
   esquinas raras. Se aplica a TODO el panel sin tocar las paginas:
   las utilidades solidas bg-* / text-bg-* se reinterpretan aqui.
   ============================================================ */
.badge {
    --theme-badge-padding-x: 0.75em;
    --theme-badge-padding-y: 0.42em;
    --theme-badge-border-radius: 50rem;
    --theme-badge-font-weight: 600;
    /* Tamaño propio en rem, no en em: dentro de una tabla (0.75rem) el
       0.75em de Paces dejaba la cifra en 0.56rem, ilegible. */
    --theme-badge-font-size: 0.75rem;
    /* Paces fija line-height:1 y la cifra queda pegada al borde superior */
    line-height: 1.25;
}

/* Color de fondo y de texto por variante. En claro se oscurece el
   color base (el tono plano de Paces no contrasta sobre su propio
   fondo tenue); en oscuro el fondo ya es translucido y el color
   base se lee bien tal cual. */
.badge.bg-primary,   .badge.text-bg-primary,   .badge.bg-primary-subtle,
.badge.bg-secondary, .badge.text-bg-secondary, .badge.bg-secondary-subtle,
.badge.bg-success,   .badge.text-bg-success,   .badge.bg-success-subtle,
.badge.bg-danger,    .badge.text-bg-danger,    .badge.bg-danger-subtle,
.badge.bg-warning,   .badge.text-bg-warning,   .badge.bg-warning-subtle,
.badge.bg-info,      .badge.text-bg-info,      .badge.bg-info-subtle,
.badge.bg-dark,      .badge.text-bg-dark,      .badge.bg-dark-subtle,
.badge.bg-light,     .badge.text-bg-light,     .badge.bg-light-subtle,
.badge.bg-purple,    .badge.bg-orange {
    background-color: var(--bdg-bg) !important;
    color: var(--bdg) !important;                                /* respaldo sin color-mix */
    color: color-mix(in srgb, var(--bdg) var(--bdg-mix, 62%), #000) !important;
}
html[data-bs-theme="dark"] .badge.bg-primary,   html[data-bs-theme="dark"] .badge.text-bg-primary,   html[data-bs-theme="dark"] .badge.bg-primary-subtle,
html[data-bs-theme="dark"] .badge.bg-secondary, html[data-bs-theme="dark"] .badge.text-bg-secondary, html[data-bs-theme="dark"] .badge.bg-secondary-subtle,
html[data-bs-theme="dark"] .badge.bg-success,   html[data-bs-theme="dark"] .badge.text-bg-success,   html[data-bs-theme="dark"] .badge.bg-success-subtle,
html[data-bs-theme="dark"] .badge.bg-danger,    html[data-bs-theme="dark"] .badge.text-bg-danger,    html[data-bs-theme="dark"] .badge.bg-danger-subtle,
html[data-bs-theme="dark"] .badge.bg-warning,   html[data-bs-theme="dark"] .badge.text-bg-warning,   html[data-bs-theme="dark"] .badge.bg-warning-subtle,
html[data-bs-theme="dark"] .badge.bg-info,      html[data-bs-theme="dark"] .badge.text-bg-info,      html[data-bs-theme="dark"] .badge.bg-info-subtle,
html[data-bs-theme="dark"] .badge.bg-dark,      html[data-bs-theme="dark"] .badge.text-bg-dark,      html[data-bs-theme="dark"] .badge.bg-dark-subtle,
html[data-bs-theme="dark"] .badge.bg-light,     html[data-bs-theme="dark"] .badge.text-bg-light,     html[data-bs-theme="dark"] .badge.bg-light-subtle,
html[data-bs-theme="dark"] .badge.bg-purple,    html[data-bs-theme="dark"] .badge.bg-orange {
    color: var(--bdg) !important;
}

.badge.bg-primary,   .badge.text-bg-primary,   .badge.bg-primary-subtle   { --bdg: var(--theme-primary);   --bdg-bg: var(--theme-primary-bg-subtle); }
.badge.bg-secondary, .badge.text-bg-secondary, .badge.bg-secondary-subtle { --bdg: var(--theme-secondary); --bdg-bg: var(--theme-secondary-bg-subtle); }
.badge.bg-success,   .badge.text-bg-success,   .badge.bg-success-subtle   { --bdg: var(--theme-success);   --bdg-bg: var(--theme-success-bg-subtle); }
.badge.bg-danger,    .badge.text-bg-danger,    .badge.bg-danger-subtle    { --bdg: var(--theme-danger);    --bdg-bg: var(--theme-danger-bg-subtle); }
/* amarillo y cian son los tonos mas claros: se oscurecen algo mas
   para que la cifra siga siendo legible (ratio >= 4.5) */
.badge.bg-warning,   .badge.text-bg-warning,   .badge.bg-warning-subtle   { --bdg: var(--theme-warning);   --bdg-bg: var(--theme-warning-bg-subtle); --bdg-mix: 53%; }
.badge.bg-info,      .badge.text-bg-info,      .badge.bg-info-subtle      { --bdg: var(--theme-info);      --bdg-bg: var(--theme-info-bg-subtle);    --bdg-mix: 55%; }
.badge.bg-dark,      .badge.text-bg-dark,      .badge.bg-dark-subtle      { --bdg: var(--theme-dark);      --bdg-bg: var(--theme-dark-bg-subtle); }
/* "light" no tiene color propio legible: se trata como gris neutro */
.badge.bg-light,     .badge.text-bg-light,     .badge.bg-light-subtle     { --bdg: var(--theme-secondary-color); --bdg-bg: var(--theme-tertiary-bg); }
/* colores sueltos que usa el log de etiquetas-admin.php (bg-${tipo}).
   `bg-orange` no existe en Paces: el badge salia con texto blanco sobre
   fondo transparente, o sea invisible. */
.badge.bg-purple { --bdg: var(--theme-purple); --bdg-bg: var(--theme-purple-bg-subtle); }
.badge.bg-orange { --bdg: var(--theme-orange); --bdg-bg: color-mix(in srgb, var(--theme-orange) 16%, transparent); }

/* Contador de notificaciones del topbar: se queda solido (es un aviso)
   pero circular de verdad. Paces le da width sin height y salia ovalado. */
.topbar-badge.badge-circle {
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    line-height: 1;
    background-color: var(--theme-danger) !important;
    color: #fff !important;
}

/* ============================================================
   Contadores de estado (.stat-tile) — 2026-08-05
   Los usan las pantallas de cola (etiquetas-admin.php,
   etiquetas-admin-cola.php). Mismo criterio que los badges:
   fondo tenue + cifra oscura, para que se lea de verdad. Antes
   eran tarjetas de color solido con texto blanco encima.
   ============================================================ */
.stat-tile {
    border-radius: .5rem;
    padding: .7rem .4rem;
    text-align: center;
    height: 100%;
    background-color: var(--tile-bg);
    color: var(--tile-fg);
    color: color-mix(in srgb, var(--tile-fg) var(--tile-mix, 62%), #000);
}
html[data-bs-theme="dark"] .stat-tile { color: var(--tile-fg); }
.stat-tile .stat-ico i { font-size: 1.05rem; opacity: .9; }
.stat-tile .stat-num { font-size: 1.4rem; font-weight: 600; line-height: 1.2; margin: .1rem 0 0; }
.stat-tile .stat-lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .04em; }
/* amarillo y cian se oscurecen algo mas: son los tonos mas claros */
.tile-warning   { --tile-bg: var(--theme-warning-bg-subtle);   --tile-fg: var(--theme-warning); --tile-mix: 53%; }
.tile-info      { --tile-bg: var(--theme-info-bg-subtle);      --tile-fg: var(--theme-info);    --tile-mix: 55%; }
.tile-primary   { --tile-bg: var(--theme-primary-bg-subtle);   --tile-fg: var(--theme-primary); }
.tile-success   { --tile-bg: var(--theme-success-bg-subtle);   --tile-fg: var(--theme-success); }
.tile-danger    { --tile-bg: var(--theme-danger-bg-subtle);    --tile-fg: var(--theme-danger); }
.tile-secondary { --tile-bg: var(--theme-tertiary-bg);         --tile-fg: var(--theme-secondary-color); }

/* ============================================================
   Choices.js — desplegables con buscador (2026-08-05)
   El plugin (v11.2.3) ya viene dentro de vendors.min.js/.css de
   Paces, pero Paces NO define sus variables, asi que de serie sale
   con su gris #f9f9f9 y borde #ddd: no pega con el tema y en modo
   oscuro queda ilegible. Aqui se mapean a las variables del tema.
   ============================================================ */
.choices {
    --choices-bg-color: var(--theme-secondary-bg);
    --choices-bg-color-dropdown: var(--theme-secondary-bg);
    --choices-bg-color-disabled: var(--theme-tertiary-bg);
    --choices-keyline-color: var(--theme-border-color);
    --choices-text-color: var(--theme-body-color);
    --choices-font-size-md: 0.8rem;
    --choices-font-size-sm: 0.78rem;
    --choices-border-radius: var(--theme-border-radius);
    --choices-input-height: 36px;
    --choices-inner-one-padding: 6px;
    --choices-inner-padding: 6px 8px;
    /* El desplegable sale con z-index 1 y lo tapaba cualquier cabecera de tabla
       pegajosa (thead sticky lleva 10, y la utilidad .sticky-top de Bootstrap
       1020). 1021 lo pone por encima de ambas y por debajo de modales (1055),
       asi que dentro de un modal sigue funcionando. */
    --choices-z-index: 1021;
    margin-bottom: 0;
    color: var(--theme-body-color);
}
/* La lista se posiciona respecto al contenedor, que debe crear el contexto */
.choices.is-open { position: relative; z-index: 1021; }
.choices__inner { color: var(--theme-body-color); }
.choices__list--dropdown { font-size: 0.8rem; }
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--theme-primary-bg-subtle);
}
.choices__input { background-color: var(--theme-secondary-bg) !important; color: var(--theme-body-color); }
.choices__placeholder { opacity: .7; }
.choices[data-type*=select-one]:after { border-color: var(--theme-body-color) transparent transparent; }

/* Cabecera de pagina */
.page-title-head { margin-bottom: 1rem; }
.page-title-head .breadcrumb { font-size: 0.75rem; }
.page-title-head .page-main-title i { vertical-align: -2px; }
.page-title-head p.fs-13 { font-size: 0.72rem; }

/* SweetAlert2 - tamaño reducido (portado de custom.css) */
.swal2-sm {
    font-size: 0.9rem !important;
    width: auto !important;
    max-width: 380px !important;
    padding: 1rem 1.5rem !important;
}
.swal2-sm .swal2-title {
    font-size: 1.1rem !important;
    padding: 0.5rem 0 !important;
}
.swal2-sm .swal2-html-container {
    font-size: 0.9rem !important;
    margin: 0.5rem 0 !important;
}
.swal2-sm .swal2-actions { margin-top: 0.75rem !important; }
.swal2-sm .swal2-styled { padding: 0.4rem 1.1rem !important; font-size: 0.85rem !important; }

/* Notificaciones del topbar */
.notification-list .notification-item.bg-light { background-color: var(--theme-tertiary-bg) !important; }

/* Iconos de SweetAlert2 (2026-11-28). El CSS de Paces (app.min.css) encoge el icono a
   4em y recoloca solo el check (tip/long) con medidas de una version anterior de la
   libreria; con SweetAlert2 v11.26 el check y la X salian deformados. Se restaura la
   geometria original de la libreria (5em) y se reduce con su zoom (--swal2-icon-zoom):
   0.8 = el tamaño de 4em que pretendia Paces; 0.6 en los modales reducidos (.swal2-sm).
   Los toasts tienen su propia geometria y se excluyen. */
.swal2-popup:not(.swal2-toast) { --swal2-icon-zoom: 0.8; }
.swal2-popup.swal2-sm:not(.swal2-toast) { --swal2-icon-zoom: 0.6; }
.swal2-popup:not(.swal2-toast) .swal2-icon { width: 5em; height: 5em; line-height: 5em; }
.swal2-popup:not(.swal2-toast) .swal2-icon .swal2-icon-content { font-size: 3.75em; }
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success [class^=swal2-success-line][class$=tip] {
    top: 2.875em; left: .8125em; right: auto; inset-inline-end: auto; width: 1.5625em;
}
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-success [class^=swal2-success-line][class$=long] {
    top: 2.375em; right: .5em; inset-inline-end: .5em; width: 2.9375em;
}
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error [class^=swal2-x-mark-line] { top: 2.3125em; width: 2.9375em; }
.swal2-sm .swal2-icon { margin: 0.75rem auto 0.4rem !important; }

/* ============================================================
   Compatibilidad con la cabecera de las paginas de la plantilla
   antigua (.page-header + .page-title + .breadcrumb), migradas a
   Paces el 2026-11-28. Mismo aspecto que .page-title-head.
   Portado de assets/css/custom.css.
   ============================================================ */
.page-header { margin-bottom: 1rem; }
.page-header .page-title { font-size: 1.1rem; font-weight: 600; margin-bottom: .25rem; }
.page-header .breadcrumb { font-size: 0.75rem; margin-bottom: 0; }
.breadcrumb { background: transparent; padding: 0; }
.card .table { margin-bottom: 0; }
.table .btn-sm { padding: 0.25rem 0.5rem; }
