/* ==========================================================================
   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 (landing page)
   ========================================================================== */
.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;
  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);
  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 (rebuilt — no longer a card floating inside a generic page shell)
   ========================================================================== */
.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  background-color: #020103;
  overflow: hidden;
}

/* --- App bar: full-width, bottom-border only, distinct from the landing nav --- */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 28px;
  border-bottom: 1px solid #ffffff14;
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.model-select {
  padding: 7px 12px;
  border: 1px solid #ffffff1f;
  border-radius: 8px;
  background-color: #ffffff0a;
  color: #ffffffd9;
  font-family: "Inter", Helvetica, sans-serif;
  font-size: var(--body-XS-font-size);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.model-select:hover,
.model-select:focus {
  border-color: #8c45ff;
  background-color: #ffffff12;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #ffffff80;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  color: #ffffff;
  background-color: #ffffff12;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  background-color: #ffffff0f;
  border: 1px solid #ffffff1f;
  border-radius: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.logout-btn:hover {
  background-color: #ffffff1a;
  border-color: #ffffff33;
}

.logout-btn span {
  font-family: var(--body-s-font-family);
  font-size: var(--body-s-font-size);
  color: #ffffffd9;
  white-space: nowrap;
}

/* --- Main chat area: full width, no boxed card, generous reading width --- */
.chat-main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 40px 24px 200px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  scroll-behavior: smooth;
}

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

.chat-history::-webkit-scrollbar-thumb {
  background-color: #ffffff26;
  border-radius: 8px;
}

/* Empty state — vertically centered in the whole scroll area */
.empty-state {
  display: flex;
  flex: 1;
  min-height: 50vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.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: clamp(26px, 4vw, 34px);
  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;
}

/* Messages — column of full-width rows, each capped to a comfortable reading width */
.message {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 2px 0 0;
  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); }
}

.message::before {
  content: attr(data-role);
  display: block;
  margin-bottom: 6px;
  font-family: "Inter", Helvetica, sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.user-msg {
  color: #ffffff;
}

.user-msg::before {
  content: "You";
  color: #c79bff;
}

.ai-msg {
  color: #ffffffe6;
  padding-bottom: 20px;
  border-bottom: 1px solid #ffffff0d;
}

.ai-msg::before {
  content: attr(data-model);
  color: #ffffff66;
}

.message .msg-time {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: #ffffff4d;
}

.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: 12px 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: 10px;
  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;
}

/* --- Composer: floating dock anchored to the bottom of the viewport --- */
.composer-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 20px;
  background: linear-gradient(180deg, transparent 0%, #020103 40%);
  pointer-events: none;
}

.composer-dock > * {
  pointer-events: auto;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 720px;
  padding: 0 4px 10px;
}

.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: 28px;
  bottom: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: #16121c;
  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 {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  max-width: 720px;
  padding: 12px 12px 12px 20px;
  background-color: #131017;
  border: 1px solid #ffffff26;
  border-radius: 24px;
  box-shadow: 0 12px 32px #00000066;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.composer-input {
  flex: 1;
  max-height: 200px;
  padding: 10px 0;
  background-color: transparent;
  border: none;
  font-family: var(--body-m-font-family);
  font-size: var(--body-m-font-size);
  color: #ffffff;
  resize: none;
  line-height: 1.5;
}

.composer-input::placeholder {
  color: #ffffff5c;
}

.composer-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background-color: #ffffff;
  border-radius: 50%;
  color: #000000;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.composer-send:hover {
  opacity: 0.85;
}

.composer-send:active {
  transform: scale(0.94);
}

.composer-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.composer-send svg {
  width: 17px;
  height: 17px;
}

.composer-hint {
  margin: 10px 0 0;
  font-family: var(--body-XS-font-family);
  font-size: 11px;
  color: #ffffff40;
  text-align: center;
}

/* ==========================================================================
   Responsive tweaks
   ========================================================================== */
@media (max-width: 640px) {
  /* --- Nav (landing/login 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 --- */
  .chat-header {
    padding: 12px 14px;
    gap: 10px;
  }

  .chat-header-left {
    gap: 10px;
  }

  .model-select {
    padding: 7px 9px;
    font-size: 12px;
    max-width: 118px;
  }

  .logout-btn {
    padding: 7px 14px;
  }

  .logout-btn span {
    font-size: 13px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .chat-history {
    padding: 24px 16px 180px;
    gap: 22px;
  }

  .message {
    max-width: 100%;
    font-size: 15px;
  }

  .empty-state {
    min-height: 40vh;
    padding: 0 8px;
  }

  .empty-state-heading {
    font-size: 22px;
  }

  .composer-dock {
    padding: 0 12px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .composer {
    padding: 8px 8px 8px 16px;
    border-radius: 20px;
  }

  .composer-input {
    font-size: 16px; /* keep at 16px+ to prevent iOS auto-zoom on focus */
  }

  .composer-send {
    width: 38px;
    height: 38px;
  }

  .composer-hint {
    display: none;
  }

  .scroll-bottom-btn {
    right: 16px;
    bottom: 100px;
    width: 34px;
    height: 34px;
  }

  .typing-indicator {
    padding: 0 4px 8px;
  }
}

@media (max-width: 380px) {
  .model-select {
    max-width: 96px;
    font-size: 11px;
  }

  .logout-btn span {
    display: none;
  }

  .logout-btn {
    padding: 8px 12px;
  }
}
