/* Sasev — design tokens (from the Modernist design system) */

/* Logo lettering */
@font-face {
  font-family: "Nib";
  src: url("../fonts/nib-light-italic-pro.otf") format("opentype");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-accent-2: #e15b47;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);
  --color-border: #e3e3e3;

  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  --font-heading: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-heading-weight: 800;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --radius-md: 0px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

/* — base — */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.55; font-weight: 400;
}
body, button, input { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-600); }
input::placeholder { color: var(--color-neutral-600); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }

/* — page shell — */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 24px; border-bottom: 1px solid var(--color-border);
}
.site-logo { display: block; width: 28px; height: 28px; object-fit: contain; flex: none; }
.site-name { display: flex; align-items: center; }
.site-wordmark { font: 300 italic 24px/1 "Nib", var(--font-heading); letter-spacing: .01em; color: var(--color-text); }
.site-logout { margin: 0 0 0 auto; }

/* — TR / EN language switch (top-right of the site and chat headers) — */
.lang-switch { display: flex; align-items: center; gap: 2px; margin: 0; font: 500 13px/1 var(--font-body); color: var(--color-neutral-700); }
.site-header .lang-switch { margin-left: auto; }
.site-logout + .lang-switch { margin-left: 4px; }
.lang-switch button {
  border: 0; background: transparent; cursor: pointer; padding: 6px 6px; border-radius: var(--radius-md);
  font: inherit; color: inherit; letter-spacing: .04em;
}
.lang-switch button:hover { color: var(--color-text); background: var(--color-neutral-100); }
.lang-switch button.active { color: var(--color-accent); font-weight: 700; }

/* — auth (login / sign up) — */
.auth { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-head h1 { margin: 0; font: 700 28px/1.15 var(--font-heading); letter-spacing: -.02em; text-wrap: pretty; }
.auth-head p { margin: 0; font: 400 15px/1.45 var(--font-body); color: var(--color-neutral-700); }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: #fff;
}
.auth-tabs a {
  height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill); text-decoration: none;
  font: 500 14px/1 var(--font-body); color: var(--color-text);
}
.auth-tabs a:hover { background: var(--color-neutral-100); color: var(--color-text); }
.auth-tabs a.active { background: var(--color-neutral-200); }

.auth-alt {
  height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  cursor: pointer; font: 500 15px/1 var(--font-body); color: var(--color-text);
}
.auth-alt:hover { background: var(--color-neutral-100); }
.auth-alt:disabled { opacity: .55; cursor: not-allowed; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--color-neutral-600); font: 400 13px/1 var(--font-body);
}
.auth-divider span { flex: 1; height: 1px; background: var(--color-border); }

.auth-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.auth-field { display: flex; flex-direction: column; gap: 6px; font: 500 13px/1 var(--font-body); }
.auth-field input {
  height: 42px; padding: 0 14px;
  border: 1px solid var(--color-border); border-radius: 10px; background: #fff;
  font: 400 15px/1 var(--font-body); color: var(--color-text);
  outline-color: var(--color-accent);
}
.auth-field input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.auth-error { font: 400 13px/1.4 var(--font-body); color: var(--color-accent-700); }
.auth-submit { height: 44px; border-radius: var(--radius-pill); font-size: 15px; font-weight: 500; margin-top: 4px; }

/* A link styled as a primary button keeps its text colour (overrides a / a:hover). */
a.btn-primary, a.btn-primary:hover { color: var(--color-bg); }
.auth-anon { margin-top: 0; }
.auth-consent { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.auth-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font: 400 14px/1.4 var(--font-body); }
.auth-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--color-accent); cursor: pointer; }
.auth-note { margin: 0; font: 400 12px/1.5 var(--font-body); color: var(--color-neutral-700); }

/* — shared utilities — */
[hidden] { display: none !important; }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.sm { width: 32px; height: 32px; }
.btn-icon.md { width: 34px; height: 34px; }
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }

/* — chat app — */
html:has(.chat-body), .chat-body { height: 100%; overflow: hidden; }
.chat-app {
  --color-divider: var(--color-neutral-300);
  display: flex; height: 100vh;
  background: var(--color-bg); color: var(--color-text); font-family: var(--font-body);
}
.chat-app button, .chat-app textarea, .chat-app input { font-family: var(--font-body); }
.chat-app a { color: var(--color-accent); }
.chat-app a:hover { color: var(--color-accent-600); }
.chat-app textarea::placeholder { color: var(--color-neutral-600); }

/* sidebar */
.chat-sidebar {
  width: 260px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: #eee; border-right: 1px solid var(--color-divider);
}
.chat-side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 10px 14px 16px; border-bottom: 1px solid var(--color-divider);
}
.chat-brand { flex: 1; display: flex; align-items: center; }
.chat-nav { display: flex; flex-direction: column; padding: 8px; gap: 1px; }
.chat-nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 400 14px/1.3 var(--font-body); color: var(--color-text);
}
.chat-nav-btn:hover { background: var(--color-neutral-300); }
.chat-new { font-weight: 500; font-size: 16px; }
.chat-new.active { background: var(--color-neutral-300); border-radius: 5px;}
.chat-search {
  margin: 4px 2px 6px; width: calc(100% - 4px);
  font-size: 13px; border-radius: 10px; border: 1px solid var(--color-border);
  caret-color: #74c0fc;
}
.chat-search:focus, .chat-search:focus-visible { border-color: #74c0fc; outline: 2px solid #74c0fc; outline-offset: 0; }
.chat-side-list {
  flex: 1; overflow-y: auto; min-height: 0; padding: 8px;
  border-top: 1px solid var(--color-divider);
}
.chat-project { margin-left: 18px; border-left: 1px solid var(--color-divider); display: flex; flex-direction: column; }
.chat-project:empty { display: none; }
.chat-project-item {
  display: block; width: 100%; padding: 6px 10px 6px 14px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  font: 400 14px/1.3 var(--font-body); color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-section-label {
  padding: 18px 10px 6px; font: 600 11px/1 var(--font-body);
  letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700);
}
.chat-recent {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 10px;
  border: 0; border-radius: 5px; background: transparent; cursor: pointer; text-align: left;
  font: 400 14px/1.3 var(--font-body); color: var(--color-text);
}
.chat-recent-icon { flex: none; width: 14px; font-size: 13px; text-align: center; color: #74c0fc; }
.chat-recent-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-project-item:hover, .chat-recent:hover { background: var(--color-neutral-300); }
.chat-project-item.active, .chat-recent.active { background: var(--color-neutral-300); font-weight: 600; }
.chat-more { font-size: 13px; color: var(--color-neutral-700); }
.chat-empty { padding: 7px 10px; font-size: 13px; color: var(--color-neutral-700); }
.chat-side-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 12px 16px; border-top: 1px solid var(--color-divider);
}
.chat-avatar {
  width: 28px; height: 28px; display: grid; place-items: center;
  background: #74c0fc; color: #fff; border-radius: 50%;
  font: 800 13px/1 var(--font-heading);
}
.chat-user { flex: 1; font: 500 14px/1 var(--font-body); }
.chat-panic { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: var(--radius-pill); }
.chat-panic.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.chat-bell { position: relative; }
.chat-bell-dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; background: var(--color-accent); }

/* main column */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; min-height: 61px;
  border-bottom: 1px solid transparent;
}
.chat-header.has-rule { border-bottom-color: var(--color-divider); }
.chat-title {
  flex: 1; min-width: 0; font: 400 15px/1.2 var(--font-heading);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.chat-thread { max-width: 760px; margin: 0 auto; padding: 12px 24px 32px; display: flex; flex-direction: column; }

/* messages */
.msg { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.msg-user { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-bubble {
  background: var(--color-neutral-200); padding: 10px 14px; border-radius: 14px;
  font: 400 15px/1.6 var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-meta-btn {
  align-self: stretch; display: flex; align-items: center; gap: 4px;
  border: 0; border-bottom: 1px solid var(--color-neutral-300); background: transparent;
  padding: 0 0 12px; margin-bottom: 6px; cursor: pointer; text-align: left;
  font: 400 13px/1.3 var(--font-body); color: var(--color-neutral-700);
}
.msg-meta-btn.open svg { transform: rotate(90deg); }
.msg-meta { font-size: 12px; line-height: 1.5; color: var(--color-neutral-700); margin-top: -8px; }
.msg-body { display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.msg-block { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.msg-block.li { grid-template-columns: 16px minmax(0, 1fr); padding-left: 16px; }
.msg-block.li > span { text-align: right; }
.msg-block.h1 { font-size: 22px; font-weight: 700; line-height: 1.35; }
.msg-block.h2 { font-size: 18px; font-weight: 700; line-height: 1.35; }
.msg-block b { font-weight: 700; }
.msg-block code {
  font: 13px ui-monospace, Menlo, monospace; background: var(--color-neutral-200);
  padding: 1px 5px; border-radius: 4px;
}
.msg-block a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.msg-code {
  margin: 4px 0; padding: 14px 16px; background: var(--color-neutral-200); border-radius: 10px;
  font: 13px/1.55 ui-monospace, Menlo, monospace; overflow-x: auto; white-space: pre;
}
.msg-result { margin-top: 8px; max-height: 420px; overflow-y: auto; color: var(--color-neutral-900, inherit); }
.msg-actions { display: flex; align-items: center; gap: 6px; margin-left: -5px; }
.msg-act {
  border: 0; background: transparent; padding: 5px; cursor: pointer; display: flex;
  color: var(--color-neutral-600);
}
.msg-act:hover { color: var(--color-text); }
.msg-act.on { color: var(--color-accent); }
.msg-stamp { font-size: 12px; color: var(--color-neutral-600); padding-left: 4px; }
/* "Add note": the panic button's look, at the thumbs buttons' height (15px icon + 2×5px padding). */
.msg-note { margin-left: auto; height: 25px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 12px; }
.msg-note-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.msg-note-input { min-height: 76px; resize: vertical; font: 400 14px/1.5 var(--font-body); border-radius: 10px; }
/* Note controls use the site's blue instead of the accent red. */
.msg-note, .msg-note-btn.btn-primary { background: #74c0fc; color: #fff; }
.msg-note:hover, .msg-note-btn.btn-primary:hover { background: #4dabf7; }
.msg-note-input, .msg-note-input:focus, .msg-note-input:focus-visible {
  border-color: #74c0fc; outline: 2px solid #74c0fc; outline-offset: 0; caret-color: #74c0fc;
}
.msg-note-bar { display: flex; justify-content: flex-end; gap: 8px; }
.msg-note-btn { height: 30px; padding: 0 14px; border-radius: var(--radius-pill); font-size: 13px; }
.msg-note-view {
  margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--color-accent);
  background: var(--color-neutral-100); border-radius: 6px;
  font: 400 13px/1.5 var(--font-body); white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-note-label { font-weight: 600; font-size: 12px; color: var(--color-neutral-700); margin-bottom: 2px; }
.msg-error {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--color-accent-100); border-radius: 12px;
  font-size: 14px; color: var(--color-accent-800);
}
.msg-error span { flex: 1; }
.msg-pending { padding-bottom: 12px; border-bottom: 1px solid var(--color-neutral-300); font-size: 13px; color: var(--color-neutral-700); }
.chat-loader { display: flex; gap: 6px; height: 20px; align-items: center; }
.chat-loader span { width: 10px; height: 10px; background: var(--color-accent); animation: dcPulse 1s infinite; }
.chat-loader span:nth-child(2) { animation-delay: .18s; }
.chat-loader span:nth-child(3) { animation-delay: .36s; }
@keyframes dcPulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* home hero + composer */
.chat-hero { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
.chat-hero-inner { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 24px 24px; }
.chat-hero h1 {
  margin: 0; font-size: 42px; font-weight: 300; letter-spacing: -.03em;
  text-wrap: balance; text-align: center;
}
.chat-below { flex: 1 1 0; min-height: 0; }
.chat-composer-wrap { max-width: 760px; width: 100%; margin: 0 auto; padding: 0 24px; }
.chat-composer-wrap.in-chat { padding: 0 24px 20px; }
.chat-composer {
  position: relative; display: flex; flex-direction: column;
  background: var(--color-neutral-100); border: 2px solid var(--color-neutral-300); border-radius: 20px;
}
.chat-composer textarea {
  border: 0; outline: 0; background: transparent; resize: none;
  padding: 14px 14px 6px; max-height: 220px;
  font: 15px/1.5 var(--font-body); color: var(--color-text);
}
.chat-composer-bar { display: flex; align-items: center; gap: 6px; padding: 4px 8px 8px; }
.chat-spacer { flex: 1; }
#chat-send { border-radius: 50%; background: #74c0fc; color: #fff; }
#chat-send:hover:not(:disabled) { background: #4dabf7; }
#chat-send:active:not(:disabled) { background: #339af0; }
.chat-toast {
  position: absolute; left: 24px; bottom: 24px; z-index: 10;
  background: var(--color-text); color: var(--color-bg); padding: 10px 14px;
  font: 600 13px/1.3 var(--font-body); box-shadow: var(--shadow-lg);
}
