/*
  Havensis Elektronik — ortak tasarım tokenları.
  Web sohbet arayüzü + yönetim paneli (giriş, dashboard) bu dosyayı paylaşır;
  renk/radius/gölge/tipografi TEK yerden değişsin diye buraya toplandı.
  Sadece görsel değişkenler + minimal reset içerir, davranış/JS'e dokunmaz.
*/

:root {
  /* ---- Yüzeyler ---- */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-surface-2: #fbfbfc;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.14);

  /* ---- Metin ---- */
  --color-text: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-text-tertiary: #98989d;

  /* ---- Birincil vurgu (eylemler, bağlantılar, odak) ---- */
  --color-accent: #2f6fed;
  --color-accent-hover: #255bd1;
  --color-accent-soft: rgba(47, 111, 237, 0.1);
  --color-accent-soft-strong: rgba(47, 111, 237, 0.18);
  --color-on-accent: #ffffff;

  /* ---- İkincil vurgu: marka/solar enerji — az ve bilinçli kullan ---- */
  --color-energy: #c96a10;
  --color-energy-soft: rgba(201, 106, 16, 0.12);

  /* ---- Anlamsal renkler ---- */
  --color-success: #1a9e5c;
  --color-success-soft: rgba(26, 158, 92, 0.1);
  --color-danger: #d92d20;
  --color-danger-soft: rgba(217, 45, 32, 0.08);
  --color-warning: #b25e09;
  --color-warning-soft: rgba(242, 153, 74, 0.14);

  /* ---- Şekil ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* ---- Gölge (yumuşak, çok katmanlı — Apple tarzı ambient) ---- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.12), 0 4px 14px rgba(0, 0, 0, 0.06);

  /* ---- Tipografi: platformun kendi sistem yazı tipi (SF Pro / Segoe UI) ----
     Web fontu indirmiyoruz - hem daha hızlı yükleniyor hem her işletim
     sisteminde kendi native hissini veriyor (Apple'ın kendi tercihi de bu). */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text",
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", "Consolas", monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Sistem tercihiyle otomatik koyu tema - kullanıcı sayfadaki tema düğmesiyle
   (.theme-toggle, bkz. shared/theme.js) elle "light" seçtiyse bu blok
   :not([data-theme="light"]) sayesinde devre dışı kalır. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #000000;
    --color-surface: #1c1c1e;
    --color-surface-2: #242426;
    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-strong: rgba(255, 255, 255, 0.16);

    --color-text: #f5f5f7;
    --color-text-secondary: #98989d;
    --color-text-tertiary: #6e6e73;

    --color-accent: #5e9aff;
    --color-accent-hover: #7fadff;
    --color-accent-soft: rgba(94, 154, 255, 0.16);
    --color-accent-soft-strong: rgba(94, 154, 255, 0.26);
    --color-on-accent: #ffffff;

    --color-energy: #ffab3d;
    --color-energy-soft: rgba(255, 171, 61, 0.14);

    --color-success: #34d399;
    --color-success-soft: rgba(52, 211, 153, 0.14);
    --color-danger: #ff6b6b;
    --color-danger-soft: rgba(255, 107, 107, 0.12);
    --color-warning: #ffb454;
    --color-warning-soft: rgba(255, 180, 84, 0.14);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.55);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.65);
  }
}

/* Kullanıcının sayfadaki tema düğmesiyle (.theme-toggle) elle seçtiği taraf,
   localStorage'dan okunup <html data-theme="..."> olarak yazılır (bkz.
   shared/theme.js) ve sistem tercihinin önüne geçer. Düğmeye hiç
   basılmadıysa data-theme yoktur, sayfa yukarıdaki @media ile tamamen
   prefers-color-scheme'e göre otomatik geçiş yapar. */
:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #000000;
  --color-surface: #1c1c1e;
  --color-surface-2: #242426;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.16);

  --color-text: #f5f5f7;
  --color-text-secondary: #98989d;
  --color-text-tertiary: #6e6e73;

  --color-accent: #5e9aff;
  --color-accent-hover: #7fadff;
  --color-accent-soft: rgba(94, 154, 255, 0.16);
  --color-accent-soft-strong: rgba(94, 154, 255, 0.26);
  --color-on-accent: #ffffff;

  --color-energy: #ffab3d;
  --color-energy-soft: rgba(255, 171, 61, 0.14);

  --color-success: #34d399;
  --color-success-soft: rgba(52, 211, 153, 0.14);
  --color-danger: #ff6b6b;
  --color-danger-soft: rgba(255, 107, 107, 0.12);
  --color-warning: #ffb454;
  --color-warning-soft: rgba(255, 180, 84, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--color-accent-soft-strong);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* input/textarea zaten kendi odak halkasını gösteriyor (box-shadow ile,
   kutunun/pilin kendi border-radius'una uyan, yuvarlak bir halka - bkz.
   sayfa CSS'lerindeki :focus / .composer-inner:focus-within kuralları).
   Tarayıcının köşeleri yuvarlamayan varsayılan dikdörtgen outline'ı
   olmadan da odak zaten net görünüyor; üstüne binip köşesi kare bir
   çerçeve gibi görünmesin diye burada kapatılıyor. */
input:focus-visible,
textarea:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- Tema düğmesi (açık/koyu, elle) ----
   Buton, hem güneş hem ay SVG'sini içerir; hangisi görünür olacağını
   shared/theme.js her sayfa yüklendiğinde ve tıklamada data-state
   özniteliğine yazar - CSS sadece o özniteliğe göre gösterir/gizler. */
.theme-toggle {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* "light" durumundayken ay görünür (basınca koyuya geçer), "dark"
   durumundayken güneş görünür (basınca açığa geçer). */
.theme-toggle[data-state="light"] .icon-moon {
  display: block;
}

.theme-toggle[data-state="dark"] .icon-sun {
  display: block;
}
