/* ==========================================================================
   Panel administrativo — estilos propios (complementan Bootstrap 5)
   ========================================================================== */

:root {
  --wbot-primary: #0d6efd;
  --wbot-sidebar-w: 250px;
  --wbot-navbar-h: 56px;
}

body {
  min-height: 100vh;
}

/* ----- Login ------------------------------------------------------------- */
.login-body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(13, 110, 253, .18), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(25, 135, 84, .16), transparent 60%);
}

.login-wrap {
  width: 100%;
  max-width: 430px;
  padding: 1.5rem;
}

.login-card {
  border-radius: 1rem;
}

.login-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto;
  border-radius: 1rem;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--wbot-primary), #0a58ca);
}

.login-logo {
  width: min(100%, 300px);
  max-height: 180px;
  object-fit: contain;
}

/* ----- Estructura ------------------------------------------------------- */
.wbot-navbar {
  background: linear-gradient(90deg, var(--wbot-primary), #0a58ca);
  min-height: var(--wbot-navbar-h);
  color: #fff;
}

.wbot-navbar .navbar-brand,
.wbot-navbar .navbar-brand:hover {
  color: #fff;
}

.nav-logo {
  height: 42px;
  width: 70px;
  object-fit: contain;
  background: #fff;
  border-radius: .25rem;
  padding: 2px 4px;
}

.wbot-layout {
  display: flex;
  min-height: calc(100vh - var(--wbot-navbar-h));
}

.wbot-sidebar {
  width: var(--wbot-sidebar-w);
  flex: 0 0 var(--wbot-sidebar-w);
  background: var(--bs-body-bg);
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: var(--wbot-navbar-h);
  height: calc(100vh - var(--wbot-navbar-h));
  overflow-y: auto;
  z-index: 1030;
}

.wbot-main {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bs-tertiary-bg);
}

.wbot-sidebar .nav-link {
  color: var(--bs-body-color);
  border-radius: .5rem;
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .94rem;
}

.wbot-sidebar .nav-link:hover {
  background: var(--bs-secondary-bg);
}

.wbot-sidebar .nav-link.active {
  background: var(--wbot-primary);
  color: #fff;
}

.wbot-sidebar .nav-seccion {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bs-secondary-color);
  padding: .9rem .75rem .25rem;
  font-weight: 600;
}

.wbot-backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  .wbot-sidebar {
    position: fixed;
    top: var(--wbot-navbar-h);
    left: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, .2);
  }

  .wbot-sidebar.abierto {
    transform: translateX(0);
  }

  .wbot-backdrop.visible {
    display: block;
    position: fixed;
    inset: var(--wbot-navbar-h) 0 0 0;
    background: rgba(0, 0, 0, .4);
    z-index: 1029;
  }
}

/* ----- Tarjetas de métricas -------------------------------------------- */
.stat-card {
  border: 0;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  height: 100%;
}

.stat-card .stat-valor {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-icono {
  width: 44px;
  height: 44px;
  border-radius: .6rem;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex: 0 0 44px;
}

/* ----- Tablas ----------------------------------------------------------- */
.tabla-wrap {
  background: var(--bs-body-bg);
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  overflow: hidden;
}

.table td,
.table th {
  vertical-align: middle;
}

.celda-recorte {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acciones {
  white-space: nowrap;
}

/* ----- Bandeja de conversaciones --------------------------------------- */
.inbox {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  height: calc(100vh - var(--wbot-navbar-h) - 2rem);
}

@media (max-width: 991.98px) {
  .inbox {
    grid-template-columns: 1fr;
    height: auto;
  }

  .inbox.viendo-chat .inbox-lista {
    display: none;
  }

  .inbox:not(.viendo-chat) .inbox-chat {
    display: none;
  }
}

.inbox-lista,
.inbox-chat {
  background: var(--bs-body-bg);
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 420px;
}

.inbox-items {
  overflow-y: auto;
  flex: 1;
}

.inbox-item {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--bs-border-color);
  cursor: pointer;
}

.inbox-item:hover {
  background: var(--bs-secondary-bg);
}

.inbox-item.activo {
  background: rgba(13, 110, 253, .1);
  border-left: 3px solid var(--wbot-primary);
}

.chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bs-tertiary-bg);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.burbuja {
  max-width: min(78%, 560px);
  padding: .55rem .8rem;
  border-radius: .9rem;
  font-size: .9rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}

.burbuja.entrada {
  align-self: flex-start;
  background: var(--bs-body-bg);
  border-bottom-left-radius: .25rem;
}

.burbuja.salida {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111;
  border-bottom-right-radius: .25rem;
}

[data-bs-theme="dark"] .burbuja.salida {
  background: #005c4b;
  color: #e9edef;
}

.burbuja .meta {
  font-size: .68rem;
  opacity: .65;
  margin-top: .25rem;
  display: flex;
  gap: .4rem;
  align-items: center;
}

.chat-compositor {
  border-top: 1px solid var(--bs-border-color);
  padding: .6rem;
  background: var(--bs-body-bg);
}

/* ----- Utilidades ------------------------------------------------------ */
.score-barra {
  height: 6px;
  border-radius: 3px;
  background: var(--bs-secondary-bg);
  overflow: hidden;
  min-width: 60px;
}

.score-barra > span {
  display: block;
  height: 100%;
}

.plantilla-hint {
  font-family: var(--bs-font-monospace);
  font-size: .78rem;
}

.vista-previa {
  white-space: pre-wrap;
  font-size: .88rem;
  background: var(--bs-tertiary-bg);
  border-radius: .5rem;
  padding: .75rem;
  max-height: 320px;
  overflow-y: auto;
}

.cursor-pointer {
  cursor: pointer;
}

.chart-box {
  position: relative;
  height: 280px;
}

.chart-box.baja {
  height: 220px;
}

.form-label {
  font-weight: 500;
  font-size: .9rem;
  margin-bottom: .25rem;
}

code.token {
  background: var(--bs-secondary-bg);
  padding: .05rem .3rem;
  border-radius: .25rem;
  font-size: .8rem;
}
