:root {
  --primary-color: #007bff;
  --primary-dark: #0056b3;
  --dark-bg: #2f2f2f;
  --nav-bg: #343a40;
  --text-light: #ffffff;
  --spacing-unit: 1rem;
  --bg-blue-dark: #090A1A;
  --card-bg-middle: #16182D;
  --blue-light: #9CA0D2;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Arial, sans-serif;
  background-color: var(--bg-blue-dark);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

.header {
  background-color: var(--blue-light);
  color: var(--text-light);
  text-align: center;
  padding: var(--spacing-unit);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 2rem; /* Match the font size of the title on the Crypto page */
}

.header img {
  height: 40px;
  width: 40px;
  margin-left: 10px;
}

nav {
  background-color: var(--card-bg-middle); /* Revert to the previous color */
  display: flex;
  justify-content: space-around; /* Ensure even spacing between items */
  align-items: center;
  padding: 0.5rem 1rem;
}

nav ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}

nav ul li {
  margin: 0 1rem;
}

nav ul li a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 1.1rem; /* Match the font size of the nav bar on the Crypto page */
  font-weight: 500; /* Match the font weight */
}

nav ul li a:hover {
  text-decoration: underline;
}

nav ul li a.active-tab {
  border-bottom: 2px solid var(--text-light); /* Change underline to white */
}

.container.ask-ai {
  padding: 20px;
  max-width: 800px;
  margin: 2rem auto;
  background-color: var(--card-bg-middle);
  color: var(--text-light);
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 12px 32px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
}

.container.ask-ai:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15), 0 16px 40px rgba(0, 0, 0, 0.7);
}

.container.ask-ai h2 {
  color: var(--blue-light);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blue-light);
}

.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.input-group label {
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.input-group input {
  padding: 0.75rem;
  border: 1px solid var(--blue-light);
  border-radius: 4px;
  font-size: 1rem;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

button {
  background-color: var(--primary-color);
  color: var(--text-light);
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: var(--primary-dark);
}

button:active {
  transform: translateY(1px);
}

response-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--card-bg-middle);
  color: var(--text-light);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recent-questions {
  margin-top: 2rem;
}

.recent-questions h3 {
  color: var(--blue-light);
  margin-bottom: 1rem;
}

.recent-questions ul {
  list-style: none;
  padding-left: 0;
}

.recent-questions li {
  background-color: rgba(156, 160, 210, 0.1);
  color: var(--text-light);
  padding: 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease-in-out;
}

footer {
  background-color: var(--card-bg-middle);
  color: var(--text-light);
  text-align: center;
  padding: var(--spacing-unit);
  margin-top: auto;
}

footer p {
  margin: 0;
}

footer a {
  color: var(--text-light); /* Ensures links in footer stay white */
  text-decoration: none;
}

footer a:hover,
footer a:focus {
  text-decoration: underline; /* Adds underline on hover/focus */
}

footer a:visited {
  color: var(--text-light); /* Ensures visited links stay white */
}

footer a:active {
  color: var(--text-light); /* Keeps active links white */
}

.loading-spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  nav {
    flex-direction: row; /* Ensure nav items remain horizontal */
    justify-content: center; /* Center the items */
  }

  nav ul {
    flex-direction: row; /* Keep list items in a row */
    flex-wrap: nowrap; /* Prevent wrapping */
    justify-content: center; /* Center the list items */
  }

  nav ul li {
    margin: 0 0.5rem; /* Adjust spacing for smaller screens */
  }

  nav ul li a {
    font-size: 1rem; /* Ensure consistent font size for mobile devices */
  }

  .container.ask-ai {
    padding: 15px;
    margin: 1rem auto;
  }

  .header h1 {
    font-size: 1.8rem; /* Adjust title size for smaller screens */
  }
}

@media (max-width: 480px) {
  nav {
    flex-direction: row; /* Ensure nav items remain horizontal */
    justify-content: center; /* Center the items */
  }

  nav ul {
    flex-direction: row; /* Keep list items in a row */
    flex-wrap: nowrap; /* Prevent wrapping */
    justify-content: center; /* Center the list items */
  }

  nav ul li {
    margin: 0 0.5rem; /* Adjust spacing for smaller screens */
  }

  nav ul li a {
    font-size: 0.9rem; /* Slightly smaller font size for very small screens */
  }

  .container.ask-ai {
    padding: 1rem;
  }

  .container.ask-ai h2 {
    font-size: 1.5rem;
  }

  .header h1 {
    font-size: 1.6rem; /* Adjust title size for very small screens */
  }
}
