/* ===== ValladolIA — Merged stylesheet (style.css + sidenav.css) ===== */
@import "https://fonts.googleapis.com/css?family=Noto+Sans";

/* ---- Reset / Base ---- */
body {
  padding: 0;
  margin: 0;
  font-family: 'Noto Sans', sans-serif;
  background-color: #142B47;
  color: #ffffff;
}

/* ---- Screen Reader Only ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Logo ---- */
.logo {
  height: 165px;
  padding: 0;
  margin-top: 5px;
}

/* ---- Chat header (single definition — removed duplicate from sidenav.css) ---- */
#chatTitle {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background-color: #142B47;
  color: white;
  border-bottom: 2px solid #0A84FF;
  margin: 0 auto;
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 900px;
  height: 60px;
  box-sizing: border-box;
  z-index: 10;
}

/* ---- Chat block ---- */
#chat-block {
  margin: 0 auto;
  position: fixed;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 900px;
  padding-top: 40px;
}

/* ---- Reference button ---- */
#referenceBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 18px;
  background-color: #0A84FF;
  color: #ffffff;
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

#referenceBtn:hover {
  background-color: #006FCC;
}

.hiddenButton {
  display: none;
}

/* ---- Sidenav ---- */
.sidenav {
  height: 100%;
  width: 80%;
  position: fixed;
  top: 0;
  z-index: 999;
  right: -80%;
  background-color: #142B47;
  overflow-x: hidden;
  transition: 0.5s;
  padding-top: 60px;
  color: #ffffff;
  border-left: 3px solid #0A84FF;
}

#referencesContent {
  padding: 0 15px;
}

.sidenav a {
  text-decoration: none;
  font-size: 18px;
  color: #ffffff;
  display: block;
  transition: 0.3s;
}

.sidenav a:hover {
  color: #0A84FF;
}

.sidenav .closebtn {
  position: absolute;
  top: 0;
  right: 20px;
  font-size: 36px;
  color: #ffffff;
  cursor: pointer;
}

.reference-link {
  font-size: 16px !important;
  color: #FFD580 !important;
  display: inline !important;
}

.open-sidenav {
  right: 0 !important;
}

.close-sidenav {
  right: -80% !important;
}

/* ---- Reference cards ---- */
.reference-card {
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.article-id {
  font-weight: bold;
  color: #ffffff;
}

.doc-title {
  font-weight: bold;
  color: #FFD580;
  display: inline-block;
  margin-bottom: 4px;
}

.doc-title a {
  display: inline-block;
  font-size: 12px;
  font-weight: bold;
}

/* ---- Buttons ---- */
.reference-block,
.reference-block.show {
  opacity: 1;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  align-items: center;
}

.hidden-reference-block {
  display: none !important;
}

.disappear {
  display: none !important;
}

.buttons {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  margin-top: 5px;
}

.button,
.like-button,
.dislike-button,
.references {
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  background-color: #0A84FF;
  color: white;
  transition: background-color 0.3s ease;
}

.button:hover,
.like-button:hover,
.dislike-button:hover,
.references:hover {
  background-color: #006FCC;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background-color: #1f3554;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: #0A84FF;
  border-radius: 10px;
}

/* ---- Chat thread ---- */
.chat-thread {
  margin: 24px auto 0 auto;
  padding: 0 20px 0 20px;
  list-style: none;
  overflow-y: scroll;
  overflow-x: hidden;
  height: calc(100vh - 160px);
}

.chat-thread li {
  position: relative;
  clear: both;
  display: inline-block;
  padding: 16px 40px 16px 20px;
  margin: 0 0 20px 0;
  font: 16px/20px 'Noto Sans', sans-serif;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.chat-thread .user {
  float: right;
  background-color: #0A84FF;
  color: white;
}

.chat-thread .model {
  float: left;
  background-color: rgba(255, 255, 255, 0.12);
  color: #e2e2e2;
}

/* Markdown rendering inside model messages */
.message-text p {
  margin: 0 0 10px 0;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul,
.message-text ol {
  margin: 8px 0 10px 0;
  padding-left: 22px;
}

.message-text li {
  margin-bottom: 4px;
}

.message-text strong {
  color: #ffffff;
  font-weight: 600;
}

.message-text em {
  font-style: italic;
}

.message-text code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.9em;
}

/* ---- Chat input ---- */
.chat-window {
  position: fixed;
  bottom: 18px;
  width: 100%;
  max-width: 900px;
  left: 0;
  right: 0;
  margin: 0 auto;
  padding: 0 5%;
  box-sizing: border-box;
}

.chat-window-message {
  width: 100%;
  box-sizing: border-box;
  font: 18px 'Noto Sans', sans-serif;
  background: #1f3554;
  color: #ffffff;
  border: 1px solid #0A84FF;
  border-radius: 6px;
  padding: 10px 12px;
  outline: none;
  resize: none;
  overflow: hidden;
}

.chat-window-message::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* ---- Branding ---- */
.ia-text {
  color: #0A84FF;
  font-weight: bold;
}

/* ---- Loading animation ---- */
.message.loading::before {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
  margin-top: 4px;
  animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
  animation-delay: 0.15s;
  border: none;
}

.message.loading span {
  display: block;
  font-size: 0;
  width: 20px;
  height: 10px;
}

.message.loading span::before,
.message.loading span::after {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  z-index: 2;
  margin-top: 4px;
  animation: ball 0.45s cubic-bezier(0, 0, 0.15, 1) alternate infinite;
}

.message.loading span::before {
  margin-left: -7px;
}

.message.loading span::after {
  margin-left: 7px;
  animation-delay: 0.3s;
}

@keyframes ball {
  from {
    transform: translateY(0) scaleY(0.8);
  }

  to {
    transform: translateY(-10px);
  }
}

/* ---- Responsive ---- */
@media all and (max-width: 767px) {
  .sidenav {
    width: 100%;
    right: -100%;
    border-left: none;
  }

  .sidenav .closebtn {
    right: 10px;
    padding-left: 10px;
  }

  #referenceBtn {
    position: relative;
    width: 100%;
  }

  .open-sidenav {
    right: 0 !important;
  }

  .close-sidenav {
    right: -100% !important;
  }

  .chat-window {
    padding: 0 20px;
  }
}