:root{
  --toolbar-h: 56px;
  --toolbar-px: 18px;
  --toolbar-gap: 16px;
  --toolbar-font: 14px;
}

body.page-chrome{
  background: radial-gradient(circle at top, #f4effc, #ede9fe);
}

/* Barra superior (fondo + sticky) */
body.page-chrome .container-fluid{
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: rgba(245, 243, 255, 0.65) !important;
  border-bottom: 1px solid rgba(59, 26, 74, 0.10);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 1050;
  padding: 0 !important;
  color: #3b1a4a;
}

/* Toolbar: NO overflow aquí (si no, corta el dropdown) */
body.page-chrome .container-fluid > .toolbar{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--toolbar-gap);
  padding: 10px var(--toolbar-px);
  min-height: var(--toolbar-h);
  flex-wrap: nowrap;        /* no crece en desktop */
  font-size: var(--toolbar-font);
  line-height: 1.2;
  overflow: visible;        /* clave: el dropdown no se recorta */
}

/* Logo */
.logo-header{
  height: 34px;
}

/* Navegación (si no cabe, scroll aquí, no en toolbar) */
body.page-chrome .main-nav{
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;

  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;

  max-width: clamp(220px, 45vw, 560px);
}

body.page-chrome .main-nav .nav-link{
  color: rgba(59, 26, 74, 0.75);
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  flex: 0 0 auto; /* importante para scroll */
}

body.page-chrome .main-nav .nav-link:hover{
  background: rgba(59, 26, 74, 0.06);
  color: #3b1a4a;
}

body.page-chrome .main-nav .nav-link.active{
  background: rgba(59, 26, 74, 0.10);
  color: #3b1a4a;
}

/* Derecha (usuario + botones) */
body.page-chrome .logout-container{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-wrap: nowrap;
}

/* Usuario */
body.page-chrome #logged-username{
  color: #3b1a4a !important;
  font-weight: 700;
  margin: 0 !important;
  font-size: var(--toolbar-font);
  white-space: nowrap;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botón logout */
body.page-chrome #logout-button{
  border-radius: 999px !important;
  border: 1px solid rgba(59, 26, 74, 0.35) !important;
  color: #3b1a4a !important;
  background: #fff !important;
  font-weight: 700 !important;
  height: 36px;
  padding: 6px 14px;
  line-height: 1;
  white-space: nowrap;
}

body.page-chrome #logout-button:hover{
  background: rgba(59, 26, 74, 0.06) !important;
}

/* Botón engranaje (blindado contra overrides de otras páginas) */
body.page-chrome .btn-gear{
  width: 40px !important;
  height: 36px !important;
  border-radius: 12px !important; /* evita cápsula */
  border: 1px solid rgba(59, 26, 74, 0.18) !important;
  background: rgba(255, 255, 255, 0.65) !important;
  color: #3b1a4a !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  line-height: 1 !important;
  font-size: 18px !important; /* tamaño del icono <i class="bi ..."> */
}

body.page-chrome .btn-gear:hover{
  background: rgba(59, 26, 74, 0.06) !important;
}

/* sin flecha */
body.page-chrome .btn-gear.dropdown-toggle::after{
  display: none;
}

/* Dropdown: z-index alto para que no lo tape nada */
body.page-chrome .dropdown-menu{
  border: 1px solid rgba(59, 26, 74, 0.12);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(59, 26, 74, 0.12);
  padding: 10px;
  z-index: 2000;
}

body.page-chrome .dropdown-item{
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  color: #3b1a4a;
}

body.page-chrome .dropdown-item:hover{
  background: rgba(59, 26, 74, 0.06);
}

/* Checks (modo debug, etc.) */
body.page-chrome .container-fluid .form-check-input:checked{
  background-color: #3b1a4a !important;
  border-color: #3b1a4a !important;
}

/* Mobile: aquí sí dejamos que se apile */
@media (max-width: 576px){
  body.page-chrome .container-fluid > .toolbar{
    flex-wrap: wrap;
    min-height: auto;
    padding: 10px 12px;
  }

  body.page-chrome .main-nav{
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    gap: 10px;
    margin-left: 0 !important;
  }

  body.page-chrome .logout-container{
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  body.page-chrome #logged-username{
    max-width: 45vw;
  }
}

/* Transición de página */
html.is-loading body {
  opacity: 0 !important;
}

body {
  opacity: 1;
  transition: opacity 280ms ease;
}

/* Respeta usuarios con reduce motion */
@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }
}

/* Contenedor para controlar el tamaño */
.custom-loader-wrapper {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* La imagen que gira */
.loader-logo {
  width: 100%;
  height: auto;
  /* Ajusta la velocidad aquí: 1.2s es un giro suave */
  animation: custom-spin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Definición de la animación */
@keyframes custom-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
