/* Seller.club UI Kit bileşenlerinin (Button, Topbar, MessageThread, Composer, Alert) bu sayfaya aktarımı.
   Değerler yalnız kit/tokens.css belirteçlerinden gelir; o dosya kitten kopyalanır, elle değiştirilmez. */
:root {
  --duration-fast: 120ms;
  --ease-out: cubic-bezier(.2, 0, 0, 1);
  --page-w: var(--form-max);
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--selection); }
[hidden] { display: none !important; }
:focus-visible { outline: var(--focus-w) solid var(--ring); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* İkon: lucide, yalnız çizgi */
.icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--xs { width: var(--icon-xs); height: var(--icon-xs); stroke-width: 2; }
.icon--lg { width: var(--icon-lg); height: var(--icon-lg); }

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  min-height: var(--control-h);
  margin: 0;
  padding: 0 var(--space-14);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-primary); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary { border-color: var(--border); background: var(--secondary); color: var(--secondary-foreground); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.btn--sm { min-height: var(--control-h-sm); padding: 0 var(--space-10); font-size: 12.5px; line-height: 16px; }
.btn:disabled { border-color: var(--border); background: var(--surface-disabled); color: var(--text-subtle); box-shadow: none; cursor: not-allowed; transform: none; }

/* Üst çubuk */
.top {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  min-height: var(--topbar-h);
  padding: var(--space-8) var(--page-x);
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.brand { display: flex; align-items: center; gap: var(--space-10); min-width: 0; }
.brandmark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-mark-start), var(--brand-mark-end));
  color: var(--primary-foreground);
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.02em;
  user-select: none;
}
.brand__name { font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand__sub { padding-left: var(--space-10); border-left: 1px solid var(--border); color: var(--muted-foreground); font-size: 13px; line-height: 18px; white-space: nowrap; }
.top__right { display: flex; flex: none; align-items: center; gap: var(--space-8); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-8);
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary-soft-foreground);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}

/* Sayfa */
main { flex: 1 0 auto; width: 100%; max-width: calc(var(--page-w) + 2 * var(--page-x-sm)); margin: 0 auto; padding: var(--page-y) var(--page-x-sm) var(--space-16); }

/* Karşılama (EmptyState düzeni) */
.welcome { display: flex; flex-direction: column; align-items: center; padding: var(--space-48) 0 var(--space-24); text-align: center; }
.tile { display: inline-flex; align-items: center; justify-content: center; width: var(--tile-2xl); height: var(--tile-2xl); margin-bottom: var(--space-16); border-radius: var(--radius-md); background: var(--primary-soft); color: var(--primary-soft-foreground); }
.welcome h1 { max-width: 560px; margin: 0 0 var(--space-8); font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -.02em; }
.welcome p { max-width: 520px; margin: 0; color: var(--text-secondary); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-8); margin-top: var(--space-24); }
.chips .btn { font-weight: 500; white-space: normal; text-align: left; }

/* Alert */
.alert { display: flex; align-items: flex-start; gap: var(--space-10); padding: var(--space-12) var(--space-14); border: 1px solid var(--_b); border-radius: var(--radius-md); background: var(--_s); color: var(--_st); }
.alert--warning { --_t: var(--warning); --_b: var(--warning-border); --_s: var(--warning-subtle); --_st: var(--warning-strong); margin-bottom: var(--space-16); }
.alert--danger { --_t: var(--danger); --_b: var(--danger-border); --_s: var(--danger-subtle); --_st: var(--danger-strong); }
.alert__icon { width: var(--icon-lg); height: var(--icon-lg); color: var(--_t); }
.alert__title { font-weight: 600; }
.alert__desc { font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }

/* Konuşma (MessageThread) */
.log { display: flex; flex-direction: column; gap: var(--space-14); }
.log:empty { display: none; }
.msg { display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; gap: var(--space-4); width: 100%; min-width: 0; }
.msg--own { align-items: flex-end; align-self: flex-end; width: auto; max-width: min(100%, var(--bubble-max)); }
.msg__bubble { max-width: 100%; min-width: 0; padding: var(--space-10) var(--space-14) var(--space-12); border: 1px solid var(--border); border-radius: 14px 14px 14px var(--radius-xs); background: var(--card); box-shadow: var(--shadow-xs); }
.msg:not(.msg--own) .msg__bubble { width: 100%; }
.msg--own .msg__bubble { border-color: var(--primary-border); border-radius: 14px 14px var(--radius-xs) 14px; background: var(--primary-soft); box-shadow: none; }
.msg__author { display: flex; align-items: center; gap: var(--space-6); margin-bottom: var(--space-4); color: var(--foreground); font-size: 12px; line-height: 16px; font-weight: 600; }
.msg--own .msg__author { color: var(--primary-soft-foreground); }
.msg__text { font-size: 13.5px; line-height: 20px; overflow-wrap: anywhere; }
.msg--own .msg__text { white-space: pre-wrap; }
.msg__status { display: inline-flex; align-items: center; gap: var(--space-8); color: var(--muted-foreground); font-size: 13px; line-height: 18px; }
.spinner { flex: none; width: var(--icon-sm); height: var(--icon-sm); border: 2px solid var(--muted); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cevaptaki Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 var(--space-10); }
.md ul, .md ol { padding-left: var(--space-20); }
.md li + li { margin-top: var(--space-4); }
.md h1, .md h2 { margin: var(--space-16) 0 var(--space-6); font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -.01em; }
.md h3, .md h4, .md h5, .md h6 { margin: var(--space-14) 0 var(--space-4); font-size: 13.5px; line-height: 20px; font-weight: 600; }
.md strong { font-weight: 600; }
.md a { color: var(--link); text-underline-offset: 2px; }
.md a:hover { color: var(--link-hover); }
.md hr { margin: var(--space-14) 0; border: 0; border-top: 1px solid var(--border-subtle); }
.md blockquote { padding-left: var(--space-12); border-left: 2px solid var(--border-strong); color: var(--text-secondary); }
.md code { padding: 1px var(--space-4); border-radius: var(--radius-xs); background: var(--muted); font-family: var(--font-mono); font-size: 12px; line-height: 16px; }
.md pre { padding: var(--space-10) var(--space-12); overflow-x: auto; border-radius: var(--radius-md); background: var(--surface-subtle); }
.md pre code { padding: 0; background: none; }
.md table { display: block; max-width: 100%; margin: 0 0 var(--space-10); overflow-x: auto; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.md th, .md td { padding: var(--space-6) var(--space-10); border: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--surface-subtle); color: var(--muted-foreground); font-size: 11.5px; line-height: 16px; font-weight: 600; white-space: nowrap; }

/* Yanıt alanı (Composer) */
.dock {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  flex: none;
  width: 100%;
  padding: var(--space-8) var(--page-x-sm) calc(var(--space-8) + env(safe-area-inset-bottom));
  background: var(--background);
}
.composer { display: flex; flex-direction: column; gap: var(--space-8); width: 100%; max-width: var(--page-w); margin: 0 auto; padding: var(--space-10); border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface-subtle); box-shadow: var(--shadow-card); }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 60px;
  max-height: 178px;
  margin: 0;
  padding: var(--space-8) var(--space-12);
  overflow-y: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 20px;
  resize: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.composer textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
.composer textarea:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--focus-halo); }
.composer__actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }
.composer__hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-12); min-width: 0; color: var(--muted-foreground); font-size: 12px; line-height: 16px; }
.foot { max-width: var(--page-w); margin: var(--space-6) auto 0; color: var(--muted-foreground); font-size: 12px; line-height: 16px; text-align: center; }

@media (max-width: 760px) {
  .top { padding-right: var(--page-x-sm); padding-left: var(--page-x-sm); min-height: var(--mobile-bar-h); }
  main { padding-top: var(--space-16); }
  .welcome { padding-top: var(--space-24); }
  .welcome h1 { font-size: 20px; line-height: 28px; }
  .composer textarea { font-size: 16px; line-height: 22px; } /* iOS yakınlaştırmasını önler */
  .composer__shortcut { display: none; }
  .btn { min-height: var(--control-h-touch); }
}
@media (max-width: 520px) {
  .brand__sub { display: none; }
  /* Yönetim rozeti varken dar çubukta marka adı sıkışmasın */
  .top:has(#modeBadge:not([hidden])) .btn__label { display: none; }
  .top:has(#modeBadge:not([hidden])) .btn { width: var(--control-h-touch); padding: 0; }
}
@media (max-width: 360px) {
  .brand__name { font-size: 14px; }
  .badge { padding: var(--space-2) var(--space-6); font-size: 11px; }
  .top__right { gap: var(--space-6); }
  .top { gap: var(--space-6); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
  .btn:active { transform: none; }
  .spinner { animation: none; }
}
