
/* Improved typography for chat output */
#response p {
  margin-top: 1rem;
  margin-bottom: 1rem;
  line-height: 1.75;
}
#response p:first-child {
  margin-top: 0;
}
#response h1,
#response h2,
#response h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
/* Custom font */
body {
  font-family: 'Inter', sans-serif;
}
/* Mörkare textfärg för chattinnehåll */
#response {
  color: #1e293b; /* mörk slätefärg */
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
}


#chatForm input#message {
  flex: 1;
  background: transparent;
  border: none;
  color: #1e293b;
  font-size: 1.1rem;
  outline: none;
  padding: 8px 12px;
  border-radius: 9999px;
}

#chatForm button#dynamicButton {
  background: transparent;
  border: none;
  color: #1e293b;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
/* Snyggare punkt- och numrerade listor i chattutdata */
#response ul {
  padding-left: 1.25rem; /* motsvarar Tailwinds ml-5 */
  list-style-type: disc;
  margin-bottom: 1rem;
}
#response ol {
  padding-left: 1.25rem;
  list-style-type: decimal;
  margin-bottom: 1rem;
}
#response li + li {
  margin-top: 0.5rem;
}
/* Tydliga klickbara länkar i blå färg */
#response a {
  color: #1d4ed8; /* Blå färg motsvarande Tailwind's blue-700 */
  text-decoration: underline;
}
#response a:hover {
  color: #2563eb; /* Mörkare blå vid hover, motsvarande blue-600 */
}
/* Snyggare tabeller i chattutdata */
#response table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem 0;
}
#response th,
#response td {
  border: 1px solid #cbd5e1; /* ljusgrå kant */
  padding: 0.5rem 1rem;
  text-align: left;
}
#response th {
  background-color: #f1f5f9; /* ljus bakgrund för header */
  font-weight: 600;
}
#response tr:nth-child(even) {
  background-color: #f8fafc; /* växlande radfärg */
}
/* Snyggare kodblock */
#response pre {
  background-color: #f1f5f9; /* ljus grå bakgrund för kodblock */
  color: #1e293b; /* mörk text */
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  font-family: 'Source Code Pro', monospace;
}
#response code {
  background-color: #f1f5f9;
  color: #1e293b; /* mörk text för inline-kod */
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Source Code Pro', monospace;
}
/* Snyggare blockquotes */
#response blockquote {
  border-left: 4px solid #10a37f;
  padding-left: 1rem;
  color: #475569;
  font-style: italic;
  margin: 1rem 0;
}
/* Hide scrollbar */
#response {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}
#response::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

/* Center input form on initial load */
body.initial #chatForm {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 2rem);
  max-width: 800px;
  margin: 0;
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box;
}
/* Position helper text above centered form on initial load */
body.initial #helperText {
  position: absolute;
  top: calc(50% - 5rem);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 10;
  width: 100%;
  text-align: center;
}

/* Loader animation */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 1rem 0;
}

.loader span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #0c7f68; /* use accent color for better contrast */
  border-radius: 50%;
  animation: loaderBounce 0.8s infinite ease-in-out;
}

.loader span:nth-child(1) { animation-delay: 0s; }
.loader span:nth-child(2) { animation-delay: 0.2s; }
.loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loaderBounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
/* Bubble style for user messages */
#response .text-right {
  float: right;
  clear: both;
  background-color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  max-width: 80%;
  word-wrap: break-word;
  text-align: left;
}

/* Ensure bot responses clear floats and stay on left */
#response .text-left {
  clear: both;
}

#response .text-left,
#response .text-right {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

#typewriter::after {
  content: '|';
  margin-left: 2px;
  animation: blink 0.7s infinite;
  font-size: inherit;
  vertical-align: +2px;
}

@keyframes blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}


/* ChatForm: Behåll samma stil som tidigare */
#chatForm {
  width: calc(100% - 2rem);
  max-width: 800px;
  margin: 0 auto 1rem;
  background-color: rgba(255, 255, 255, 0.95);
  color: #1e293b;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: 2rem; /* Liten rundning för ett modernt utseende */
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box;
}

/* Själva textarea: Inga onödiga rundningar, snygg padding och plats för text */
#chatForm textarea#message {
  flex: 1;
  background: transparent;
  border: none;
  color: #1e293b;
  font-size: 1.1rem;
  outline: none;
  padding: 8px 12px;
  border-radius: 0.375rem; /* Lite rundning för snygg hörn, ej cirkel! */
  resize: none; /* Inget hörn för att dra ut rutan manuellt */
  overflow-y: auto; /* Skroll om mycket text */
  line-height: 1.5; /* Fin läsbarhet */
  min-height: 2.5rem; /* Grundhöjd */
  max-height: 10rem; /* Maxhöjd så att chatten inte sprängs */
  width: 100%; /* Snygg full bredd */
}

/* Knappen */
#chatForm button#dynamicButton {
  background: transparent;
  border: none;
  color: #1e293b;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  align-self: flex-end;
}

/* Navigationsknappar på landningssidan */
.landing-nav {
  margin-top: 2rem;
}

.landing-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.75rem;
  min-width: 8rem;
  min-height: 3.25rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 10px 24px rgba(16, 163, 127, 0.16);
}

.landing-nav-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(16, 163, 127, 0.22);
}

.landing-nav-button:focus-visible {
  outline: 3px solid rgba(16, 163, 127, 0.35);
  outline-offset: 3px;
}

.landing-nav-button--primary {
  background: linear-gradient(90deg, #10a37f 0%, #0c8f6c 100%);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(12, 143, 108, 0.25);
}

.landing-nav-button--secondary {
  background: #ffffff;
  color: #0c8f6c;
  border: 2px solid #10a37f;
  box-shadow: 0 10px 22px rgba(12, 143, 108, 0.18);
}

.landing-nav-button--secondary:hover {
  background: rgba(16, 163, 127, 0.08);
}

@media (max-width: 640px) {
  .landing-nav {
    width: 100%;
  }

  .landing-nav-button {
    width: 100%;
    font-size: 1.125rem;
    padding: 1rem 1.5rem;
    min-width: unset;
  }
}
