/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --body-l-font-family: "Inter", Helvetica, sans-serif;
  --body-l-font-size: clamp(16px, 1.4vw, 20px);
  --body-l-letter-spacing: -0.002px;
  --body-l-line-height: 1.55;

  --body-m-font-family: "Inter", Helvetica, sans-serif;
  --body-m-font-size: 16px;
  --body-m-letter-spacing: -0.0016px;
  --body-m-line-height: 1.6;

  --body-s-font-family: "Inter", Helvetica, sans-serif;
  --body-s-font-size: 14px;
  --body-s-letter-spacing: -0.0014px;
  --body-s-line-height: 1.5;

  --body-XS-font-family: "Inter", Helvetica, sans-serif;
  --body-XS-font-size: 13px;
  --body-XS-letter-spacing: -0.0013px;
  --body-XS-line-height: 1.5;

  --heading-1-font-family: "Inter", Helvetica, sans-serif;
  --heading-1-font-size: clamp(40px, 6vw, 82px);
  --heading-1-letter-spacing: -0.03em;
  --heading-1-line-height: 1.05;

  --max-width: 1200px;
  --gutter: 24px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  font: inherit;
  color: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
}

/* ==========================================================================
   Page / layout
   ========================================================================== */
.page {
  display: flex;
  min-height: 100vh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  background-color: #020103;
  overflow-x: hidden;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.header {
  display: flex;
  width: 100%;
  max-width: var(--max-width);
  padding: 28px var(--gutter) 0;
  align-items: center;
  justify-content: center;
}

.nav {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 10px 12px 10px 20px;
  border-radius: 14px;
  border: 1px solid #ffffff26;
  background-color: #ffffff08;
}

.logo {
  display: block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background-image: url("logo.png");
  background-size: cover;
  background-position: 50% 50%;
  border-radius: 10px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-toggle svg {
  width: 18px;
  height: 18px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--body-XS-font-family);
  font-size: var(--body-XS-font-size);
  letter-spacing: var(--body-XS-letter-spacing);
  line-height: var(--body-XS-line-height);
  color: #ffffff99;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: #ffffff;
}

.nav-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  opacity: 0.7;
  color: currentColor;
}

.nav-link-icon svg {
  width: 100%;
  height: 100%;
}

.login-btn {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 20px;
  background-color: #8c45ff66;
  border: 1px solid #ffffff26;
  box-shadow: inset 0 0 6px 3px #ffffff40;
  backdrop-filter: blur(7px) brightness(100%);
  -webkit-backdrop-filter: blur(7px) brightness(100%);
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.login-btn:hover {
  background-color: #8c45ff99;
}

.login-btn span {
  font-family: var(--body-s-font-family);
  font-size: var(--body-s-font-size);
  letter-spacing: var(--body-s-letter-spacing);
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  margin: 32px var(--gutter) 0;
  padding: clamp(64px, 14vw, 160px) clamp(28px, 7vw, 110px);
  border-radius: 24px;
  background-color: #0a0812; /* fallback so text stays legible even if the image fails to load */
  background-image:
    linear-gradient(180deg, #02010399 0%, #02010366 40%, #02010399 100%),
    url("Group 3.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

@media (min-width: 1248px) {
  .hero {
    margin-left: auto;
    margin-right: auto;
  }
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  max-width: 560px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background-color: #000000;
  border-radius: 50px;
  border: 1px solid #ffffff26;
}

.badge-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  background-color: #9855ff;
  border-radius: 40px;
}

.badge-pill-text {
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 700;
  color: #000000;
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.badge-text {
  margin: 0;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  letter-spacing: var(--body-m-letter-spacing);
  line-height: var(--body-m-line-height);
  color: #c79bff;
  white-space: nowrap;
}

.hero-heading {
  margin: 0;
  font-family: var(--heading-1-font-family);
  font-weight: 500;
  font-size: var(--heading-1-font-size);
  letter-spacing: var(--heading-1-letter-spacing);
  line-height: var(--heading-1-line-height);
  /* Light gradient so the text always stays readable against a dark hero image */
  background-image: linear-gradient(180deg, #ffffff 0%, #cfcfd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffffff;
}

.hero-subtext {
  margin: 0;
  max-width: 460px;
  font-family: var(--body-l-font-family);
  font-size: var(--body-l-font-size);
  letter-spacing: var(--body-l-letter-spacing);
  line-height: var(--body-l-line-height);
  color: #ffffffb3;
}

.hero-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  margin-top: 4px;
  background-color: #ffffff;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.hero-login-btn:hover {
  opacity: 0.85;
}

.hero-login-btn span {
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 500;
  color: #000000;
  font-size: 15px;
  letter-spacing: -0.15px;
  line-height: 1;
  white-space: nowrap;
}

/* ==========================================================================
   Auth / Login page
   ========================================================================== */
.auth-section {
  display: flex;
  width: 100%;
  max-width: var(--max-width);
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 8vw, 100px) var(--gutter);
}

.auth-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  max-width: 400px;
  padding: 36px;
  background-color: #ffffff0d;
  border: 1px solid #ffffff26;
  border-radius: 16px;
  backdrop-filter: blur(7px) brightness(100%);
  -webkit-backdrop-filter: blur(7px) brightness(100%);
}

.auth-heading {
  margin: 0;
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 500;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #ffffff;
}

.auth-subtext {
  margin: -8px 0 0;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  letter-spacing: var(--body-m-letter-spacing);
  line-height: var(--body-m-line-height);
  color: #ffffffb3;
}

.auth-form {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.auth-label {
  font-family: var(--body-XS-font-family);
  font-size: var(--body-XS-font-size);
  letter-spacing: var(--body-XS-letter-spacing);
  color: #ffffff99;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  background-color: #00000066;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  color: #ffffff;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.auth-input::placeholder {
  color: #ffffff66;
}

.auth-input:focus {
  border-color: #8c45ff;
  background-color: #00000099;
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  margin-top: 8px;
  background-color: #ffffff;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.auth-submit:hover {
  opacity: 0.85;
}

.auth-submit span {
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 500;
  color: #000000;
  font-size: 15px;
  letter-spacing: -0.15px;
  line-height: 1;
}

.auth-error {
  display: none;
  margin: 4px 0 0;
  font-family: var(--body-XS-font-family);
  font-size: var(--body-XS-font-size);
  color: #ff6b6b;
}

/* ==========================================================================
   Chat page
   ========================================================================== */
.chat-page {
  min-height: 100vh;
}

.chat-nav-title {
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: #ffffff;
  margin-right: auto;
  white-space: nowrap;
}

.chat-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-select {
  padding: 8px 12px;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  background-color: #00000066;
  color: #ffffff;
  font-family: "Inter", Helvetica, sans-serif;
  font-size: var(--body-XS-font-size);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.nav-select:hover,
.nav-select:focus {
  border-color: #8c45ff;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #ffffff99;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  background-color: #ffffff0d;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-icon-btn:hover {
  color: #ffffff;
  border-color: #ffffff40;
}

.nav-icon-btn svg {
  width: 16px;
  height: 16px;
}

.chat-section {
  display: flex;
  width: 100%;
  max-width: var(--max-width);
  flex: 1;
  justify-content: center;
  padding: 24px var(--gutter) clamp(24px, 5vw, 48px);
}

.chat-card {
  display: flex;
  position: relative;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  height: calc(100vh - 160px);
  background-color: #ffffff0d;
  border: 1px solid #ffffff26;
  border-radius: 16px;
  backdrop-filter: blur(7px) brightness(100%);
  -webkit-backdrop-filter: blur(7px) brightness(100%);
  overflow: hidden;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-history::-webkit-scrollbar {
  width: 8px;
}

.chat-history::-webkit-scrollbar-thumb {
  background-color: #ffffff26;
  border-radius: 8px;
}

/* Empty state */
.empty-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  max-width: 420px;
}

.empty-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background-color: #000000;
  border-radius: 50px;
  border: 1px solid #ffffff26;
}

.empty-state-heading {
  margin: 4px 0 0;
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.empty-state-subtext {
  margin: 0;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  color: #ffffffb3;
}

/* Message bubbles */
.message {
  position: relative;
  padding: 12px 16px 20px;
  border-radius: 12px;
  max-width: 82%;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  line-height: var(--body-m-line-height);
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-msg {
  align-self: flex-end;
  background-color: #8c45ff33;
  border: 1px solid #ffffff26;
  color: #ffffff;
}

.ai-msg {
  align-self: flex-start;
  background-color: #ffffff0d;
  border: 1px solid #ffffff1a;
  color: #ffffffe6;
}

.message .msg-time {
  position: absolute;
  bottom: 6px;
  right: 12px;
  font-size: 10px;
  letter-spacing: 0.01em;
  color: #ffffff66;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.message:hover .msg-time {
  opacity: 1;
}

.message strong { font-weight: 700; }

.message code {
  background-color: #ffffff1a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.message pre {
  position: relative;
  background-color: #000000 !important;
  color: #ffffff !important;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid #ffffff1a;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 11px;
  color: #ffffffb3;
  background-color: #ffffff1a;
  border: 1px solid #ffffff26;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.message pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: #ffffff;
}

/* Retry button (shown on failed AI responses) */
.retry-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 5px 14px;
  font-family: var(--body-XS-font-family);
  font-size: var(--body-XS-font-size);
  color: #ffffff;
  background-color: #ffffff1a;
  border: 1px solid #ffffff26;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.retry-btn:hover {
  background-color: #ffffff33;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 28px 12px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ffffff66;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Scroll to bottom button */
.scroll-bottom-btn {
  position: absolute;
  right: 20px;
  bottom: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background-color: #000000;
  border: 1px solid #ffffff26;
  border-radius: 50%;
  color: #ffffffb3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.scroll-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-bottom-btn svg {
  width: 16px;
  height: 16px;
}

/* Composer */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid #ffffff1a;
}

.composer-input {
  flex: 1;
  max-height: 200px;
  padding: 12px 14px;
  background-color: #00000066;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  color: #ffffff;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.composer-input::placeholder {
  color: #ffffff66;
}

.composer-input:focus {
  border-color: #8c45ff;
  background-color: #00000099;
}

.composer-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background-color: #ffffff;
  border-radius: 8px;
  color: #000000;
  transition: opacity 0.15s ease;
}

.composer-send:hover {
  opacity: 0.85;
}

.composer-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.composer-send svg {
  width: 18px;
  height: 18px;
}

.composer-hint {
  margin: 0 0 16px;
  padding: 0 16px;
  font-family: var(--body-XS-font-family);
  font-size: var(--body-XS-font-size);
  color: #ffffff4d;
  text-align: center;
}

/* ==========================================================================
   Responsive tweaks
   ========================================================================== */
@media (max-width: 640px) {
  /* --- Nav (all pages) --- */
  .nav {
    padding: 10px 10px 10px 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #ffffff1a;
    margin-top: 8px;
  }

  .nav-links.open {
    display: flex;
  }

  .hero-content {
    max-width: 100%;
  }

  /* --- Chat mobile fixes --- */
  .header {
    padding: 12px 12px 0;
  }

  .chat-nav-title {
    display: none;
  }

  .chat-nav-actions {
    gap: 8px;
  }

  .nav-select {
    padding: 8px 10px;
    font-size: 12px;
    max-width: 108px;
  }

  .login-btn {
    padding: 8px 14px;
  }

  .login-btn span {
    font-size: 13px;
  }

  .nav-icon-btn {
    width: 36px;
    height: 36px;
  }

  .chat-section {
    padding: 12px 10px 10px;
  }

  .chat-card {
    height: calc(100vh - 128px);
    height: calc(100dvh - 128px);
    border-radius: 12px;
  }

  .chat-history {
    padding: 16px;
    gap: 12px;
  }

  .message {
    max-width: 92%;
    font-size: 15px;
    padding: 10px 14px 18px;
  }

  .empty-state-heading {
    font-size: 22px;
  }

  .composer {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
  }

  .composer-input {
    padding: 10px 12px;
    font-size: 16px; /* keep at 16px+ to prevent iOS auto-zoom on focus */
  }

  .composer-send {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .composer-hint {
    display: none;
  }

  .scroll-bottom-btn {
    right: 14px;
    bottom: 78px;
    width: 32px;
    height: 32px;
  }

  .typing-indicator {
    padding: 0 16px 10px;
  }
}

@media (max-width: 380px) {
  .nav-select {
    max-width: 88px;
    font-size: 11px;
  }

  .login-btn span {
    display: none;
  }

  .login-btn {
    padding: 8px 12px;
  }
}
