:root {
  --background-darkest: #181818;
  --background-dark: #232323;
  --background-chat: #2d2d2d;
  --text-light: #f3f3f3;
  --text-muted: #b0b0b0;
  --accent-orange: #ff7f4f;
  --accent-brown: #8a4a32;
  --accent-brown-hover: #a65c3a;
  --border-radius: 0.75rem;
  --font-family: "Georgia", serif;
  --container-width: 700px;
  --chat-area-width: 100%;
  --chat-form-max-width: 900px;
  --navbar-height: 60px;
}

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

html {
  height: 100vh;
  width: 100vw;
}

body {
  background: var(--background-dark);
  color: var(--text-light);
  min-height: 100vh;
  height: 100vh;
  width: 100vw;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  padding-top: var(--navbar-height);
  box-sizing: border-box;
}

.no-scroll {
  overflow: hidden;
}

/* Checkbox theme color */
input[type="checkbox"] {
  accent-color: var(--accent-orange);
}

/* Fallback for browsers that do not support accent-color */
input[type="checkbox"]:checked {
  /* For older browsers, fallback to box-shadow or background */
  /* This will not override accent-color in modern browsers */
  box-shadow: 0 0 0 2px var(--accent-orange);
}

.nav-divider {
  width: 100%;
  height: 8px;
  margin: 0;
  background: linear-gradient(
    to bottom,
    rgba(35, 35, 35, 0.12) 0%,
    rgba(35, 35, 35, 0) 100%
  );
}

.top-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--background-dark);
  z-index: 10;
  height: var(--navbar-height);
}
.top-nav svg {
  fill: var(--accent-orange);
  height: 16px;
  width: 16px;
  margin-right: 0.25rem;
  max-height: var(--navbar-height);
}
.top-nav .attribution {
  color: var(--text-muted);
  font-size: 0.8em;
  padding: 0.5em;
}
.top-nav a.attribution {
  text-decoration: none;
}
.top-nav a.attribution:hover {
  text-decoration: underline;
}

/*  overlay below navbar */
.top-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--background-dark) 0%,
    var(--background-dark) 20%,
    rgba(35, 35, 35, 0) 100%
  );
  z-index: 11;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 1.1em;
  border-radius: var(--border-radius);
  padding: 8px 18px;
  transition: background 0.2s;
  margin-right: 8px;
}

.nav-link:hover {
  background: var(--accent-brown);
}

.greeter-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.greeter-title {
  font-family: var(--font-family);
  font-size: 2.2em;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 12px;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  min-height: 0;
  height: calc(100vh - 64px);
  position: relative;
}

.container-moving.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  background: transparent;
  justify-content: flex-end;
  align-items: center;
}

.chat-display {
  display: flex;
  width: 100%;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow-y: scroll;
  margin-bottom: 0;
  padding: 1rem 2rem;
  padding-bottom: 3rem;
  box-sizing: border-box;
  position: relative;
}

/* Gradient overlay at bottom of chat-display */
.chat-display::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 94px;
  height: 18px;
  pointer-events: none;
  display: block;
  background: linear-gradient(
    to top,
    var(--background-dark) 0%,
    var(--background-dark) 20%,
    rgba(35, 35, 35, 0) 100%
  );
  z-index: 20;
}

/* Message and icon wrapper */

.chat-msg {
  position: static;
  max-width: 90%;
  padding: 0.5rem 1rem;
  line-height: 1.4;
  border-radius: var(--border-radius);
  font-size: 1.1em;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
  position: relative;
  margin-bottom: 1rem;
}

.chat-msg.user {
  background: var(--background-darkest);
  font-family: sans-serif;
  color: var(--text-light);
  align-self: flex-end;
  text-align: right;
}

.chat-msg.assistant {
  background: #222;
  color: var(--assistant-text);
  align-self: flex-start;
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-line;
  margin-bottom: 1.5rem;
}

/* Copy icon styles */
.copy-icon-wrapper {
  position: absolute;
  bottom: -26px;
  left: 13px;
  color: var(--text-muted);
  opacity: 0.85;
  transition: opacity 0.2s;
  cursor: pointer;
  margin-bottom: 0.2em;
}

.chat-msg.user .copy-icon-wrapper {
  right: -13px !important;
}

.copy-icon-wrapper:hover {
  opacity: 1;
  color: var(--text-light);
}

.chat-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60vw;
  min-width: 0;
  max-width: var(--container-width);
  margin-bottom: 16px;
}

.chat-form {
  display: flex;
  height: 76px;
  align-items: center;
  width: 100%;
  max-width: var(--chat-form-max-width);
  background: var(--background-chat);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  padding: 0;
}

.chat-textarea {
  width: 100%;
  height: 60px;
  background: var(--background-chat);
  color: var(--text-light);
  border: none;
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  font-size: 1.1em;
  padding: 18px 24px;
  resize: none;
  outline: none;
  margin: 0;
}

.submit-btn {
  background: var(--accent-brown);
  border: none;
  border-radius: var(--border-radius);
  width: 48px;
  height: 48px;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: 0;
}

.submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(30%);
}

.submit-btn:hover {
  background: var(--accent-brown-hover);
}

.submit-btn svg {
  display: block;
}

/* Sidebar styles moved from inline */
.settings-sidebar {
  position: fixed;
  left: 0;
  top: var(--navbar-height);
  width: 240px;
  background: var(--background-darkest);
  color: var(--text-light);
  height: calc(100vh - var(--navbar-height));
  max-height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  border-radius: 0 1em 1em 0;
  padding: 1.5em 1em 1.5em 1em;
  z-index: 2000;
  transition: transform 0.3s;
  transform: translateX(-260px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 4rem;
}

.settings-sidebar.open {
  transform: translateX(0);
}
.sidebar-title {
  margin-top: 0;
}

.sidebar-btn-row {
  margin-bottom: 1em;
}

#settings-form label {
  color: var(--text-muted);
}

#settings-form input[type="checkbox"]:checked + label,
#settings-form label:has(> input[type="checkbox"]:checked) {
  color: var(--text-light);
}

.sidebar-btn {
  margin-right: 0.5em;
  background: var(--accent-brown);
  color: var(--text-light);
  border: none;
  border-radius: 3px;
  padding: 0.3em 0.7em;
  font-size: 0.85em;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.sidebar-btn:hover {
  background: var(--accent-brown-hover);
  color: var(--text-light);
}

.settings-toggle-btn {
  position: fixed;
  font-size: 18px;
  top: calc(var(--navbar-height) + 0.5em);
  left: 0;
  z-index: 3001;
  background: var(--background-darkest);
  color: var(--text-light);
  border: none;
  border-radius: 0 0.75em 0.75em 0;
  padding: 0.5em 0.75em;
  cursor: pointer;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.3s,
    top 0.3s;
  transform: translateX(0);
}

.settings-sidebar.open ~ .settings-toggle-btn {
  transform: translateX(238px);
}

/* Temperature slider styles */
.temperature-setting {
  width: 100%;
  margin-bottom: 1.5em;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.temperature-label {
  font-weight: bold;
  margin-bottom: 0.5em;
}
.temperature-slider-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.5em;
}
#temperature-slider {
  flex: 1;
  accent-color: var(--accent-orange);
}

#temperature-slider:hover {
  cursor: not-allowed;
}

/* Pricing page styles */
.pricing-section {
  text-align: center;
  width: 100%;
  max-width: var(--container-width);
  margin-top: 150px;
  display: flex;
  flex-direction: column;
  padding-bottom: 4rem;
}

.pricing-tiers {
  display: flex;
  gap: 2rem;
}

.pricing-btn-link {
  display: inline-block;
  text-decoration: none;
  background: var(--accent-orange);
  color: var(--text-light);
  border: none;
  border-radius: var(--border-radius);
  padding: 0.6em 1.5em;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.pricing-btn-link:hover {
  background: var(--accent-brown-hover);
  color: var(--text-light);
}

.pricing-card {
  background: var(--background-darkest);
  color: var(--text-light);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  padding: 2em 1.5em 2em 1.5em;
  min-width: 260px;
  max-width: 340px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pricing-title {
  font-size: 1.4em;
  font-weight: bold;
  margin-bottom: 0.5em;
}
.pricing-price {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 1em;
  color: var(--accent-orange);
}
.pricing-period {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-left: 0.2em;
}
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 2em 0;
  width: 100%;
}
.pricing-features li {
  font-size: 1em;
  margin-bottom: 0.7em;
  display: flex;
  align-items: center;
}
.pricing-feature-star {
  color: var(--accent-orange);
  margin-right: 0.5em;
  font-size: 1.1em;
}
.pricing-btn {
  background: var(--accent-brown);
  color: var(--text-light);
  border: none;
  border-radius: var(--border-radius);
  padding: 0.6em 1.5em;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.pricing-btn:disabled {
  background: var(--background-dark);
  color: var(--text-muted);
  cursor: not-allowed;
}
.pricing-btn:hover:not(:disabled) {
  background: var(--accent-brown-hover);
}

@media (max-width: 600px) {
  .top-nav {
    padding: 0.5rem;
  }
  .nav-link {
    font-size: 1em;
    padding: 0.75em;
    margin: 0 !important;
  }
  .chat-area {
    width: 80vw;
  }
  .chat-msg.user {
    margin-bottom: 2rem;
  }

  .chat-msg.user .copy-icon-wrapper {
    right: -42px !important;
  }

  .chat-msg {
    max-width: 100%;
  }

  .pricing-tiers {
    flex-direction: column;
  }
  .pricing-section {
    margin-top: 550px;
  }

  .pricing-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .chat-display {
    padding-top: 6rem;
  }
}
