/*
=================================================================
        ESTILOS UNIFICADOS Y OPTIMIZADOS PARA EL SIDEBAR
=================================================================
*/

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.85);
  z-index: 1056;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-box {
  background-color: var(--bs-white);
  padding: 30px 40px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(var(--bs-black-rgb), 0.2);
  text-align: center;
  max-width: 380px;
  border: 1px solid var(--bs-light-border-subtle);
  color: var(--bs-primary);
}

.loading-box p {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.loading-box p.text-muted {
  color: var(--bs-secondary-text-emphasis) !important;
}

.loading-box p.text-primary {
  color: var(--bs-primary) !important;
}

.spinner {
  border: 6px solid var(--bs-light-bg-subtle);
  border-top: 6px solid var(--bs-primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

/* ---- HEADER: evita cortar dropdowns (unificado) ---- */
header .navbar,
header .navbar .container-fluid,
header .navbar .navbar-collapse {
  overflow: visible !important;
}

header .nav-item.dropdown {
  position: relative;
  z-index: 1081;
}

header .dropdown-menu {
  z-index: 1080;
  max-width: calc(100vw - 16px);
  width: max-content;
}

.texto-justify {
  text-align: justify;
}

/* --- Comportamiento del Menú Principal (Submenús) --- */
aside.app-sidebar .has-submenu>.submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out, transform 0.3s ease-out;
  padding-left: 0;
  background-color: transparent;
}

aside.app-sidebar .has-submenu.is-open>.submenu {
  max-height: 1000px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.4s ease-in, opacity 0.3s ease-in, transform 0.3s ease-in;
}

aside.app-sidebar .has-submenu.is-open>.submenu-toggle .submenu-arrow {
  transform: rotate(-90deg);
}

/* --- Estilos de los Ítems del Menú --- */
aside.app-sidebar .nav-link {
  font-size: 0.9rem !important;
  padding: 0.3rem 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  gap: .5rem;
  justify-content: flex-start;
  transition: justify-content 0.3s ease;
  width: 100%;
}

aside.app-sidebar .submenu .nav-item {
  display: flex;
  width: 100% !important;
}

aside.app-sidebar .nav-link .nav-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

aside.app-sidebar .nav-link span {
  white-space: nowrap;
  flex-grow: 1;
  overflow: hidden;
}

aside.app-sidebar .nav-link .submenu-arrow {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease-in-out, opacity 0.3s ease;
}

aside.app-sidebar .nav-link.submenu-toggle span {
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

aside.app-sidebar .submenu .nav-link span {
  font-weight: 400 !important;
  text-transform: capitalize !important;
}

/* --- Comportamiento del Menú en Modo Colapsado --- */
/* Scoped ONLY to the private sidebar so it doesn't affect public navs */
.app-shell.sidebar-collapse aside.app-sidebar .nav-link span,
.app-shell.sidebar-collapse aside.app-sidebar .nav-link .submenu-arrow {
  opacity: 0;
  width: 0;
  transition: opacity 0.1s ease-out, width 0.2s ease-out;
}

.app-shell.sidebar-collapse aside.app-sidebar .nav-link {
  justify-content: center;
}

.app-shell.sidebar-collapse.sidebar-hover aside.app-sidebar .nav-link span,
.app-shell.sidebar-collapse.sidebar-hover aside.app-sidebar .nav-link .submenu-arrow {
  opacity: 1;
  width: auto;
  transition: opacity 0.2s ease-in 0.1s, width 0.2s ease-in;
}

.app-shell.sidebar-collapse.sidebar-hover aside.app-sidebar .nav-link {
  justify-content: flex-start;
}


/* --- IMAGEN DE FONDO DINÁMICA --- */
.background-wrapper-fixed {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  transition: background-image 0.5s ease-in-out;
}

/* --- ESTILOS PARA EL FOOTER PÚBLICO --- */
.footer-public {
  background-color: var(--footer-bg);
  border-top: 3px solid var(--bs-border-color);
  color: var(--footer-color);
  font-size: 0.9rem;
}

.footer-public .footer-logo {
  max-height: 60px;
  width: auto;
}

.footer-public .footer-title {
  color: var(--footer-title-color);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  font-size: 1.32rem;
}

.footer-public .footer-link {
  color: var(--footer-link-color);
  text-decoration: none;
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-public .footer-link:hover {
  color: var(--footer-link-hover-color);
  transform: scale(1.05) translateY(-2px);
}

.footer-public .footer-text,
.footer-public .footer-contact-item {
  color: var(--footer-color);
}

.footer-text {
  font-size: 0.95rem;
}

.footer-link {
  font-size: 0.95rem !important;
}

.footer-public .footer-link-b {
  font-size: 0.7rem !important;
  color: var(--footer-link-color);
  text-decoration: none;
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}

.footer-public .footer-link-b:hover {
  color: var(--footer-link-hover-color);
  transform: scale(1.05) translateY(-2px);
  -webkit-transform: scale(1.05) translateY(-2px);
  -moz-transform: scale(1.05) translateY(-2px);
  -ms-transform: scale(1.05) translateY(-2px);
  -o-transform: scale(1.05) translateY(-2px);
}

.footer-public .footer-divider {
  border-color: var(--footer-divider-color);
}

.footer-public .footer-signature-links a {
  color: var(--footer-color);
  text-decoration: none;
  font-size: 0.75rem;
  display: inline-block;
  transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
}

.footer-public .footer-signature-links a:hover {
  color: var(--footer-link-hover-color);
  transform: scale(1.05) translateY(-1px);
  -webkit-transform: scale(1.05) translateY(-1px);
  -moz-transform: scale(1.05) translateY(-1px);
  -ms-transform: scale(1.05) translateY(-1px);
  -o-transform: scale(1.05) translateY(-1px);
}

.legal-links-web a {
  color: var(--footer-color);
  text-decoration: none;
  font-size: 0.8rem;
  display: inline-block;
  transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
  -webkit-transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
  -moz-transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
  -ms-transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
  -o-transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
}

.legal-links-web a:hover {
  color: var(--footer-link-hover-color);
  transform: scale(1.05) translateY(-1px);
  -webkit-transform: scale(1.05) translateY(-1px);
  -moz-transform: scale(1.05) translateY(-1px);
  -ms-transform: scale(1.05) translateY(-1px);
  -o-transform: scale(1.05) translateY(-1px);
}

.footer-public .footer-signature {
  font-size: 0.8rem;
  color: var(--footer-color);
}

.footer-public .footer-signature a {
  color: var(--footer-link-hover-color);
  font-weight: 600;
  text-decoration: none;
}

/*.footer-public .footer-social-icons a {
  color: var(--footer-color);
  font-size: 1rem;
  margin-left: 0.75rem;
  transition: color 0.2s ease;
}

.footer-public .footer-social-icons a:hover {
  color: var(--brand-primary, #c0a925);
}*/

/* ============================================
   EFECTO DORADO SIMPLE PARA ICONOS SOCIALES
   ============================================ */

/* Estilos Base */
.footer-public .footer-social-icons a {
  color: var(--footer-color);
  font-size: 1rem;
  margin-left: 0.4rem;
  transition: all 0.3s ease;
  display: inline-block;
  /* Necesario para que funcione transform */
}

/* ============================================
   MODO LIGHT - Dorado sobre fondo claro
   ============================================ */
.footer-public .footer-social-icons a:hover {
  color: #c0a925;
  transform: scale(1.05) translateY(-1px);
  -webkit-transform: scale(1.05) translateY(-1px);
  -moz-transform: scale(1.05) translateY(-1px);
  -ms-transform: scale(1.05) translateY(-1px);
  -o-transform: scale(1.05) translateY(-1px);
  /* Sombra oscura sutil para resaltar sobre fondo claro */
  text-shadow:
    0 1px 2px rgba(139, 105, 20, 0.4),
    0 2px 4px rgba(139, 105, 20, 0.2);
}

/* ============================================
   MODO DARK - Dorado sobre fondo oscuro
   ============================================ */
[data-bs-theme="dark"] .footer-public .footer-social-icons a:hover,
.dark-mode .footer-public .footer-social-icons a:hover,
body.dark .footer-public .footer-social-icons a:hover {
  color: #f4d03f;
  transform: scale(1.05) translateY(-1px);
  -webkit-transform: scale(1.05) translateY(-1px);
  -moz-transform: scale(1.05) translateY(-1px);
  -ms-transform: scale(1.05) translateY(-1px);
  -o-transform: scale(1.05) translateY(-1px);
  /* Sombra luminosa dorada para que brille sobre fondo oscuro */
  text-shadow:
    0 0 8px rgba(255, 215, 0, 0.6),
    0 0 12px rgba(255, 215, 0, 0.3);
}


/* Asegura que header/footer hereden bien los radios aunque el tema overridee algo */
.card>.card-header:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  background-clip: border-box;
}

.card>.card-footer:last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
  background-clip: border-box;
}

/* Opcional: elimina micro “costuras” en esquinas con temas oscuros */
.card {
  overflow: hidden;
}

/* ==========================================================
   LAYOUT sin desbordes cuando el sidebar se colapsa
   (sin romper dropdowns ni sticky headers)
   ========================================================== */
:root {
  /* Ajusta estos valores a tus anchos reales */
  --sidebar-expanded: 250px;
  --sidebar-collapsed: 64px;
}

/* El sidebar toma los mismos anchos de las variables */
.app-shell aside.app-sidebar {
  width: var(--sidebar-expanded);
}

.sidebar-collapse aside.app-sidebar {
  width: var(--sidebar-collapsed);
}

/* El contenido ocupa exactamente el resto del ancho (no max-width) */
.app-header,
.app-main,
.app-footer {
  box-sizing: border-box;
  min-width: 0;
}

.app-shell .app-header,
.app-shell .app-main,
.app-shell .app-footer {
  margin-left: var(--sidebar-expanded);
  width: calc(100% - var(--sidebar-expanded));
}

.sidebar-collapse .app-header,
.sidebar-collapse .app-main,
.sidebar-collapse .app-footer,
body.sidebar-collapse .app-header,
body.sidebar-collapse .app-main,
body.sidebar-collapse .app-footer {
  margin-left: var(--sidebar-collapsed);
  width: calc(100% - var(--sidebar-collapsed));
}

/* (Opcional “cinturón y tirantes”) si ves 1–2px de scroll en ciertos zooms:
html, body { overflow-x: hidden; }
*/


.page-title-header {
  padding: 1rem 2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, var(--page-title-bg-start), var(--page-title-bg-end));
  border-bottom: 3px solid var(--bs-border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.brand-link {
  padding: 0.5rem 0rem;
}

/* ================================================
   FIX: eliminar "doble sidebar" usando CSS Grid
   (el sidebar es la 1ª columna; el resto ocupa la 2ª)
   ================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-size) 1fr;
}

/* El sidebar ocupa la primera columna */
.app-shell aside.app-sidebar {
  grid-column: 1 / 2;
  /* su width ya está en var(--sidebar-size); lo mantenemos */
}

/* Header, main y footer ocupan la segunda columna */
.app-shell .app-header,
.app-shell .app-main,
.app-shell .app-footer {
  grid-column: 2 / 3;
  /* anulamos el empuje por márgenes/cálculos previos */
  margin-left: 0 !important;
  width: auto !important;
  min-width: 0;
  /* por si algún hijo tiene min-width */
}