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

:root {
  --primary-green: #2d5a2d;
  --light-green: #4a7c59;
  --very-light-green: #e8f5e8;
  --accent-green: #7bb97b;
  --bg-light: #f8fcf8;
  --white: #ffffff;
  --text-dark: #2c3e2c;
  --text-light: #6b7c6b;
  --border-light: #d4e6d4;
  --shadow: rgba(0, 0, 0, 0.1);
  --warning: #ff6b35;
  --success: #28a745;
  --sidebar-width: 320px;
  --delete: #e00f0f;
}


body {
  font-family: 'Nunito', sans-serif;
  /* background: linear-gradient(135deg, var(--bg-light) 0%, #f0f8f0 100%); */
  background-color: #e0fde0;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.3s ease;
  scrollbar-gutter: stable;
}

body.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  background: var(--white);
  border-right: 2px solid var(--border-light);
  padding: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 2px 0 10px var(--shadow);
  position: relative;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--light-green) 100%);
  color: var(--white);
  padding: 20px;
  position: relative;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-new {
  background: var(--accent-green);
  color: var(--white);
}

.btn-new:hover {
  background: #6aa86a;
  transform: translateY(-1px);
}

.btn-toggle {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-toggle.active {
  background: var(--white);
  color: var(--primary-green);
}

.sessions-container {
  /* height: calc(100vh - 140px); */
  height: 100vh;
  overflow-y: auto;
  padding: 20px;
}

.sessions-container.chat-active-height {
  height: calc(100vh - 240px);
}

.sessions-container::-webkit-scrollbar {
  width: 6px;
}

.sessions-container::-webkit-scrollbar-track {
  background: var(--very-light-green);
}

.sessions-container::-webkit-scrollbar-thumb {
  background: var(--accent-green);
  border-radius: 3px;
}

.session-entry {
  background: var(--white);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  position: relative;
}

.session-entry:hover {
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.session-entry.active {
  border-color: var(--primary-green);
  background: var(--very-light-green);
  box-shadow: 0 2px 8px var(--shadow);
}

.session-entry.archived {
  opacity: 0.7;
  border-style: dashed;
}

.session-entry a {
  text-decoration: none;
  color: var(--text-dark);
  display: block;
}

.session-date {
  font-weight: 600;
  color: rgb(19, 90, 19);
  font-size: 14px;
  margin-bottom: 8px;
}

.session-preview {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  display: box;
  -webkit-box-orient: vertical;
  box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.4;
  max-height: 2.8em;
}


.badges {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.badge {
  background: linear-gradient(45deg, var(--accent-green), #8cc98c) !important;
  color: var(--white);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge.archived {
  background: linear-gradient(45deg, #999, #bbb);
}

.session-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.session-status {
  font-size: 11px;
  color: var(--text-light);
}

.btn-archive,
.btn-unarchive {
  background: none;
  border: none;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-archive {
  color: rgb(97, 90, 90);
}

.btn-unarchive {
  color: var(--success);
}

.btn-archive:hover {
  background: rgba(255, 107, 53, 0.1);
}

.btn-unarchive:hover {
  background: rgba(40, 167, 69, 0.1);
}

.btn-delete {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--delete);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-delete:hover {
  background: rgba(255, 107, 53, 0.1);
}

.main-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  overflow-y: auto;
}

.main-header {
  position: fixed;
  width: 100vw;
  max-width: 100vw;
  z-index: 100;

  background: var(--white);
  border-bottom: 2px solid var(--border-light);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px var(--shadow);
}

.main-header.chat-active-width {
  /* To make scrollbar visible */
  width: calc(100vw - 17px);
  max-width: calc(100vw - 17px);
}


.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sidebar-toggle {
  background: none;
  border: 2px solid var(--primary-green);
  color: var(--primary-green);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--primary-green);
  color: var(--white);
}

.main-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-green);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Database Toggle Styles */
.database-toggles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 20px;
  padding: 10px;
  background: var(--very-light-green);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.toggles-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.toggles-header i {
  color: var(--primary-green);
}

.toggles-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dark);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 18px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: var(--primary-green);
}

input:checked+.toggle-slider:before {
  transform: translateX(16px);
}

.toggle-label {
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
}

.dropdown-group {
  margin-right: 20px;
}

.reset-location-btn {
  margin-top: 32px;
  height: max-content;
}

.export-button {
  /* background: linear-gradient(45deg, var(--warning), #ff8c42); */
  /* background-color: rgb(151, 85, 9); */
  background-color: #575050;
  color: var(--white);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-button:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
  color: rgb(250, 250, 212);
  cursor: pointer;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 80px;

  /* background-color: #b6d897; */
  background-color: #E8FFD7;
}

.chat-window {
  max-width: 55%;
  margin: 10px auto 20px auto;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  padding-bottom: 90px;
  /* background: var(--white);
  box-shadow: 0 4px 20px var(--shadow);
  border: 2px solid var(--border-light); */
}

.chat-window::-webkit-scrollbar {
  width: 8px;
}

.chat-window::-webkit-scrollbar-track {
  background: var(--very-light-green);
  border-radius: 4px;
}

.chat-window::-webkit-scrollbar-thumb {
  background: var(--accent-green);
  border-radius: 4px;
}

.message {
  max-width: 75%;
  margin: 15px 0;
  padding: 16px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 8px var(--shadow);
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  margin-left: auto;
  max-width: fit-content;
  /* background: linear-gradient(135deg, var(--accent-green) 0%, #8cc98c 100%); */
  /* background-color: #479947; */

  /* background-color: #5f5e23; */

  background-color: #3E5F44;
  color: var(--white);
  border-bottom-right-radius: 6px;
}

.message.bot {
  max-width: fit-content;
  /* background: var(--very-light-green); */

  /* background-color: #f2fff2;
  color: var(--text-dark); */

  /* background-color: #247a24; */
  /* background-color: #2f8d2c; */

  background-color: #4f7c5b;
  color: var(--white);

  border-bottom-left-radius: 2px;
  box-shadow: none;
  padding-left: 30px;
  padding-bottom: 5px;

  margin-bottom: 20px;
}

.message strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.chat-form {
  background: var(--white);
  /* border: 2px solid var(--border-light); */
  border: none;
  border-radius: 5%;
  padding: 15px;
  padding-bottom: 50px;
  margin-bottom: 0px;
  display: flex;
  gap: 15px;
  box-shadow: 0 4px 20px var(--shadow);
}

/* Color and styling of BOTH chat forms */
.chat-form textarea {
  flex: 1;
  resize: none;
  max-width: 600px;
  margin: 20px 10px 0 37%;
  padding: 15px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Nunito', sans-serif;
  transition: all 0.2s ease;
  background: var(--bg-light);
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 7px 3px rgba(95, 150, 95, 0.1);
}

.chat-form .feature-button {
  margin-left: -7px !important;
}


.chat-form .start-chat-button {
  padding: 15px 25px;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--light-green) 100%);
  color: var(--white);
  display: flex;
  border: none;
  border-radius: 10px;
  box-shadow: none;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.chat-form button:hover {
  transform: translateY(0px);
  box-shadow: 0 6px 20px rgba(45, 90, 45, 0.3);
}

.start-screen {
  text-align: center;
  color: var(--text-light);
  padding: 60px 20px;
  padding-top: 80px;
  margin-bottom: 40px;
}

.start-screen .icon {
  font-size: 4rem;
  color: var(--accent-green);
  margin-top: 80px;
  margin-bottom: 20px;
}

.start-screen h2 {
  font-size: 24px;
  color: var(--primary-green);
  margin-bottom: 10px;
}

.start-screen p {
  font-size: 16px;
  margin-bottom: 30px;
  line-height: 1.6;
}

#start-input {
  margin-left: 0px;
}

#start-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: 20px;
  padding: 10px 20px 15px 20px;
}

#start-form textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  margin-bottom: 8px;
}

#start-form .button-row {
  display: flex;
  justify-content: flex-end;
  /* Buttons align to the right */
  gap: 12px;
}

.subheading-container {
  max-width: 600px;
  margin: 0 auto;
}

.chat-form .feature-button {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #177a38;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  background-color: transparent;
  /* transition: background-color 1s cubic-bezier(0.4, 0, 0.2, 1), color 1s cubic-bezier(0.4, 0, 0.2, 1), border-color 1s cubic-bezier(0.4, 0, 0.2, 1) !important; */
  transition: background 0.3s, color 0.1s, transform 0.5s;
  flex-shrink: 0;
}


#chat-form {
  position: fixed;
  bottom: 0;
  z-index: 1000;
  border-radius: 0;
  margin: 50px 0 0 0;
  /* background-color: #e0fde0; */
  background-color: #E8FFD7;

  /* background: var(--white);
  box-shadow: 0 -2px 18px rgba(34, 65, 34, 0.10); */
  padding: 14px 4vw;
  display: flex;
  gap: 15px;
  border-top: 0px solid var(--border-light);

  /* Box-shadow towards top */
  box-shadow: 0 -8px 20px -10px rgba(232, 255, 215, 0.8);

  /* Changes to stil show vertical scrollbar */
  width: 100%;
  max-width: 100%;
  /* (optional, for safety) */
  left: 0;
  box-sizing: border-box;

  /* To make scrollbar visible */
  width: calc(100vw - 17px);
  max-width: calc(100vw - 17px);
}

#user-input {
  margin-top: 0;
}

.send-button {
  margin: 0 auto 0 0 !important;
  padding-top: 15px;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  cursor: pointer;
}

.send-button:focus,
.send-button:hover,
.send-button:active {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.send-button svg {
  color: #555;
  transition: color 0.2s;
}

.send-button:hover svg,
.send-button:focus svg {
  color: #2cbb5d;
}

.send-button:active svg {
  color: #159c3e;
}


/* Hover effect */
.chat-form .feature-button:hover {
  background-color: rgba(237, 255, 242, 0.863);
  color: #279b4e;
  transform: translateY(0px);
}

.chat-form .button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Optional grey inactive state */
.chat-form .feature-button.inactive {
  color: #888888;
}

/* Tooltip wrapper for positioning */
.tooltip-container {
  position: relative;
  display: inline-block;
}

/* Tooltip text, hidden by default */
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: max-content;
  background: #222;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 6px 12px;
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 125%;
  /* place above the button */
  transform: translateX(-50%);
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Show tooltip on hover */
.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Optional: Hover effect for inactive button */
.chat-form .feature-button.inactive:hover {
  color: #888888;
  cursor: not-allowed;
}

.archived-notice {
  background: linear-gradient(45deg, #fff3cd, #ffeaa7);
  border: 2px solid #f39c12;
  border-radius: 12px;
  padding: 20px;
  margin: 20px;
  text-align: center;
  color: #856404;
}

.archived-notice .icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.archived-notice h3 {
  margin-bottom: 10px;
  color: #d68910;
}

.archived-notice button {
  background: linear-gradient(45deg, #f39c12, #e67e22);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.archived-notice button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.no-sessions {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.no-sessions .icon {
  font-size: 3rem;
  margin-bottom: 15px;
  color: var(--accent-green);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
}

.backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.backdrop.show {
  display: block;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid var(--accent-green);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Color of chat form within chat */
#chat-form textarea {
  background-color: #ffffff;
  border: 2px solid #bae4ba;
}

/* Media Queries */

/* Desktop and larger screens */
@media (min-width: 1279px) {
  #chat-form textarea {
    /* width: 60% !important;
    margin: 0px 10px 0 35% !important; */
    display: block !important;
    max-width: 900px !important;
    margin: 0px 10px 0 30% !important;
    padding: 15px 30px 15px 15px !important;
    box-sizing: border-box;
  }

  #user-input {
    font-size: 16px;
  }
}

@media (min-width: 900px) {

  .location-info {
    align-self: self-end;
  }

  .chat-form {
    padding-left: 60px;
    padding-right: 60px;
  }

  #chat-form textarea {
    margin: 20px 10px 0 17%;
    padding: 15px;
  }

}

.message-actions {
  margin-top: 8px;
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  align-items: center;
}

.copy-btn,
.rate-btn {
  border: none;
  outline: none;
  border-radius: 10px;
  background: transparent;
  /* color: #333; */
  color: #93DA97;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn svg,
.rate-btn svg {
  transition: color 0.2s;
}

.copy-btn:hover svg,
.copy-btn:focus svg {
  color: #f3e8a8;
}

.rate-btn:hover svg,
.rate-btn:focus svg {
  color: #e1fde6;
}

/* All 'selected' buttons: grey SVG */
.copy-btn.selected svg,
.rate-btn.selected svg {
  color: rgb(189, 178, 183) !important;
}

/* Remove outlines/borders on focus/active */
.copy-btn:focus,
.copy-btn:active,
.rate-btn:focus,
.rate-btn:active {
  outline: none;
  border: none;
}

/* new */
/* Thumbs-down hover/focus = red, but ... */
.rate-btn.thumbs-down:hover svg,
.rate-btn.thumbs-down:focus svg {
  color: #fd938f !important;
}

/* All selected buttons: grey */
.copy-btn.selected svg,
.rate-btn.selected svg {
  color: rgb(189, 178, 183) !important;
}

/* Make sure selected+hover still stays grey FOR thumbs-down */
.rate-btn.thumbs-down.selected:hover svg,
.rate-btn.thumbs-down.selected:focus svg {
  color: rgb(189, 178, 183) !important;
}

.edit-icon-btn {
  background: transparent;
  border: none;
  color: var(--primary-green);
  cursor: pointer;
  font-size: 16px;
  margin-left: 10px;
  transition: color 0.2s ease;
}

.edit-icon-btn:hover {
  color: var(--accent-green);
}

.location-info-bar {
  position: relative;
}

.location-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  background: var(--white);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  width: 360px;
  display: none;
}

.location-dropdown.show {
  display: block;
}

.location-dropdown .dropdown-group {
  margin-bottom: 12px;
}

.location-dropdown .dropdown-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.location-dropdown select {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--border-light);
  font-size: 14px;
  background: var(--very-light-green);
  color: var(--text-dark);
  transition: all 0.2s ease;
}

select option {
  background-color: var(--white);
  color: var(--text-dark);
}

select option:checked {
  background-color: var(--accent-green);
  color: white;
}


.location-dropdown select:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(123, 185, 123, 0.15);
}

.reset-location-btn {
  background: linear-gradient(135deg, #cde9cd, #b6deb6);
  color: var(--primary-green);
  border: 1px solid var(--accent-green);
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

::selection {
  background: var(--accent-green);
  color: #ffffff;
}

.reset-location-btn:hover {
  background: #6aa86a;
  transform: translateY(-1px);
}

::selection {
  background: var(--accent-green);
  color: #ffffff;
}

@media (min-width: 768px) and (max-width: 900px) {
  #chat-form textarea {
    margin: 20px 10px 0 17% !important;
    padding: 15px;
  }

  .chat-form-actions {
    margin-top: 30px;
  }

  #user-input {
    font-size: 16px;
  }
}

/* For mobile devices */
@media (max-width: 768px) {
  body {
    /* Second (newer) block wins in case of conflict: */
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: inline;
  }

  body.sidebar-open .main-container {
    pointer-events: none;
    overflow: hidden;
  }

  .main-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .start-screen {
    padding-top: 10px;
  }

  .chat-area {
    flex: none;
    display: block;
    height: auto;
    min-height: 100vh;
    padding-bottom: 16px;
    /* prevents chat-form cutoff */
    overflow: visible;
  }

  .start-screen .icon {
    margin-top: 55px;
    margin-bottom: 5px;
  }

  .start-screen h2 {
    font-size: 22px;
    margin-top: 0px;
    margin-bottom: 5px;
  }

  .start-screen p {
    font-size: 14px;
    max-height: 50px;
    margin: 0 auto 30px auto;
  }

  /* Target the br inside the subheading p */
  .subheading-container p br {
    display: none;
    /* hide by default */
  }

  .chat-window {
    max-width: 75%;
    overflow-y: auto;
    /* enable vertical scrolling */
  }

  #start-form {
    width: 300px;
  }

  #start-input {
    margin-top: 10px;
  }

  #start-form.chat-form {
    gap: 7px;
  }

  #stateSelect {
    width: 130px;
    /* or preferred width (100-160px is typical for mobile) */
    min-width: 0;
    max-width: 60vw;
    padding: 8px;
    font-size: 13px;
  }

  .main-header {
    margin-bottom: 40px;
    height: 110px;
  }

  /* Optional: space around the select if needed */
  .main-header #stateSelect {
    margin-left: 5px;
    margin-right: 5px;
    margin-bottom: 0;
  }

  .chat-form {
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
    margin: 0;
    /* Remove any centering or left/right margins */
    border-radius: 0;
    padding-left: 8px;
    /* override desktop padding if you want */
    padding-right: 8px;

    margin-top: 110px;
    /* matching the height of main-header */
  }

  #chat-form {
    width: 100vw !important;
    max-width: 100vw !important;
  }

  #chat-form textarea {
    margin: 10px 5px 0 18%;
    padding: 15px;
  }

  .chat-form-actions {
    margin-top: 30px;
  }
}

@media (max-width: 415px) and (min-width: 376px) {
  .start-screen .icon {
    margin-top: 125px;
    margin-bottom: 5px;
  }

  .start-screen p {
    font-size: 14px;
    max-height: 50px;
    max-width: 230px;
    margin: 0 auto 60px auto;
  }

  /* Target the br inside the subheading p */
  .subheading-container p br {
    display: none;
    /* hide by default */
  }
}

@media (max-width: 632px) {
  .main-title {
    font-size: 18px;
  }

  .location-info {
    font-size: 14px;
  }

  .export-button {
    font-size: 14px;
  }

  .fa-pencil-alt {
    font-size: 12px;
  }

}

@media (max-width: 550px) {
  .main-title {
    font-size: 18px;
    gap: 5px;
    margin-right: 10px;
  }

  .location-info {
    font-size: 14px;
    margin-right: 4px;
  }

  .export-button {
    font-size: 14px;
  }

  .fa-pencil-alt {
    font-size: 12px;
  }

}

@media (max-width: 500px) {
  .chat-form {
    padding-left: 8px;
    padding-right: 8px;
  }

  .fa-pencil-alt {
    font-size: 12px;
  }
}

@media (max-width: 415px) {

  .sidebar-toggle {
    width: 30px;
    height: 30px;
  }

  .header-left {
    gap: 7px;
  }

  .main-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    gap: 3px;
    margin-right: 15px;
  }

  .location-info {
    font-size: 12px;
    margin-right: 4px;
  }

  .fa-pencil-alt {
    font-size: 12px;
  }

  .export-button {
    font-size: 12px;
    height: fit-content;
    width: 64px;
  }

  #chat-form textarea {
    max-width: auto;
  }

  #chat-form {
    margin-top: 10px !important;
  }
}

/* Styles for wide but short laptop screens */
@media (min-width: 900px) and (max-height: 700px) {

  .start-screen {
    padding-top: 20px;
  }

  .start-screen .icon {
    margin-top: 5px;
  }

  #chat-form textarea {
    margin: 0px 10px 0 14% !important;
  }

}

/* ==================== */
/* Recommendations Section */
/* ==================== */

.recommendations-container {
  width: 100%;
  margin: 0 auto 20px auto;
}

.recommendations-section {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  margin: 20px auto;
  border: 1px solid var(--border-light);
  max-width: 800px;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 10px var(--shadow);
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  z-index: 999;
}

.recommendations-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.recommendations-header i {
  color: var(--accent-green);
  font-size: 18px;
}

.recommendations-header h3 {
  color: var(--primary-green);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.recommendations-subtitle {
  color: var(--text-light);
  font-size: 12px;
  margin-left: auto;
}

.recommendations-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recommendation-item {
  background: var(--very-light-green);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.recommendation-item:hover {
  background: #d8f2d8;
  border-color: var(--accent-green);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px var(--shadow);
}

.recommendation-question {
  font-weight: 600;
  color: var(--primary-green);
  margin-bottom: 6px;
  line-height: 1.4;
}

.recommendation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-light);
}

.recommendation-state {
  background: var(--accent-green);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
}

.recommendation-popularity {
  display: flex;
  align-items: center;
  gap: 3px;
}

.recommendation-popularity i {
  color: var(--accent-green);
}

.recommendation-score {
  font-size: 0.8em;
  color: var(--text-light);
  margin-top: 4px;
}

/* Inline Recommendations */
.inline-recommendations {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--accent-green);
}

.inline-rec-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.9em;
}

.inline-rec-header i {
  color: var(--accent-green);
}

.inline-rec-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-rec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #e0e0e0;
}

.inline-rec-item:hover {
  background: var(--light-green);
  border-color: var(--accent-green);
}

.inline-rec-question {
  flex: 1;
  font-size: 0.9em;
  color: var(--text-dark);
}

.inline-rec-score {
  font-size: 0.75em;
  color: var(--text-light);
  background: #e8f5e8;
  padding: 2px 6px;
  border-radius: 10px;
}

.no-recommendations {
  text-align: center;
  color: var(--text-light);
  padding: 20px;
  font-style: italic;
}

.no-recommendations i {
  color: var(--accent-green);
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .recommendations-section {
    margin: 10px 0;
    padding: 16px;
    bottom: 140px;
    width: 95%;
    left: 50%;
    transform: translateX(-50%);
  }

  .recommendations-header h3 {
    font-size: 14px;
  }

  .recommendation-item {
    padding: 12px;
  }

  .recommendation-question {
    font-size: 14px;
  }

  .recommendations-container {
    max-width: 75%;
  }
}

/* Mic notification styles */
.notification {

  position: fixed;

  top: 24px;
  /* Notification appears at the top */

  left: 50%;

  transform: translateX(-50%);

  z-index: 9999;

  min-width: 280px;

  padding: 1em 2em;

  margin-bottom: 30px !important;

  background: #fff;

  color: #222;

  border-radius: 6px;

  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);

  opacity: 0;

  transition: opacity 0.3s;

  pointer-events: none;

}



.notification.show {

  opacity: 1;

  pointer-events: auto;

}



.notification-close {

  background: #74c68f;

  color: #ffffff;

  width: 20px;

  height: 20px;

  font-size: 18px;

  border: none;

  border-radius: 10%;

  padding-bottom: 5px;

  cursor: pointer;

  transition: color 0.2s;

}



.notification-close:hover {

  background: #0e5c38;

  columns: #74c68f;

}



/* End of Mic notification styles */

/* Error message styles */
.error-message {
  padding: 15px;
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  margin: 10px;
  text-align: center;
  font-size: 14px;
}

/* Database Toggle Responsive Styles */
@media (max-width: 768px) {
  .database-toggles {
    flex-direction: row;
    margin: 0 10px;
    padding: 8px;
  }

  .toggles-container {
    flex-direction: column;
    gap: 8px;
  }

  .toggle-item {
    font-size: 10px;
  }

  .toggles-header {
    font-size: 11px;
    margin-bottom: 0;
  }
}

@media (max-width: 500px) {
  .database-toggles {
    margin: 0 5px;
    padding: 6px;
  }

  .toggles-container {
    gap: 6px;
  }

  .toggle-item {
    font-size: 9px;
  }

  .toggles-header {
    font-size: 10px;
  }

  .toggle-switch {
    width: 28px;
    height: 15px;
  }

  .toggle-slider:before {
    height: 11px;
    width: 11px;
    left: 2px;
    bottom: 2px;
  }

  input:checked+.toggle-slider:before {
    transform: translateX(13px);
  }
}

/* Research Dropdown Styles */
.research-dropdown {
  margin-top: 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
  transition: all 0.3s ease;
}

.research-header {
  padding: 12px 16px;
  background: var(--very-light-green);
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background-color 0.2s ease;
}

.research-header:hover {
  background: #d8f0d8;
}

.research-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.research-header i {
  color: var(--primary-green);
  font-size: 14px;
}

.research-title {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.research-subtitle {
  color: var(--text-light);
  font-size: 12px;
  margin-left: 4px;
}

.research-toggle {
  color: var(--text-light);
  font-size: 12px;
  transition: transform 0.3s ease;
}

.research-toggle.expanded {
  transform: rotate(180deg);
}

.research-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.research-content.expanded {
  max-height: 400px;
}

.research-summary {
  padding: 12px 16px;
  background: #f9fcf9;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.research-summary-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.research-summary-item:last-child {
  margin-bottom: 0;
}

.research-summary-label {
  color: var(--text-light);
  font-weight: 500;
}

.research-summary-value {
  color: var(--text-dark);
  font-weight: 600;
}

.research-documents {
  padding: 0;
}

.research-doc {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.research-doc:last-child {
  border-bottom: none;
}

.research-doc:hover {
  background: #fafcfa;
}

.research-doc.selected {
  background: var(--very-light-green);
  border-left: 3px solid var(--primary-green);
}

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.doc-rank {
  background: var(--primary-green);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.doc-scores {
  display: flex;
  gap: 10px;
  font-size: 11px;
}

.doc-score {
  background: #f0f8f0;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-dark);
}

.doc-score.high {
  background: #d4f8d4;
  color: var(--primary-green);
}

.doc-score.medium {
  background: #fff3cd;
  color: #856404;
}

.doc-score.low {
  background: #f8d7da;
  color: #721c24;
}

.doc-metadata {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-light);
}

.doc-metadata-item {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
}

.doc-content {
  font-size: 12px;
  color: var(--text-dark);
  line-height: 1.4;
  background: #f9f9f9;
  padding: 8px;
  border-radius: 4px;
  border-left: 3px solid #e0e0e0;
}

.doc-selection-reason {
  margin-top: 8px;
  font-size: 11px;
  color: var(--primary-green);
  font-weight: 600;
  font-style: italic;
}

.no-research-data {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

.no-research-data i {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--border-light);
}

/* Reasoning Steps Styles */
.reasoning-steps {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
}

.reasoning-header {
  padding: 12px 16px;
  background: #f0f8ff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-dark);
  font-size: 14px;
}

.reasoning-header i {
  color: #4169e1;
  font-size: 14px;
}

.reasoning-list {
  padding: 8px 0;
}

.reasoning-step {
  padding: 8px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background-color 0.2s ease;
}

.reasoning-step:hover {
  background: #fafcfa;
}

.step-number {
  background: #4169e1;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
}

/* Authentication Styles */
#loginOverlay {
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.user-info {
  display: flex;
  align-items: center;
}

.user-info button:hover {
  background: #c82333 !important;
}

/* Login form input focus states */
#loginForm input:focus {
  border-color: #248241 !important;
  box-shadow: 0 0 0 2px rgba(36, 130, 65, 0.2);
  outline: none;
}

#loginForm button:hover {
  background: #1e6936 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(36, 130, 65, 0.3);
}

#loginForm button:active {
  transform: translateY(0);
}

#loginError {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ===== MARKDOWN STYLING FOR BETTER AGRICULTURAL RESPONSES ===== */

/* Bot message container - ensure good contrast */
.message.bot .bot-answer {
  color: var(--white) !important;
}

.message.bot .bot-answer * {
  color: inherit !important;
}

/* General markdown content styling - with proper contrast for bot messages */
.bot-answer h1,
.bot-answer h2,
.bot-answer h3,
.bot-answer h4,
.bot-answer h5,
.bot-answer h6 {
  color: var(--white);
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  font-weight: 600;
  line-height: 1.3;
}

/* Override for bot messages to ensure white text */
.message.bot .bot-answer h1,
.message.bot .bot-answer h2,
.message.bot .bot-answer h3,
.message.bot .bot-answer h4,
.message.bot .bot-answer h5,
.message.bot .bot-answer h6 {
  color: var(--white) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bot-answer h1 { 
  font-size: 1.4em; 
  border-bottom: 2px solid rgba(255,255,255,0.3); 
  padding-bottom: 0.3em; 
}
.bot-answer h2 { 
  font-size: 1.3em; 
  border-bottom: 1px solid rgba(255,255,255,0.2); 
  padding-bottom: 0.2em; 
}
.bot-answer h3 { 
  font-size: 1.2em; 
}
.bot-answer h4 { font-size: 1.1em; }

/* Paragraph styling with good contrast */
.bot-answer p {
  margin-bottom: 1em;
  line-height: 1.6;
  color: var(--white);
}

.message.bot .bot-answer p {
  color: var(--white) !important;
}

/* List styling for agricultural instructions */
.bot-answer ul,
.bot-answer ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
  color: var(--white);
}

.bot-answer li {
  margin-bottom: 0.4em;
  line-height: 1.5;
  color: var(--white);
}

.message.bot .bot-answer li {
  color: var(--white) !important;
}

.bot-answer ul li {
  list-style-type: none;
  position: relative;
}

.bot-answer ul li::before {
  content: "•";
  position: absolute;
  left: -1.2em;
  top: 0;
}

/* Nested lists */
.bot-answer ul ul li::before {
  content: "▶";
  color: rgba(255,255,255,0.8);
}

/* Strong and emphasis with good contrast */
.bot-answer strong,
.bot-answer b {
  color: var(--white);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.message.bot .bot-answer strong,
.message.bot .bot-answer b {
  color: var(--white) !important;
}

.bot-answer em,
.bot-answer i {
  color: rgba(255,255,255,0.9);
  font-style: italic;
}

/* Code blocks for agricultural data */
.bot-answer pre {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 1em;
  margin: 1em 0;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.4;
  color: var(--white);
}

.message.bot .bot-answer pre {
  background: rgba(255,255,255,0.15);
  color: var(--white) !important;
}

.bot-answer code {
  background: rgba(255,255,255,0.15);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.2);
}

.message.bot .bot-answer code {
  background: rgba(255,255,255,0.2);
  color: var(--white) !important;
}

.bot-answer pre code {
  background: transparent;
  border: none;
  padding: 0;
}

/* Blockquotes for important agricultural tips */
.bot-answer blockquote {
  border-left: 4px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
  padding: 0.8em 1.2em;
  margin: 1em 0;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--white);
  position: relative;
}

.message.bot .bot-answer blockquote {
  background: rgba(255,255,255,0.15);
  color: var(--white) !important;
}

.bot-answer blockquote::before {
  content: "💡";
  position: absolute;
  top: 0.5em;
  right: 0.8em;
  font-size: 1.2em;
}

/* Tables for agricultural data */
.bot-answer table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.bot-answer th,
.bot-answer td {
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.8em;
  text-align: left;
  color: var(--white);
}

.message.bot .bot-answer th,
.message.bot .bot-answer td {
  color: var(--white) !important;
}

.bot-answer th {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  font-weight: 600;
}

.message.bot .bot-answer th {
  background: rgba(255,255,255,0.25);
}

.bot-answer tr:nth-child(even) {
  background: rgba(255,255,255,0.05);
}

.bot-answer tr:hover {
  background: rgba(255,255,255,0.1);
}

/* Links styling */
.bot-answer a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255,255,255,0.6);
  transition: all 0.2s ease;
}

.message.bot .bot-answer a {
  color: rgba(255,255,255,0.9) !important;
}

.bot-answer a:hover {
  color: var(--white);
  border-bottom-style: solid;
  text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

/* Horizontal rules */
.bot-answer hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.3), transparent);
  margin: 1.5em 0;
}

/* Special styling for agricultural sections */
.bot-answer h3:contains("Best Practices"),
.bot-answer h3:contains("Fertilizer"),
.bot-answer h3:contains("Crop"),
.bot-answer h3:contains("Season"),
.bot-answer h3:contains("Yield") {
  background: var(--very-light-green);
  padding: 0.5em 1em;
  border-radius: 6px;
  border-left: 4px solid var(--accent-green);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .bot-answer {
    font-size: 0.95em;
  }
  
  .bot-answer table {
    font-size: 0.85em;
  }
  
  .bot-answer pre {
    font-size: 0.8em;
  }
}