/**
 * Custom CSS - Tool Box ABPC
 *
 * Archivo global de estilos personalizados que se carga último para:
 * - Evitar inline CSS (style="") en las vistas
 * - Proveer clases utilitarias reutilizables
 * - Sobreescribir estilos de AdminLTE/Bootstrap cuando sea necesario
 *
 * Última actualización: 2026-03-11
 */

/* ==========================================================================
   1. SOCIAL BRAND COLORS
   ========================================================================== */

/* --- Iconos de marca --- */
.text-instagram  { color: #E4405F !important; }
.text-facebook   { color: #1877F2 !important; }
.text-linkedin   { color: #0A66C2 !important; }

/* --- Backgrounds de marca --- */
.bg-instagram    { background-color: #E4405F !important; color: #fff !important; }
.bg-facebook     { background-color: #1877F2 !important; color: #fff !important; }
.bg-linkedin     { background-color: #0A66C2 !important; color: #fff !important; }

/* --- Gradiente Instagram (avatar placeholder) --- */
.bg-instagram-gradient {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important;
    color: #fff !important;
}

/* ==========================================================================
   2. AVATARS & THUMBNAILS
   ========================================================================== */

.avatar-sm {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-md {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 50%;
}

/* Avatar placeholder (ícono/letra inicial dentro de un div) */
.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Thumbnail contenido (object-fit: contain con fondo neutro) */
.thumb-contain {
    object-fit: contain;
    background: #f4f4f4;
    padding: 2px;
}

/* ==========================================================================
   3. GAP UTILITIES (BS4 no tiene gap nativo)
   ========================================================================== */

.gap-1 { gap: 0.25rem!important; }
.gap-2 { gap: 0.5rem!important; }
.gap-3 { gap: 1rem!important; }
.gap-4 { gap: 1.5rem!important }
.gap-5 { gap: 3rem!important }

/* Fallback para flexbox sin soporte gap nativo */
.gap-compat-1 > * { margin-right: 0.25rem; margin-bottom: 0.25rem; }
.gap-compat-1 > *:last-child { margin-right: 0; }

.gap-compat-2 > * { margin-right: 0.5rem; margin-bottom: 0.5rem; }
.gap-compat-2 > *:last-child { margin-right: 0; }

/* ==========================================================================
   4. TABLE COLUMN WIDTHS
   ========================================================================== */

.col-w-40   { width: 40px; }
.col-w-80   { width: 80px; }
.col-w-120  { width: 120px; }
.col-w-150  { width: 150px; }
.col-w-180  { width: 180px; }
.col-w-200  { width: 200px; }

/* ==========================================================================
   5. CURSOR UTILITIES
   ========================================================================== */

.cursor-pointer  { cursor: pointer; }
.cursor-default  { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

/* ==========================================================================
   6. OPACITY UTILITIES
   ========================================================================== */

.opacity-60  { opacity: 0.6; }
.opacity-80  { opacity: 0.8; }

/* ==========================================================================
   7. FONT SIZE UTILITIES
   ========================================================================== */

.text-xs   { font-size: 0.75rem !important; }
.text-sm   { font-size: 0.875rem !important; }
.text-base { font-size: 1rem !important; }
.text-lg   { font-size: 1.125rem !important; }
.text-xl   { font-size: 1.25rem !important; }
.text-2xl  { font-size: 1.5rem !important; }

/* ==========================================================================
   8. MAX-WIDTH UTILITIES
   ========================================================================== */

.mw-80  { max-width: 80%; }
.mw-100 { max-width: 100%; }

/* ==========================================================================
   9. FORM HELPERS
   ========================================================================== */

.resize-none { resize: none; }
.input-group-sm>.custom-select, .input-group-sm>.form-control:not(textarea) {
	/* height: calc(2.25rem + 2px); */
    height: 32px;

}
input.form-control-sm {
    height: 32px;
}
/* ==========================================================================
   10. CARD & PROFILE STYLES (reutilizables)
   ========================================================================== */

.profile-icon {
    padding: 10px 0;
}

.profile-username {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

/* Badge con borde transparente */
.badge.badge-outline {
    background-color: transparent;
    font-weight: 500;
}

.badge.badge-outline:hover {
    opacity: 0.8;
}

/* Highlighted attributes in first main-card headers (SHOW/EDIT) */
.ux-header-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ux-badge-highlight {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.28rem 0.55rem;
    border-width: 1px;
    border-style: solid;
    border-radius: 999px;
}

/* ==========================================================================
   11. NAVBAR ACTION BUTTONS
   ========================================================================== */

.navbar-action-btn,
.navbar-action-back {
    margin-top: 0.35rem;
    margin-left: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.navbar-action-btn:hover,
.navbar-action-back:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .navbar-action-btn,
    .navbar-action-back {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ==========================================================================
   12. VISIBILITY HELPERS (JS toggle)
   ========================================================================== */

.d-hidden { display: none !important; }

/* ==========================================================================
   13. STICKY POSITIONING
   ========================================================================== */

.sticky-offset {
    position: sticky;
    top: 70px;
    z-index: 10;
}

/* ==========================================================================
   14. TRANSITION & ANIMATION HELPERS
   ========================================================================== */

.transition-all {
    transition: all 0.2s ease;
}

.transition-opacity {
    transition: opacity 0.2s ease;
}

/* ==========================================================================
   15. BREADCRUMB SEPARATOR
   ========================================================================== */

.breadcrumb-chevron {
    font-size: 0.75rem;
}


/* ==========================================================================
   16. AI AGENT BUTTONS (.btn-ia)
   layout del botón con borde arcoíris giratorio usando pseudo-elementos y animaciones CSS.
   <button type="button" class="btn btn-ia btn-sm">
        <i class="fas fa-robot"></i> Sugerencia IA
        <span class="btn-ia-spinner">
            <i class="fas fa-circle-notch fa-spin"></i>  Pensando...
        </span>
    </button>
   ========================================================================== */



@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotate-border {
  0%   { --angle: 0deg; }
  100% { --angle: 360deg; }
}

.btn-ia {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  background: #fff; /* o var(--tu-bg) */
  color: #111;
  outline: none;
  z-index: 0;
  transition: transform 0.15s ease;
  margin: 0 0 5px 10px;
}

/* borde arcoíris giratorio */
.btn-ia::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 52px;
  background: conic-gradient(from var(--angle),
    #4285F4, #EA4335, #FBBC05, #34A853, #4285F4, #A142F4, #4285F4
  );
  animation: rotate-border 2.8s linear infinite;
  z-index: -1;
}

/* tapa interior para simular el borde */
.btn-ia::after {
  content: '';
  position: absolute;
  inset: 0.75px;
  border-radius: 49px;
  background: #fff; /* debe coincidir con el fondo del botón */
  z-index: -1;
}

.btn-ia:hover  { transform: scale(1.03); }
.btn-ia:active { transform: scale(0.97); }

/* tamaños */
.btn-ia.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-ia.btn-lg { padding: 12px 28px; font-size: 16px; }

@keyframes rotate-border-fast {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}
@keyframes pulse-bg {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.82; }
}
@keyframes icon-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* spinner: oculto por defecto, visible en busy */
.btn-ia .btn-ia-spinner {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.btn-ia .btn-ia-spinner i {
  font-size: 13px;
  animation: icon-spin 1s linear infinite;
}

/* clase que se agrega/remueve por JS */
.btn-ia.btn-ia-busy {
  cursor: wait;
  color: transparent;   /* oculta el texto original */
  pointer-events: none;
  animation: pulse-bg 1.6s ease-in-out infinite;
}

.btn-ia.btn-ia-busy::before {
  animation: rotate-border-fast 0.9s linear infinite;
  filter: brightness(1.15) saturate(1.3);
}

.btn-ia.btn-ia-busy .btn-ia-spinner {
  display: flex;
  opacity: 1;
}

/* oculta el ícono y el texto original sin sacarlos del flujo */
.btn-ia.btn-ia-busy > *:not(.btn-ia-spinner) {
  visibility: hidden;
}

/* modo oscuro: ajustar colores para mejor contraste */
.dark-mode .btn-ia::after, .dark-mode .btn-ia {
  background: #343a40; /* debe coincidir con el fondo del botón */
  color: #fff;
}

/* wrapper label + botón IA (x-ai-suggest-label) */
.ia-wrapper {
  margin-bottom: 0.25rem;
}
.ia-wrapper > label {
  white-space: nowrap;
}


/* ==========================================================================
   17. EasyMDEContainer (editor Markdown) - estilos personalizados para el contenedor del editor EasyMDE
    - Ajustes de altura, bordes, fondo, etc.
   ========================================================================== */
.dark-mode .EasyMDEContainer{
    background-color: #a3a3a3;
    border: 1px solid #a3a3a3;
}
.dark-mode .editor-toolbar {
    background: #6c757d;
}

/* ==========================================================================
    18. CUSTOM OVERRIDES
    ========================================================================== */
/* Ejemplo: Sobrescribir el color de fondo de los botones primarios */
.dark-mode .btn-outline-primary {
	border-color: #94afcb;
	color: #94afcb;
}
.dark-mode .btn-outline-secondary {
	border-color: #bbbbbb;
	color: #bbbbbb;
}
.dark-mode .btn-outline-success {
	border-color: #28a745;
	color: #28a745;
}
.dark-mode .btn-outline-danger {
	border-color: #dc3545;
	color: #dc3545;
}
.dark-mode .btn-outline-warning {
	border-color: #ffc107;
	color: #ffc107;
}
.dark-mode .btn-outline-info {
	border-color: #17a2b8;
	color: #17a2b8;
}

code {
	color: #3ee867;
	background: #000;
	padding: 3px 5px;
}

.dark-mode blockquote {
	background-color: #c9c9c9;
}
blockquote {
	border-left: 10px solid #033162;
}

/* Fix: AdminLTE iframe-mode plugin sets `.content-wrapper { height: 100% }`
   which prevents the content-wrapper from expanding with long content,
   causing the footer to float behind tables. The min-height (set by AdminLTE JS)
   already handles sticky-footer behavior on short pages. */
.wrapper .content-wrapper {
    height: auto;
}
.main-header .navbar-nav form {
    margin: 0 !important;
}
.main-header .navbar-nav .nav-link {
    display: flex;
    align-items: center;
}


/* ==========================================================================
   19. ACTION MENU (.action-menu / .action-menu-btn)
   Menú de acciones unificado — componente x-action-menu.
   Todos los botones comparten la misma altura, padding e icono centrado.
   ========================================================================== */

/* Tamaño uniforme para todos los botones de acción */
.action-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 26px;
    min-width: 26px;
    padding: 0 6px;
    line-height: 1;
}

.action-menu-btn i {
    font-size: 0.75rem;
    line-height: 1;
    pointer-events: none;
}

/* Estado disabled — visible pero no interactivo */
.action-menu-btn.disabled,
.action-menu-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    pointer-events: none;
    border-color: #bbbbbb !important;
}

/* Ocultar el caret nativo del dropdown-toggle para no romper el layout del ícono */
.action-menu .dropdown-toggle::after {
    display: none;
}

/* Active group: bg-secondary del nav-item padre cuando contiene la ruta activa.
   El JS de custom.js agrega bg-secondary a los grupos que PHP marcó como menu-open. */
.nav-sidebar .nav-item.has-treeview.bg-secondary {
    border-radius: 4px;
    background-color: rgba(108, 117, 125, 0.4) !important; /* secondary con alpha para sidebar dark */
}

/* El nav-link del encabezado del grupo activo: contraste visible en sidebar dark */
.nav-sidebar .nav-item.has-treeview.bg-secondary > .nav-link {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

/* El nav-treeview interior es transparente para no propagar el fondo a los sub-ítems */
.nav-sidebar .nav-item.has-treeview.bg-secondary > .nav-treeview {
    background-color: transparent;
}

/* ==========================================================================
   20. SIDEBAR — Sub-ítems de grupos de módulos
   ========================================================================== */

/* Indentado solo cuando el sidebar está expandido */
body:not(.sidebar-collapse) .nav-sidebar .nav-treeview .nav-item > .nav-link {
    padding-left: .5rem !important;
}

/* Reducir ligeramente el ícono en sub-ítems (sidebar expandido) */
body:not(.sidebar-collapse) .nav-sidebar .nav-treeview .nav-item > .nav-link .nav-icon {
    font-size: 0.75rem;
    opacity: 0.75;
}


body:not(.sidebar-collapse) .nav-sidebar > .nav-item > .nav-treeview > .nav-item > .nav-link > .nav-icon {
    color:#60a1e7;
    opacity: 0.9;
}

/* Vista compacta (mini): iconos más pequeños en todos los nav-link */
body.sidebar-collapse .nav-sidebar .nav-item > .nav-link .nav-icon {
    font-size: 0.75rem;
}

/* ==========================================================================
   21. TOPBAR PROGRESS BAR — modo indeterminado
   --------------------------------------------------------------------------
   Se activa vía JS agregando .topbar-indeterminate al elemento
   #app_topbar_progress_bar cuando no se puede medir el avance del proceso
   (llamadas a IA, publicación en Joomla, generación de imágenes).
   Un bloque de color rebota de izquierda a derecha dando feedback visual.
   ========================================================================== */
@keyframes topbar-indeterminate {
    0%   { background-position: -30% 0; }
    100% { background-position: 130% 0; }
}

.topbar-indeterminate {
    background-image: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 123, 255, 0.4) 15%,
        #007bff 35%,
        #66b2ff 50%,
        #007bff 65%,
        rgba(0, 123, 255, 0.4) 85%,
        transparent 100%
    ) !important;
    background-size: 30% 100% !important;
    background-repeat: no-repeat !important;
    animation: topbar-indeterminate 1.1s cubic-bezier(0.65, 0.05, 0.35, 0.95) infinite alternate !important;
    transition: none !important;
    box-shadow: 0 0 6px rgba(0, 123, 255, 0.5) !important;
}

/* ==========================================================================
   22. jstree - Ajuste de fondo para filas hover en modo oscuro (sidebar y content-wrapper)
   ========================================================================== */
.dark-mode .jstree-default .jstree-wholerow-hovered {
	background: #000000;
}

/* ==========================================================================
   23. EasyMDE — Toolbar en una sola fila
   --------------------------------------------------------------------------
   La toolbar por defecto usa inline-block con wrap. Forzar flex nowrap
   para que todos los botones queden en una fila con scroll si es necesario.
   ========================================================================== */
.EasyMDEContainer .editor-toolbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    align-items: center;
    padding: 6px 8px;
}
/* Scrollbar discreta en Webkit */
.EasyMDEContainer .editor-toolbar::-webkit-scrollbar {
    height: 3px;
}
.EasyMDEContainer .editor-toolbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* ==========================================================================
   24. EasyMDE — Statusbar: contadores de caracteres y palabras
   ========================================================================== */
.EasyMDEContainer .editor-statusbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
    font-size: 11px;
    color: #888;
    border: 1px solid #ced4da;
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    background: #f8f9fa;
    min-height: 24px;
}
.EasyMDEContainer .editor-statusbar .abpc-char-count,
.EasyMDEContainer .editor-statusbar .abpc-word-count {
    display: inline-block;
    min-width: 0;
    margin-left: 0;
    white-space: nowrap;
}
.EasyMDEContainer .editor-statusbar .abpc-word-count::before {
    content: '';
    display: inline-block;
    width: 1px;
    height: 10px;
    background: #ccc;
    margin-right: 12px;
    vertical-align: middle;
}

/* Admin dropdown — grupos colapsables */
.admin-dropdown-scroll {
    max-height: 80vh;
    overflow-y: auto;
}
.admin-group-header {
	background-color: #495057;
	font-size: 16px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #ffffff !important;
	cursor: pointer;
	user-select: none;
	line-height: 1;
}
.admin-group-header:hover {
    color: #e9ecef !important;
}
.admin-group-header.active-group {
    color: #689acf !important;
}
.admin-group-header .collapse-arrow {
    transition: transform 0.2s ease;
    font-size: 10px;
    margin-top: 2px !important;
}
.admin-group-header[aria-expanded="true"] .collapse-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   25. TOPICS TABLE — barra de progreso indeterminada en filas "en proceso"
   ========================================================================== */
@keyframes topic-bar-indeterminate {
    0%   { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}

.topic-processing-bar {
    height: 3px;
    border-radius: 2px;
    background-image: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 193, 7, 0.4) 15%,
        #ffc107 35%,
        #ffe083 50%,
        #ffc107 65%,
        rgba(255, 193, 7, 0.4) 85%,
        transparent 100%
    );
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: topic-bar-indeterminate 1.2s cubic-bezier(0.65, 0.05, 0.35, 0.95) infinite alternate;
}

.topic-row-processing > td {
    background-color: rgba(255, 193, 7, 0.05) !important;
}

/* =====================================================================
   26. NOTIFICATIONS TOPBAR COUNTER — subtle idle animation + boost on updates
   ===================================================================== */
@keyframes notification-badge-idle {
    0%, 100% {
        opacity: 1;
        /* transform: translateY(0) scale(1); */
    }
    50% {
        opacity: 0.2;
        /* transform: translateY(-1px) scale(1.03); */
    }
}

@keyframes notification-badge-boost {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        background-color: #ffc107;
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.55);
    }
    30% {
        opacity: 1;
        transform: translateY(-2px) scale(1.12);
        background-color: #fd7e14;
        box-shadow: 0 0 0 6px rgba(253, 126, 20, 0.15);
    }
    60% {
        opacity: 0.95;
        transform: translateY(1px) scale(1.02);
        background-color: #ffb703;
        box-shadow: 0 0 0 0 rgba(255, 183, 3, 0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        background-color: #ffc107;
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

.navbar-badge.notification-counter-badge {
    animation: notification-badge-idle 2.4s ease-in-out infinite;
    transform-origin: center;
    will-change: transform, opacity;
}

.navbar-badge.notification-counter-badge.notification-counter-badge--boost {
    animation: notification-badge-boost 0.62s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .navbar-badge.notification-counter-badge,
    .navbar-badge.notification-counter-badge.notification-counter-badge--boost {
        animation: none !important;
        transform: none !important;
    }
}

/* ==========================================================================
   25. TABLE — ajuste de fondo para filas hover en modo oscuro (sidebar y content-wrapper)
   ========================================================================== */
.dark-mode .table-warning, .dark-mode .table-warning>td, .dark-mode .table-warning>th {
	background-color: #000000;
}

.dark-mode .table-warning, .dark-mode .table-warning>td, .dark-mode .table-warning>th {
	background-color: #000000;
}
.dark-mode .table-hover .table-warning:hover,.dark-mode .table-hover .table-warning:hover>td,.dark-mode .table-hover .table-warning:hover>th {
	background-color: rgb(36, 36, 36)
}
