/* ============================================================
   Metropolis Font Faces
   ============================================================ */
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-300-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-300-normal.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-400-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-400-normal.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-400-italic.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-400-italic.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-500-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-500-normal.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-600-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-600-normal.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-700-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-700-normal.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Metropolis';
  src: url('../fonts/metropolis/metropolis-latin-800-normal.woff2') format('woff2'),
       url('../fonts/metropolis/metropolis-latin-800-normal.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Design Tokens — Sapius AI
   ============================================================ */
:root {
  --font-base: 'Metropolis', system-ui, sans-serif;

  /* Sapius colour palette */
  --sapius-900: #002330;
  --sapius-800: #26444F;
  --sapius-700: #005F84;
  --sapius-500: #047FAC;
  --sapius-100: #D6EBF5;
  --sapius-50:  #EBF5FA;

  /* Legacy aliases (kept for partials that may reference them) */
  --color-primary:      #005F84;
  --color-primary-dark: #002330;
  --color-text:         #002330;
  --color-muted:        #26444F;

  --navbar-height: 72px;
}

/* ============================================================
   Base
   ============================================================ */
body {
  font-family: var(--font-base);
  color: var(--sapius-900);
  background: #fff;
}

/* ============================================================
   Navbar
   ============================================================ */
.site-navbar {
  height: var(--navbar-height);
  background-color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.site-navbar .navbar-brand img {
  height: 39px;
  width: auto;
}

.site-navbar .nav-link {
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 1.25rem;        /* 20px */
  line-height: 1.75rem;      /* 28px */
  color: var(--sapius-900);
  padding: 0 0;
  margin: 0 0;
  transition: color 0.15s;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
  color: var(--sapius-500);
}

/* Primary CTA button — pill shape */
.btn-primary-sapius {
  background-color: var(--sapius-700);
  color: #fff;
  font-family: var(--font-base);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: none;
  box-shadow: 0 7px 28px rgba(0, 127, 255, 0.10);
  transition: background-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary-sapius:hover {
  background-color: var(--sapius-900);
  color: #fff;
}

.icon-btn {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--sapius-900);
}
.icon-btn:hover { color: var(--sapius-500); }

/* ============================================================
   Sidebar (Offcanvas)
   ============================================================ */
.site-sidebar .offcanvas-header {
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.site-sidebar .nav-link {
  font-weight: 500;
  font-size: 1rem;
  color: var(--sapius-900);
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.site-sidebar .nav-link:hover,
.site-sidebar .nav-link.active {
  color: var(--sapius-500);
}

/* ============================================================
   Language Switcher
   ============================================================ */
.lang-toggle { gap: 0.375rem; }

.lang-label {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
}

.btn-lang-option {
  background: var(--sapius-50);
  border: 1px solid var(--sapius-100);
  border-radius: 100px;
  padding: 0.375rem 0.875rem;
  font-family: var(--font-base);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sapius-900);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-lang-option:hover,
.btn-lang-option.active {
  background: var(--sapius-100);
  border-color: var(--sapius-500);
  color: var(--sapius-700);
}

/* ============================================================
   Utility
   ============================================================ */
main { min-height: 60vh; }

@media (max-width: 991.98px) {
  .page-hero h1 { font-size: 1.9rem; line-height: 2.4rem; }
}

/* ============================================================
   Chat Page — Layout
   ============================================================ */
.chat-body {
  overflow: hidden;
  height: 100vh;
}

.chat-page {
  min-height: 0;
}

/* Desktop permanent sidebar */
.chat-side-panel {
  width: 280px;
  flex-shrink: 0;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  background: #fff;
  padding: 1.25rem 1rem 1rem;
}

.chat-side-panel nav .navbar-nav {
  flex-direction: column !important;
}

.chat-side-panel .nav-link {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--sapius-900);
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.chat-side-panel .nav-link:hover,
.chat-side-panel .nav-link.active {
  color: var(--sapius-500);
}

.chat-side-panel .btn-primary-sapius {
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
}

/* ============================================================
   Chat History Sidebar — shared by panel + offcanvas
   ============================================================ */
.chat-history-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-history-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sapius-800);
  opacity: 0.65;
  margin: 0 0 0.5rem;
}

.chat-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.chat-history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  padding: 2px 4px;
  transition: background 0.12s;
}

.chat-history-item:hover {
  background: var(--sapius-50);
}

.chat-history-item.active {
  background: var(--sapius-100);
}

.chat-history-title {
  flex: 1;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-base);
  font-size: 0.875rem;
  color: var(--sapius-900);
  padding: 0.375rem 0.25rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-history-title:hover { color: var(--sapius-500); }

.chat-history-delete {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--sapius-800);
  opacity: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: opacity 0.12s, color 0.12s;
}

.chat-history-item:hover .chat-history-delete { opacity: 0.5; }
.chat-history-delete:hover { opacity: 1 !important; color: #c00; }

.chat-history-empty {
  font-size: 0.8125rem;
  color: var(--sapius-800);
  opacity: 0.55;
  padding: 0.25rem 0.25rem;
}

/* ============================================================
   Chat Main Column
   ============================================================ */
.chat-main {
  min-width: 0;
  background: var(--sapius-50);
}

/* ── Messages ── */
.chat-messages {
  overflow-y: auto;
  padding: 2rem 1.5rem 1rem;
  scroll-behavior: smooth;
}

/* ── Welcome state ── */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem 2rem;
  max-width: 540px;
  margin: 0 auto;
}

.chat-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--sapius-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sapius-700);
  margin-bottom: 1.25rem;
}

.chat-welcome h2 {
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--sapius-900);
  margin-bottom: 0.625rem;
}

.chat-welcome p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--sapius-800);
  margin-bottom: 1.75rem;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.chat-suggestion-btn {
  background: #fff;
  border: 1px solid var(--sapius-100);
  border-radius: 100px;
  padding: 0.5rem 1rem;
  font-family: var(--font-base);
  font-size: 0.875rem;
  color: var(--sapius-800);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.chat-suggestion-btn:hover {
  border-color: var(--sapius-500);
  color: var(--sapius-500);
  background: var(--sapius-50);
}

/* ── Message bubbles ── */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 0.625rem;
  margin-bottom: 1rem;
  max-width: 760px;
}

.chat-msg--user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-msg--assistant {
  flex-direction: row;
  margin-right: auto;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sapius-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sapius-700);
  flex-shrink: 0;
}

.chat-msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: calc(100% - 48px);
}

.chat-msg--user .chat-msg-bubble {
  background: var(--sapius-700);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--assistant .chat-msg-bubble {
  background: #fff;
  color: var(--sapius-900);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-msg-bubble p { margin: 0 0 0.5em; }
.chat-msg-bubble p:last-child { margin-bottom: 0; }

/* ── Typing indicator ── */
.typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sapius-500);
  margin: 0 2px;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Thinking indicator (shown while model reasons before producing content) ── */
.chat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--sapius-500);
  font-size: 0.875rem;
  font-style: italic;
}
.chat-thinking .typing-dot {
  width: 5px;
  height: 5px;
  background: var(--sapius-400);
}

/* ── Input area ── */
.chat-input-container {
  background: var(--sapius-50);
  padding: 0.875rem 1.5rem 1rem;
  flex-shrink: 0;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--sapius-100);
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  box-shadow: 0 2px 8px rgba(4, 127, 172, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input-bar:focus-within {
  border-color: var(--sapius-500);
  box-shadow: 0 2px 12px rgba(4, 127, 172, 0.12);
}

.chat-input-bar textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-base);
  font-size: 0.9375rem;
  color: var(--sapius-900);
  outline: none;
  resize: none;
  line-height: 1.5;
  padding: 0.25rem 0;
  min-height: 1.5rem;
  max-height: 160px;
  overflow-y: auto;
}

.chat-input-bar textarea::placeholder { color: var(--sapius-800); opacity: 0.55; }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sapius-700);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover { background: var(--sapius-900); }
.chat-send-btn:active { transform: scale(0.94); }
.chat-send-btn:disabled { background: var(--sapius-100); color: var(--sapius-800); cursor: not-allowed; }

.chat-send-btn--loading {
  position: relative;
  overflow: hidden;
}

.chat-disclaimer {
  font-size: 0.6875rem;
  color: var(--sapius-800);
  opacity: 0.55;
  margin: 0.375rem 0.25rem 0;
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .chat-messages { padding: 1rem 0.75rem; }
  .chat-input-container { padding: 0.75rem 0.75rem 0.875rem; }
  .chat-welcome { padding: 2rem 1rem 1rem; }
  .chat-msg { max-width: 100%; }
}

/* ============================================================
   Page Hero — Terms & Privacy
   ============================================================ */
.page-hero {
  background: linear-gradient(180deg, #fff 40%, var(--sapius-50) 100%);
  padding: 64px 0 48px;
}

.page-hero h1 {
  font-weight: 700;
  font-size: 3.1rem;
  line-height: 3.75rem;
  color: var(--sapius-900);
  max-width: 590px;
  margin: 0 auto;
  text-shadow: 0 2px 8px rgba(0, 35, 48, 0.12);
}

.page-hero h2 {
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.75rem;
  color: var(--sapius-800);
  max-width: 560px;
  margin: 0.75rem auto 0;
}
