:root {
  /** Base colors */
  --clr-dark-a0: #000000;
  --clr-light-a0: #ffffff;

  /** Dark theme primary colors */
  --clr-primary-a0: #ff6ec7;
  --clr-primary-a10: #ff81cd;
  --clr-primary-a20: #ff92d3;
  --clr-primary-a30: #999eff;
  --clr-primary-a40: #ffb3e0;
  --clr-primary-a50: #ffc2e6;
  --clr-surface-a0: #121212;
  --clr-surface-a10: #282828;
  --clr-surface-a20: #3f3f3f;
  --clr-surface-a30: #575757;
  --clr-surface-a40: #717171;
  --clr-surface-a50: #8b8b8b;
  --font-body: "Quicksand", sans-serif;
  --font-navbar: "Nova Flat", serif;
  --font-header: "Press Start 2P", sans-serif;
  --font-ui: "Convergence", sans-serif;
  --clr-bg: #4f3a45;
  --clr-btnbg: #ffa033;
  --clr-btnbg-hover: ##ffa033;
  --clr-btn-font: #ffffff;
  --clr-btn-font-hover: #5271ff;
  --clr-modalbg: #282828;
  --clr-modaltxt: #ffffff;
  --clr-modalbord: #ffa033;
  --brdr-sz: 1px solid;
  --brdr-clr-a0: #000000;
  --brdr-clr-a10: #ffa033;
  --clr-nav-font: #ffa033;
  --clr-chat-bg: #000000;
  --clr-chat-font: #ffffff;
  --clr-disc-font: #bdbdff;
  --link-color: var(--clr-primary-a0); /* Default link color */
  --link-hover-color: var(--clr-primary-a20); /* Hover state */
  --link-active-color: var(--clr-primary-a30); /* Active state (when clicked) */
  --link-visited-color: var(--clr-primary-a40); /* Visited links */
}

@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Lato:wght@400;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@400;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Nova+Flat&display=swap");

/*************************************************
 * Body and Page 
 *************************************************/

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

a {
  color: var(--link-color);
  text-decoration: underline; /* Or none if you prefer */
  transition: color 0.2s ease; /* Smooth transition for hover effects */
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: none; /* Optional: remove underline on hover */
}

a:active {
  color: var(--link-active-color);
}

a:visited {
  color: var(--link-visited-color);
}

body {
  font-family: "Quicksand", sans-serif;
  color: var(--clr-light-a0);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  background: #5271ff;
  padding-top: 0;
}

.message p {
  word-wrap: break-word; /* Break long words to fit */
  word-break: break-word; /* Ensures long unbroken strings wrap */
  white-space: pre-wrap; /* Preserve formatting like line breaks */
  overflow-wrap: break-word; /* Handles overflow for long words */
}

#container {
  width: 55%;
  top: 60px;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: absolute;
}

.chat-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0; /* Keep it behind chat messages */
}

/* Full-width slider container */
#theme-slider-container {
  position: fixed;
  /* Position it just above your footer area.
     Adjust bottom value to ensure it doesn't overlap your footer. */
  bottom: 80px; 
  left: 0;
  width: 100%;
  height: 10px;  /* This controls the thickness of the slider "border" */
  z-index: 1025; /* High z-index so it appears above other elements */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: transparent; /* or semi-transparent if you want a subtle backdrop */
}

/* Style the slider input */
#themeSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 90%;  /* Nearly full width */
  height: 8px; /* Make the track as tall as the container */
  background: transparent;
  outline: none;
  margin: 0;
  padding: 0;
}

/* The slider track */
#themeSlider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: #cccccc;  /* Default track color (you could use a variable if desired) */
  border-radius: 15px;
}
#themeSlider::-moz-range-track {
  width: 100%;
  height: 8px;
  background: #cccccc;
  border-radius: 15px;
}

/* The slider thumb */
#themeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--clr-primary-a0); /* Theme primary color for the thumb */
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
  margin-top: 0;  /* Ensure it aligns well with the track */
}
#themeSlider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--clr-primary-a0);
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
}

/* Optional: Style the slider labels */
.theme-slider-labels {
  width: 90%;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--clr-light-a0);
  margin-top: 2px;
}

/*************************************************
 * Navbar
 *************************************************/
#navbar {
  position: fixed;
  top: 0;
  width: 55%;
  height: 60px;
  z-index: 10;
  background-color: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-navbar: "Nova Flat", serif);
  color: #ffa033;
}

.logo-container {
  flex: 1; /* Pushes the logo to the left */
}

.headerButton {
  background-color: transparent;
  color: var(--clr-btnbg);
  border: 1px solid var(--clr-dark-a0);
  border-radius: 5px;
  padding: 10px 20px; /* Match regular button dimensions */
  font-family: var(--font-navbar: "Nova Flat", serif);
  cursor: pointer;
  justify-content: flex-end;
}

.headerButton:hover {
  background-color: var(--clr-btnbg-hover);
}

.beta-toggle {
  height: 40px;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding: 10px;
  margin-top: 10px;
  margin-bottom: 5px;
  font-family: "Convergence", sans-serif;
}

.site-info {
  width: 100%;
  display: flex;
  text-align: left;
  align-items: center;
  padding: 10px 20px;
  flex-direction: column;
}

.button-bar {
  justify-content: flex-end;
  display: flex;
  width: 100%;
}

.toggle-mode {
  font-family: "Convergence", sans-serif;
  font-size: 0.5rem;
  margin-top: 10px;
}

/*************************************************
 * Grey Veil
 *************************************************/
#veil {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.76);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

/*************************************************
 * Username Input/Start Chat Modal
 *************************************************/
#startChatModal {
  flex-direction: column;
  font-family: "Convergence", sans-serif;
  text-align: center;
  background-color: var(--clr-modalbg);
  border-radius: 10px;
  border: 3px solid var(--clr-modalbord);
  box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.3);
  padding: 30px;
  width: 40%;
  max-width: 400px;
  color: var(--clr-modaltxt);
}

#username-container {
  display: flex;
  flex-direction: column; /* stack the input & button vertically */
  gap: 10px; /* small space between them */
  width: 100%; /* let the container fill the modal's width */
  margin: 0 auto; /* center if needed (when narrower than the modal) */
}

.startInput {
  width: 100%;
  height: 40px; /* match your desired button height */
  border: 2px solid #ddd;
  border-radius: 5px;
  padding: 0 10px; /* horizontal padding */
  font-size: 1rem;
  box-sizing: border-box; /* ensures padding doesn't add to total width */
  color: #333;
}

#startChat {
  width: 100%; /* make button also stretch full width, if you like */
  height: 40px;
  background-color: var(--clr-btnbg);
  border: 1px solid var(--clr-dark-a0);
  border-color: var(--clr-dark-a0);
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

#icon-selection {
  margin-top: 20px;
  text-align: center;
  width: 100%;
}

.icon-options {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
  width: 100%;
}

.chat-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.chat-icon:hover {
  transform: scale(1.1);
  border-color: #ff6ec7;
}

.chat-icon.selected {
  border-color: #ff6ec7;
}

/*************************************************
 * About Modal
 *************************************************/

.modal {
  position: fixed;
  background: var(--clr-modalbg);
  z-index: 1000; /* Ensure modal is above all other content */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: auto;
  max-height: 70vh;
  max-width: 800px;
  border: 2px solid var(--clr-modalbord);
  border-radius: 10px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
  overflow: auto; /* Allow scrolling if content overflows */
  font-family: "Quicksand", sans-serif; /* Set the font */
  line-height: 1.6; /* Increase line height for better readability */
  flex-direction: column;
  padding: 25px;
  color: var(--clr-modaltxt);
}

.modal-header {
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 15px;
  text-align: center;
  color: var(--clr-modaltxt);
}

.close-button {
  position: absolute;
  top: 12px;
  right: 15px;
  color: var(--brdr-clr-a10);
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.figure {
  margin: 20px 20px 20px 20px;
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.8), 0 5px 15px rgba(0, 0, 0, 0.5);
  max-width: 300px;
  float: left;
  width: auto;
}

.modal-image {
  object-fit: contain;
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.fig-caption {
  font-size: 0.7rem;
}

/*************************************************
 * Chat Section
 *************************************************/
#chatSection {
  position: fixed;
  width: 55%; /* match the navbar width if you like, or 100% */
  z-index: 1; /* ensure it's above the background but below the navbar/footer if needed */
  display: flex;
  flex-direction: column;
  height: calc(100vh - 170px);
}

#chat-window {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  padding: 20px;
  background-color: var(--clr-chat-bg);
  /*  border-top: 1px solid var(--brdr-clr-a10);
  border-left: 1px solid var(--brdr-clr-a10);
  border-right: 1px solid var(--brdr-clr-a10);
  border-bottom: 0px;*/
  border-radius: 10px 10px 0 0;
  z-index: 2;
  overflow: hidden; /* messages will scroll inside #messages */
}

#messages {
  overflow-y: auto; /* Enable vertical scrolling */
  flex: 1;
  height: 100%; /* Fill the available height of #chat-window */
  max-height: 100%; /* Ensure no content spills outside */
  padding-right: 10px; /* Add space for the scrollbar */
  box-sizing: border-box; /* Include padding in height calculation */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

#messages::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

/* Messages */
.message {
  display: flex;
  margin-bottom: 15px;
  align-items: flex-start;
  z-index: 2;
}

.message img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  z-index: 2;
}

.gpt-message {
  flex-direction: row;
  z-index: 2;
}

.gpt-message p {
  background: transparent;
  padding: 10px;
  border-radius: 10px;
  margin-left: 10px;
  color: var(--clr-chat-font);
}

.user-message {
  flex-direction: row-reverse;
  z-index: 2;
}

.user-message p {
  background: transparent;
  padding: 10px;
  border-radius: 10px;
  margin-right: 10px;
}

/*************************************************
 * Chat - User Input Section
 *************************************************/

#footer-area {
  position: fixed;
  bottom: 0;
  width: 55%;
  height: 80px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  background-color: transparent;
}

/* The user-input is simply the top portion of the footer */
#user-input {
  display: flex;
  gap: 2px;
  padding: 0px;
  background-color: transparent;
}

/* The disclaimer is below user-input in the footer column */
#disclaimer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--clr-disc-font);
  background-color: transparent;
  padding: 5px;
  margin-bottom: 10px;
}

textarea {
  flex-grow: 1;
  height: 60px;
  padding: 10px;
  border-radius: 0 0 0 5px;
  border: 1px solid #ddd;
  font-size: 1rem;
  resize: none;
}


.chat-button {
  background-color: var(--clr-btnbg-hover);
  color: var(--clr-btnbg);
  border: 1px solid var(--clr-dark-a0);
  padding: 10px 20px;
  border-radius: 0 0 5px;
  cursor: pointer;
  font-family: "Convergence", sans-serif;
}

.chat-button:hover {
  background-color: var(--clr-btnbg);
  color: var(--clr-btn-font);
}

#sendMessage {
  background-color: var(--clr-btnbg-hover);
  color: var(--clr-btnbg);
  border: 1px solid var(--clr-dark-a0);
  padding: 10px 20px;
  border-radius: 0;
  cursor: pointer;
  font-family: "Convergence", sans-serif;
}

#sendMessage:hover {
  background-color: var(--clr-btnbg);
  color: var(--clr-btn-font);
}

#sendMessage:disabled {
  cursor:not-allowed;
  background-color: transparent;
  color: var(--clr-btn-font);
}

/*********************************************
* MOBILE RESPONSIVENESS
 *********************************************/

@media (max-width: 600px) {
  html,
  body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  background: var(--clr-bg);
  }

  #container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    padding-top: 35px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
  }

  #navbar {
    position: fixed;
    top: 0;
    left: 5%;
    width: 90% !important;
    height: 50px;
    padding: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    font-size: 0.8rem;
    /* Possibly: background: rgba(0,0,0,0.5); color: #fff; */
  }

  .site-info {
    gap: 3px;
    font-size: 0.8rem;
  }

  .button-bar {
    gap: 3px;
    font-size: 0.8rem;
  }

  #chatSection {
    display: flex;
    width: 100%;
    overflow: column;
    flex-direction: column;
    position: absolute;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 10px;
  }

  .chat-background {
    display: none !important; /* or visibility: hidden */
  }

  #chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  border-radius: 5px 5px 0 0;
    height: auto;
    margin: 0;
  }

  #messages {
    height: auto;
    overflow-y: auto;
    max-height: 100%;
    padding-right: 0;
  }

  #user-input {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    z-index: 1001;
}

  #userMessage {
    width: 100%;
    height: 50px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 5px;
  }

  #sendMessage {
    width: 100%;
    font-size: 1.1rem;
    border-radius: 5px;
    padding: 10px;
  }

  button:hover,
  .headerButton:hover,
  .chat-button:hover {
    background-color: initial;
  }

  button,
  .headerButton,
  .chat-button {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 5px;
  }

  .modal {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0;
    margin: 0;
    padding: 20px;
    overflow-y: auto;
    z-index: 2000;
  }

  .modal-header {
    font-size: 1.2rem;
  }

  .close-button {
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
  }

  #startChatModal {
    width: 90%;
    max-width: none;
    height: auto;
    margin: 0 auto;
  }

  /* 9) Remove or reduce float layouts in modals for small screens */
  .figure {
    float: none;
    margin: 0 auto;
    max-width: 100%;
    display: block;
  }
  #disclaimer {
 display: none;
}
}
