:root {
  /* Light theme variables */
  --bg-color: #ffffff;
  --text-color: #333333;
  --card-bg: #f8f9fa;
  --link-color: #007bff;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --brand-logo-bg: #ffffff;
  --sidebar-bg: #f8f9fa;
}

[data-theme="dark"] {
  /* Dark theme variables */
  --bg-color: #121212;
  --text-color: #e0e0e0;              /* mejor legibilidad */
  --card-bg: #1e1e1e;
  --link-color: #82b1ff;              /* enlaces destacados */
  --shadow-color: rgba(0, 0, 0, 0.7); /* sombras más profundas */
  --brand-logo-bg: #2a2a2a;
  --sidebar-bg: #1e1e1e;              /* fondo sidebar */
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* Sidebar (light y dark) */
.sidebar {
  background-color: var(--sidebar-bg);
}
[data-theme="dark"] .sidebar {
  background-color: var(--sidebar-bg) !important;
}
.sidebar a {
  color: var(--text-color);
}
.sidebar a:hover {
  color: var(--link-color);
}

/* Cartas */
.card-custom {
  background-color: var(--card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}


/* Topbar: SIEMPRE mismo color (ERP) */
.topbar{
  background: linear-gradient(90deg, #101318, #1a1f27) !important;
  color: #fff !important;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* anulamos cualquier variación por tema */
[data-theme="dark"] .topbar{
  background: linear-gradient(90deg, #101318, #1a1f27) !important;
}


/* Enlaces generales */
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  opacity: 0.8;
}
[data-theme="dark"] a {
  color: var(--link-color);
}

/* Contenedor responsive full-alto */
.embed-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 140px);
  overflow: hidden;
  margin-bottom: 0;
}
.embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Tarjeta full-alto de términos */
.terms-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
}
.terms-content {
  flex: 1;
  overflow: auto;
  margin-bottom: 1rem;
}

/* Logo en el topbar */
.brand-logo {
  background-color: var(--brand-logo-bg);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}
.logo-img {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* Logo grande en home */
.page-logo {
  background-color: var(--brand-logo-bg);
  padding: 1rem;
  border-radius: 0.5rem;
  display: inline-block;
}
.page-logo img {
  max-height: 100px;
  width: auto;
  object-fit: contain;
}

/* Fija siempre el ancho del sidebar */
.sidebar {
  width: 250px !important;
  flex-shrink: 0;
}

/* Impide que el texto de los nav-links haga wrap */
.sidebar .nav-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ajusta el main para que no se solape con el sidebar */
main {
  margin-left: 0; /* si antes lo desplazabas, quítalo */
}



.mx-auto {
  width: 100%;
}

@media (min-width: 992px) {
  .mx-auto[style] {
    /* si necesitas que el inline max-width tenga prioridad */
    max-width: 900px !important;
  }
}

/* Opcional: reducir el padding interno de la tabla cuando está estrecha */
.mx-auto .table {
  margin-bottom: 0;
}








/* =========================
   Chat en Sidebar (Portal)
   ========================= */

.sidebar-chat {
  position: relative;
}

/* Launcher circular tipo “burbuja” dentro del sidebar (abajo) */
.sidebar-chat-launcher{
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: #0b0a3a;              /* podés ajustar al azul del topbar */
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  cursor: pointer;

  /* Para que no “ocupe” todo el ancho aunque el contenedor sea full */
  margin: 0 auto;
}

.sidebar-chat-launcher i{
  font-size: 20px;
  line-height: 1;
}

.sidebar-chat-launcher:hover{
  filter: brightness(1.05);
}

/* si está animando, NO forzar transform en hover */
.sidebar-chat-launcher:not(.is-alive):hover{
  transform: translateY(-1px);
}


.sidebar-chat-launcher:active{
  transform: translateY(0);
}


/* IMPORTANTE: evitar que el PNG se “derrame” */
.sidebar-chat-launcher{
  padding: 0 !important;
  overflow: hidden !important; /* clave */
}

/* Tamaño fijo del ícono/avatar dentro del botón */
.sidebar-chat-icon{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50% !important; /* que quede redondo */
}





/* Panel del chat: por defecto flotante y SIEMPRE dentro del viewport */
.sidebar-chat-panel{
  display: none;
  position: fixed;                  /* clave: se recorta contra la ventana */
  left: 16px;
  bottom: 92px;                     /* arriba del botón circular */
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 420px;
  max-height: calc(100vh - 140px);  /* nunca fuera de pantalla */

  background: var(--bg-color);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: .85rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  overflow: hidden;
  z-index: 3000;
}

.sidebar-chat-panel.open{
  display: flex;
  flex-direction: column;
}

/* Estado expandido */
.sidebar-chat-panel.expanded{
  left: 16px;
  right: 16px;
  width: auto;
  height: min(78vh, 720px);
  max-height: calc(100vh - 90px);
}

/* En mobile: comportamiento tipo drawer */
@media (max-width: 576px){
  .sidebar-chat-panel{
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 82px;
    height: 60vh;
    max-height: calc(100vh - 120px);
  }
  .sidebar-chat-panel.expanded{
    height: 78vh;
  }
}


.sidebar-chat-header{
  padding: .6rem .7rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: var(--card-bg);
}

.sidebar-chat-title{
  font-weight: 700;
  font-size: .92rem;
}

.sidebar-chat-subtitle{
  font-size: .78rem;
  color: var(--text-color);
  opacity: .7;
}

.sidebar-chat-avatar{
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
  background: var(--card-bg);
}

.sidebar-chat-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-chat-body{
  flex: 1;
  overflow-y: auto;
  padding: .55rem .65rem;
  background: var(--bg-color);
}

.sidebar-chat-form{
  display: flex;
  gap: .4rem;
  padding: .55rem .6rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: var(--card-bg);
}

.sidebar-chat-msg{
  margin-bottom: .45rem;
  display: flex;
}

.sidebar-chat-msg.user{ justify-content: flex-end; }
.sidebar-chat-msg.bot{ justify-content: flex-start; }

.sidebar-chat-bubble{
  max-width: 85%;
  padding: .45rem .6rem;
  border-radius: .75rem;
  font-size: .86rem;
  line-height: 1.25;
  box-shadow: 0 1px 3px var(--shadow-color);
}

.sidebar-chat-msg.user .sidebar-chat-bubble{
  background: var(--link-color);
  color: #fff;
  border-bottom-right-radius: .25rem;
}

.sidebar-chat-msg.bot .sidebar-chat-bubble{
  background: var(--card-bg);
  color: var(--text-color);
  border-bottom-left-radius: .25rem;
}



/* =========================
   Micro-animación "vivo" launcher chat
   ========================= */

/* estado normal: sin animación */
#portalChatLauncher{
  will-change: transform, box-shadow;
}

/* solo animar cuando el panel NO está abierto */
#portalChatLauncher.is-alive{
  animation: chatAliveFloat 5.2s ease-in-out infinite;
}

/* micro "respiración": sube/baja apenas + leve cambio de sombra */
@keyframes chatAliveFloat{
  0%, 70%, 100% {
    transform: translateY(0);
    box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  }
  78% {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.24);
  }
  86% {
    transform: translateY(0);
    box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  }
  92% {
    transform: translateY(-1px);
    box-shadow: 0 11px 22px rgba(0,0,0,0.23);
  }
}

/* Accesibilidad: respetar "reduced motion" */
@media (prefers-reduced-motion: reduce){
  #portalChatLauncher.is-alive{
    animation: none !important;
  }
}




/* ————————————————————————————————————————
   Sidebar: restaurar flujo normal y espaciado fijo
   ———————————————————————————————————————— */
nav.sidebar ul.nav.flex-column {
  /* volver a bloque, sin gap */
  display: block !important;
  gap: 0 !important;
}

nav.sidebar ul.nav.flex-column > li.nav-item {
  /* igualar separación entre items */
  margin-bottom: 1rem !important;
}

nav.sidebar ul.nav.flex-column > li.nav-item:last-child {
  /* sin margen al final */
  margin-bottom: 0 !important;
}

nav.sidebar ul.nav.flex-column li.nav-item a.nav-link {
  /* restablecer padding y line-height */
  display: block !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}




/* Hacemos que #okr-summary ocupe toda la pantalla cuando esté en fullscreen */
#okr-summary:fullscreen,
#okr-summary:-webkit-full-screen {
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  padding: 1rem;
  background: var(--bg-color);
  overflow: auto;
}


/* Fullscreen OKR - scroll vertical */
#okr-fullscreen-container:-webkit-full-screen,
#okr-fullscreen-container:-moz-full-screen,
#okr-fullscreen-container:fullscreen {
  height: 100vh;         
  overflow-y: auto;      
}

/* Limitar y hacer scroll interno sólo al resumen */
#okr-summary {
  max-height: calc(100vh - 100px);  /* Ajusta 100px según el alto de tu header fullscreen */
  overflow-y: auto;
}



/* panel abierto (que gane sí o sí) */
#portalChatPanel.open{
  display: flex !important;
  flex-direction: column;
}

/* Evita bugs de ancho en layouts flex con tablas/overflow (tablet/mobile) */
.content-area{
  min-width: 0;
  width: 100%;
}

