/* ─────────────────── Variables & Reset ─────────────────── */
:root {
  --blue: #0000ab;
  --white: #ffffff;
  --radius: 6px;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 4px 16px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: "PT Serif", sans-serif;
  background: var(--blue);
  color: var(--blue);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-image: url('/static/images/body.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}




/* ─────────────────── Encabezado ─────────────────── */
.site-header {
  margin-top:2rem;
  background: var(--white);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(1rem, 5vw, 2.5rem);
}

.logo {
  height: 60px;
  width: auto;
}

.back-link {
  font-weight: 600;
  color: #c24c0a; 
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ─────────────────── Zona central ─────────────────── */
.wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  place-items: center;
  padding-top: 1rem;
  padding-inline: 1rem;
}


/* BLANC */
.brand {
  font-family: 'Druk Wide';
  font-style: normal;
  font-size: clamp(3rem, 10vw, 7.4rem);
  line-height: 120px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 0.9;
  background: var(--blue);
  width: 100vw;
  padding: 1.2rem 1rem;
  padding-bottom: 0;
  transform: rotate(-0.17deg);

}

/* Tarjeta ------------ */
.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 550px; 
  max-height: 80vh; 
  overflow-y: auto; 
  background: var(--white);
  width: 100%;
  max-width: 760px; 
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(2.2rem, 5vw, 4rem) clamp(2rem, 5vw, 3.5rem);
  position:relative;
  padding-bottom:1rem;
}

.card-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.card-sub {
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* ─────────────────── Formulario ─────────────────── */
form input[type="text"],
form input[type="email"] {
  display: block;
  width: 100%;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  font-size: 1rem;
}

form input::placeholder {
  color: var(--blue);
  opacity: 0.5;
}


.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  user-select: none;
}

.check input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}

/* Botón */
.btn {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  border: none;
  padding: 0.5rem 3.2rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  margin: 2rem auto 0; 
  transition: background 0.2s ease;
  font-size: 1rem;
}

.btn:hover {
  opacity: 0.9;
}
#btn-continuar {
  margin-top: 1.5rem;
  margin-left: 0;
}

/* Logos institucionales dentro de la tarjeta */
.logos {
  width: 300px;
  height: auto;

}
/* Desktop: solo se ve dentro de la tarjeta */
.logos-desktop {
  display: block;
  margin-top: 0.5rem;
  margin-left: auto;
  align-self: flex-end;
}

.logos-mobile {
  display: none;
}

/* Mostrar solo en desktop */
.logos-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
}

.logo-item {
  height: 44px;
  width: auto;
  flex-shrink: 0;
}

/* Mostrar solo en mobile */
.logos-container-mobile {
  display: none;
}

.logo-mobile {
  height: 40px;
  width: auto;
  margin: 0.25rem;
}

/* MEDIA QUERY: ocultar desktop y mostrar mobile en pantallas pequeñas */
@media (max-width: 480px) {
  .logos-container {
    display: none;
  }

  .logos-container-mobile {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    padding: 0.2rem 0;
  }

  .logo-mobile {
    height: 36px;
    max-width: 80px;
    object-fit: contain;
    flex-shrink: 0;
  }
}

.logo-adjust {
  transform: scale(1.5); 
  transform-origin: center;
}

.hidden {
  display: none !important;
}

.info-box {
  background: #fcea53;
  padding: 1rem;
  margin-top: 2rem;
  font-size: 0.95rem;
  color: #000;
  border-radius: var(--radius);
}

.input-error {
  border: 2px solid red !important;
  background-color: #fff5f5;
}
.form-error {
  color: red;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}


/* CONTENEDOR PRINCIPAL */
.chat-container {
  display: flex;
  height: 100vh;
  background-color: white;
  font-family: 'PT Serif', serif;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  border-radius: var(--radius);
  margin:1rem 0.7rem;
  
  background-color: #0000AB;
  color: white;
  width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1rem;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; 

}



.sidebar-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-btn {
  background-color: white;
  color: #0000AB;
  border: none;
  padding: 0.65rem 0.5rem;
  border-radius: 4px;
  font-weight: 400;
  text-align: center;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: 'Lyon Text';
  text-align: right;
}

/* Categorias */
.category-options {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.category-btn {
  background-color: #5555ff;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: normal;
  padding: 0.65rem 0.5rem;
  text-align: right;
}

/* Estilo especial para la categoría seleccionada */
.category-btn.active {
  border-right: 4px solid white;
  font-weight: bold;
}


.profile {
  background-color: #f9fafa;
  border: 1px solid #e8eff7;
  padding: 0.5rem 0.6rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile .avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
}
.profile div {
  line-height: 1.1;
}

.greeting {
  font-size: 0.65rem;
  color: #0000AB;
  line-height: 1;

}

.username {
  font-size: 0.9rem;
  font-weight: bold;
  color: #0000AB;
  word-break: break-word;
  max-width: 100px; 
}


/* ZONA PRINCIPAL DEL CHAT */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 2rem 0rem 0rem;
  position: relative;
}

/* BARRA DE BÚSQUEDA */
.chat-header {
  padding-bottom: 1rem;
  display: flex;
  justify-content: flex-end;
}

/* Search */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 12rem;
}

.search-icon {
  position: absolute;
  left: 0.5rem;
  width: 16px;
  height: 16px;
  pointer-events: none;
  opacity: 0.6;
}

.search-box {
font-family: 'Lyon Text';
font-weight: 400;
color: #B5B7C0;
line-height: 17px;
font-style: normal;

  width: 100%;
  padding: 0.5rem 0.5rem 0.5rem 2rem; 
  border: 1px solid rgba(145, 151, 179, 0.5);
  border-radius: 6px;
}


/* MENSAJES */
.chat-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  max-width: 75%;
}

.message p {
  background-color: white;
  border: 1px solid #0000AB;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}


.message.bot {
  align-self: flex-start;
}

.message.bot p {
  border-left: 4px solid #0000AB;
  padding-left: 0.5rem;
}
.message.user p {
  border-right: 4px solid #0000AB;
  padding-right: 0.5rem;
}
.avatar {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
}


.chat-input {
  padding-top: 0.75rem;
}

.input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid #0000AB;
  overflow: hidden;
}

.input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.4rem 1rem;
  font-size: 0.95rem;
  color: #0000AB;
  font-family: 'PT Serif', serif;

}

.input-wrapper input::placeholder {
  color: #0000AB;
  opacity: 1;
}
.input-wrapper .icons {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.3rem;
  padding-right: 0.5rem; 
}

.input-wrapper .icons button {
  width: 28px; 
  height: 28px;
  padding: 0;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor:pointer;
}

.input-wrapper .icons img.icon-btn {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

/* Hover suave */
.input-wrapper .icons button:hover img.icon-btn {
  filter: brightness(0.2);
}


/* Esto aplica SOLO al chat-screen */
#chat-screen.chat-container {
  min-height: 550px; 
  max-height: 80vh; 
  max-width: 760px;
  width: 100%;
  height: 49vh;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05),
              0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  background: white;
  display: flex;
}


.chat-footer {
  margin-top: auto;
  padding-top: 0rem;
  text-align: right;
}

.chat-footer .logos {
  width: 220px;
  height: auto;
}

.faq-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-family: inherit;
  border-bottom: 1px solid rgba(0, 0, 171, 0.2);
  color: #0000AB;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease;
}

.faq-item:hover {
  background: rgba(0, 0, 171, 0.05);
}

.faq-close {
  background: none;
  border: none;
  color: #0000AB;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  text-align: right;
  width: 100%;
  cursor: pointer;
}
.faq-close:hover {
  background: rgba(0, 0, 171, 0.05);
}


.faq-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px; 
  background-color: white;
  z-index: 10;
  overflow-y: auto;
  padding: 1rem;
}

.faq-overlay .faq-close {
  background: none;
  border: none;
  color: #0000AB;
  font-weight: bold;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  text-align: right;
  width: 100%;
  cursor: pointer;
}

.faq-overlay .faq-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  border-bottom: 1px solid rgba(0, 0, 171, 0.2);
  color: #0000AB;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease;
}

.faq-overlay .faq-item:hover {
  background: rgba(0, 0, 171, 0.05);
}

/* SPINNER */
.typing-animation::after {
  content: "";
  display: inline-block;
  animation: dots 1.2s steps(3, end) infinite;
  width: 1em;
  text-align: left;
}

@keyframes dots {
  0%   { content: ""; }
  33%  { content: "."; }
  66%  { content: ".."; }
  100% { content: "..."; }
}

.brand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--blue);
  padding: 1rem 1rem;
  width: 100%;
}
.global-mobile-btn {
  display: none;
}

/* Reajusta tamaño solo en móviles */
@media (max-width: 768px) {
  .brand {
    font-size: 2rem;
    text-align: left;
    padding: 0;
    margin: 0;
    color: white;
    background: none;
  }

  .global-mobile-btn {
    display: flex;
    font-size: 1.5rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid white;
    border-radius: 6px;
    background-color: transparent;
    color: white;
    cursor: pointer;
  }
}


/* ─────────────────── Responsivo ─────────────────── */
/* VERSION DESKTOP */

@media (min-width: 1980px) {
  .wrapper {
    place-items: center;
    padding-top: 0;
  }

  .card {

    max-width: none; 
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .logos {
    margin-top: auto;
    margin-bottom: 0;
  }
  #btn-continuar {
    margin-top: 1.5rem;
    margin-left: 0;
  }
  #chat-screen.chat-container {
    width: 65vw;
    height: 49vh;
    max-width: none;
  }
}

@media (max-width: 480px) {
  body {
    background: var(--white);
  }

  .site-header {
    margin-top: 0;
    height: auto;
    background: var(--blue);
    padding: 0.5rem 1rem;
  }

  .logo {
    height: 28px;
  }

  .brand {
    font-size: 2rem;
    text-align: left;
    padding: 1rem;
    color: var(--white);
    background: var(--blue);
    width: 100vw;
    padding-top: 1rem;
    margin-bottom: 0;
  }

  .wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem 1rem;
    height: calc(100dvh - 60px);
    max-height: 640px; 
  }

  .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 1.25rem;
    box-shadow: none;
    border-radius: 0;
    min-height: 400px;
  }

  .card-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }

  .card-sub {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }

  form input[type="text"],
  form input[type="email"] {
    padding: 0.8rem 1rem;
    font-size: 1rem;
  }

  .check {
    font-size: 0.8rem;
  }

  .btn {
    width: auto;
    display: block;
    margin: 1.5rem auto 0;
  }

  #btn-continuar {
    margin-left: 0;
    margin-right: 0;
  }


  .logos-desktop {
    display: none;
  }

  .logos-mobile {
    display: block;
    width: 260px;
    margin: 1rem auto;
    flex-shrink: 0;
  }

}





@media (max-width: 768px) {
  /* ZONA PRINCIPAL DEL CHAT */
.chat-main {

  padding: 1rem 1rem 1rem 1rem; 
}
  .sidebar {
    position: absolute;
    top: calc(3.5rem + 2.5rem);
    left: 0;
    width: 95%;
    background-color: #0000AB;
    z-index: 999;
    display: none;
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .sidebar.sidebar-open {
    display: flex;
    padding-top:3rem;
  }



  /* Ajustes visuales de los botones y perfil */
  .sidebar-buttons,
  .profile {
    margin-top: 1rem;
  }


  @media (min-width: 769px) {


    .sidebar {
      position: static;
      display: flex !important;
      width: 200px;
    }
  }
}


@media (max-width: 768px) {


  #chat-screen .chat-footer .logos {
    display: none;
  }

}
