/* =====================
   BASE GLOBAL
   ===================== */
body {
  margin: 0;
  font-family: Arial, sans-serif;
}

.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.topbar {
  background: #fff;        /* topbar claro */
  color: #23272f;
  box-shadow: 0 1px 6px rgba(211, 100, 100, 0.08);
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 1rem;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  height: 100vh;
  background: #23272f;
  color: #fff;
  box-shadow: 2px 0 12px rgba(0,0,0,0.12);
  z-index: 2;
  padding: 2rem 1rem;
  position: relative;
  display: block;
  transition:
    transform 0.3s cubic-bezier(.4,0,.2,1),
    opacity 0.25s cubic-bezier(.4,0,.2,1);
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.sidebar.anim-hide {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar-item {
  padding: 0.75rem;
  cursor: pointer;
}

.sidebar-item.active {
  background-color: #ccc;
  font-weight: bold;
}

main {
  flex: 1;
  padding: 2rem;
}

#main-content {
  opacity: 1;
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1);
}

#main-content.fade {
  opacity: 0;
}

/* Caja de chat demo */
.chat-box {
  background: #181924;
  border-radius: 0.7rem;
  box-shadow: 0 1px 6px rgba(44,44,60,.12);
  padding: 1.5rem;
  min-height: 300px;
  margin-bottom: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.chat-form {
  display: flex;
  gap: 10px;
}

.chat-form input {
  flex: 1;
  padding: 0.5rem;
}

.chat-form button {
  padding: 0.5rem 1rem;
}

.mensaje {
  margin-bottom: 0.5rem;
}

.mensaje-usuario {
  text-align: right;
  color: blue;
}

.mensaje-bot {
  text-align: left;
  color: green;
}

/* Botón hamburguesa en topbar */
.hamburger {
  font-size: 2rem;
  background: transparent;
  border: none;
  color: #23272f !important; /* o #fff si el topbar es oscuro */
  cursor: pointer;
  margin-right: 1rem;
}

.menu-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: transparent;
  border: none;
  font-size: 2rem;
  color: #23272f;
  cursor: pointer;
}

#sidebar-container {
  width: 220px;
  min-width: 220px;
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 99;
  background: transparent;
  display: flex;
}

/* Colapsa contenedor cuando sidebar está oculto */
#sidebar-container:empty,
#sidebar-container .sidebar.anim-hide {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

.app-container.sidebar-open main {
  /* Ajustes cuando el sidebar está abierto */
  padding-left: 1rem;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  #sidebar-container,
  .sidebar {
    position: fixed;
    left: 0;
    top: 56px; /* altura del topbar */
    width: 80vw;
    min-width: 0;
    max-width: 300px;
    height: calc(100vh - 56px);
    z-index: 999;
    transition: all 0.2s;
  }
  .sidebar.anim-hide {
    display: none !important;
  }
}

/* =====================
   MODO CLARO / OSCURO
   Tuerca y modales
   ===================== */

/* Variables por modo */
:root.modo-claro {
  --color-bg: #fff;
  --color-fg: #23272f;
  --color-accent: #23272f;
}

:root.modo-oscuro {
  --color-bg: #181924;
  --color-fg: #e8e8e8;
  --color-accent: #e8e8e8;
}

/* Aplicación de variables a contenedores clave */
body,
.app-container,
.chat-box,
.config-modal,
.bot-config-modal {
  background: var(--color-bg) !important;
  color: var(--color-fg) !important;
}

/* Botón flotante de configuración (tuerca) */
.bot-config-btn {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1000;
  background: #23272f;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 54px;
  height: 54px;
  font-size: 2rem;
  box-shadow: 0 2px 10px rgba(44,44,60,.18);
  cursor: pointer;
  transition: background 0.2s, transform 0.06s;
}

.bot-config-btn:hover {
  background: #44485a;
}

.bot-config-btn:active {
  transform: translateY(1px);
}

/* Mini modal rápido junto a la tuerca */
.bot-config-modal {
  position: fixed;
  bottom: 80px;
  left: 2rem;
  background: #fff;
  padding: 1.2rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 32px rgba(44,44,60,.18);
  z-index: 1001;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.bot-config-modal.hidden {
  display: none;
}

.bot-config-modal button {
  background: #e8e8e8;
  color: #23272f;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.bot-config-modal button:hover {
  background: #d2d2d2;
}

/* Fondo y modal de configuración general */
.config-modal-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(44,44,60,.18);
  z-index: 999;
  transition: opacity .2s;
}

.config-modal-bg.hidden {
  display: none;
}

.config-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  min-width: 320px;
  max-width: 94vw;
  border-radius: 1.3rem;
  box-shadow: 0 6px 36px rgba(44,44,60,.28);
  z-index: 1000;
  padding: 1.3rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.config-modal.hidden {
  display: none;
}

.config-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-modal-header button {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
}

.config-modal-body label {
  display: block;
  font-weight: bold;
  margin-bottom: .3rem;
}

#empresa-select {
  font-size: 1.1rem;
  padding: .5rem;
  border-radius: .4rem;
  border: 1px solid #b0b0b0;
}

/* =====================
   LOGIN / AUTH SCREENS
   ===================== */

.login-container {
  max-width: 400px;
  margin: 7vh auto 0 auto;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 2px 22px rgba(44,44,60,.13);
  padding: 2rem 2.5rem;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.login-container label {
  font-size: 1rem;
  color: #23272f;
}

.login-container input {
  padding: 0.7rem;
  border-radius: .6rem;
  border: 1px solid #ccc;
  font-size: 1.1rem;
  background: #fafbfc;
  outline: none;
}

.login-container input:focus {
  border-color: #205caa;
  box-shadow: 0 0 0 3px rgba(32,92,170,.18);
}

#btn-login {
  background: #205caa; /* Azul corporativo */
  color: #fff;
  border: none;
  padding: 0.85rem;
  border-radius: 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: bold;
  margin-top: 0.6rem;
  transition: background 0.18s;
}

#btn-login:hover {
  background: #3576d1;
}

/* Mensajes de error */
.login-error, #login-error {
  color: #ff4d4f;
  font-size: 1rem;
  margin-top: 0.3rem;
  min-height: 1.5em;
  text-align: center;
  font-weight: bold;
}

/* Título */
.login-container h2 {
  color: #205caa;
  font-weight: bold;
  margin-bottom: 2rem;
  font-size: 2rem;
  letter-spacing: 0.02em;
}

/* Link unitario para páginas antiguas que lo usen */
.link-olvide {
  display: block;
  text-align: right;
  font-size: .95rem;
  color: #205caa;
  text-decoration: underline;
}

.link-olvide:hover {
  text-decoration: none;
}

/* Contenedor de acciones: Crear Cuenta a la izquierda, Olvidaste a la derecha */
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
}

.auth-links a {
  font-size: .95rem;
  color: #205caa;
  text-decoration: underline;
  cursor: pointer;
}

.auth-links a:hover {
  text-decoration: none;
}

/* Botón Crear Cuenta normal para formularios */
.btn-crear-cuenta {
  background: #e8e8e8;
  color: #23272f;
  border: 1px solid #d1d5db;
  padding: 0.85rem 1rem;
  border-radius: 0.6rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 0.6rem;
  transition: background 0.18s;
}

.btn-crear-cuenta:hover {
  background: #dcdcdc;
}

/* Variante oscura para Regresar en crear cuenta */
.btn-crear-cuenta.btn-oscuro {
  background: #44485a;
  color: #fff;  /* Texto blanco */
  border-color: #44485a;
}

.btn-crear-cuenta.btn-oscuro:hover {
  background: #3b3f50;
  color: #fff;
}

/* Botón de Google */
.google-btn {
  width: 260px;
  height: 40px;
  margin: 15px auto 0 auto;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, transform 0.06s;
}

.google-btn:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.google-btn:active {
  transform: translateY(1px);
}

.google-icon-wrapper {
  background-color: #fff;
  border-right: 1px solid #ddd;
  height: 100%;
  width: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.google-icon {
  width: 19px;
  height: 19px;
  display: block;
}

.btn-text {
  flex: 1;
  text-align: center;
  font-size: 15px;
  color: #555;
  margin: 0;
}

/* Modales simples reutilizados en crear cuenta */
.modal-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}

.modal-cita {
  background: #fff;
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 0 15px #222;
  max-width: 400px;
  width: 90%;
}

.hidden {
  display: none;
}

