/* Proje Takip - degiskenler, iskelet, butonlar, form kontrolleri.
   Bilesenler (kart, rozet, liste, tablo, panel) ui.css icinde.
   Sayfaya ozel stiller: tree.css, tree-views.css, calendar.css, dashboard.css */

:root {
  color-scheme: light dark;

  --bg:          #ffffff;
  --bg-sidebar:  #fafafa;
  --bg-subtle:   #f4f4f5;
  --bg-hover:    #efeff1;
  --border:      #e4e4e7;
  --border-soft: #efeff1;
  --text:        #18181b;
  --muted:       #71717a;
  --faint:       #a1a1aa;

  --accent:        #4f46e5;
  --accent-hover:  #4338ca;
  --accent-fg:     #ffffff;
  --accent-subtle: #eef2ff;

  --danger:     #be123c;
  --danger-bg:  #fff1f2;
  --ok:         #15803d;
  --ok-bg:      #f0fdf4;
  --warn:       #b45309;
  --warn-bg:    #fffbeb;

  --st-planned:  #71717a;
  --st-progress: #2563eb;
  --st-done:     #15803d;
  --st-dropped:  #a45a68;

  --r:      6px;
  --r-lg:   10px;
  --r-full: 999px;

  --sidebar-w: 224px;
  --topbar-h:  52px;

  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 12px rgb(0 0 0 / .06);
}

/*
 * Isletim sisteminin koyu modu. :not([data-theme]) SART: kullanici ust cubuktan
 * bir tema sectiginde <html data-theme="..."> olur ve bu blok devre disi kalir.
 * Boylece "Aydınlık" temasi icin ayrica palet yazmaya gerek kalmiyor - oznitelik
 * varken bu blok eslesmedigi icin yukaridaki acik palet zaten gecerli olur.
 * Diger paletler assets/themes.css icinde.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:          #131316;
    --bg-sidebar:  #0d0d0f;
    --bg-subtle:   #1b1b1f;
    --bg-hover:    #232329;
    --border:      #2a2a31;
    --border-soft: #212127;
    --text:        #ececee;
    --muted:       #9b9ba4;
    --faint:       #6c6c76;

    --accent:        #7c7cf5;
    --accent-hover:  #8f8ff7;
    --accent-fg:     #0d0d0f;
    --accent-subtle: #1e1e3c;

    --danger:     #fb7185;
    --danger-bg:  #2b1418;
    --ok:         #4ade80;
    --ok-bg:      #10231a;
    --warn:       #fbbf24;
    --warn-bg:    #2a2010;

    --st-planned:  #9b9ba4;
    --st-progress: #7aa2f7;
    --st-done:     #4ade80;
    --st-dropped:  #cf8593;

    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .35);
  }
}

* { box-sizing: border-box; }

/*
 * [hidden] KESIN gizlesin.
 *
 * Tarayicinin kendi stilinde [hidden] -> display:none var, ama YAZAR stili
 * her zaman onu ezer: bir sinifa "display:flex" verdiginiz anda oznitelik
 * islevsiz kalir. Bu yuzden JS ile acilan her seyi (tema secici, ağaç arama
 * seridi, asistanin "calisiyor" seridi) hidden ile baslatmak yetmiyordu -
 * hepsi bastan gorunuyordu. Kural tek satirda hepsini duzeltiyor ve
 * ileride eklenecekleri de korur.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .04em; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Klavyeyle gezenler menuyu her sayfada bastan gecmesin. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  padding: 9px 14px; background: var(--accent); color: var(--accent-fg);
  border-radius: 0 0 var(--r) 0;
}
.skip-link:focus { left: 0; text-decoration: none; }

/* --- Iskelet: sol sidebar + saga dogru tam genislik ---------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  height: var(--topbar-h); padding: 0 16px; flex: 0 0 auto;
  font-weight: 600; letter-spacing: -.01em;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 22px; height: 22px; border-radius: var(--r);
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto;
}

.nav { display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; flex: 1 1 auto; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r);
  color: var(--muted); font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-subtle); color: var(--accent); font-weight: 550; }
.nav svg { width: 16px; height: 16px; flex: 0 0 auto; }

.sidebar-foot { flex: 0 0 auto; padding: 10px 8px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px; border-radius: var(--r); color: inherit; text-decoration: none;
}
.user-chip:hover { background: var(--bg-hover); text-decoration: none; }
.avatar {
  width: 24px; height: 24px; border-radius: var(--r-full); flex: 0 0 auto;
  background: var(--accent); color: var(--accent-fg);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.user-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; z-index: 5;
}
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar-title p { margin: 0; font-size: 12.5px; color: var(--muted);
                  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Dar ekranda sarsin: agac sayfasinda 4 gorunum + 2 disa aktarma + dugme tek
   satira sigmiyordu ve sayfayi yatay kaydiriyordu. */
.topbar-actions { display: flex; align-items: center; justify-content: flex-end;
                  flex-wrap: wrap; gap: 8px; flex: 0 1 auto; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end;
                flex-wrap: wrap; gap: 10px; flex: 0 1 auto; min-width: 0; }

.content { flex: 1 1 auto; padding: 18px 20px 60px; }

/* Iskelet disinda kalan tek sayfa: kurulum sihirbazi (install.php) */
.wrap { max-width: 900px; margin: 0 auto; padding: 26px 20px 60px; }

/* --- Butonlar ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px; line-height: 1.4; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 550; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.btn-danger:hover { background: var(--danger-bg); opacity: .85; }
.btn-sm { padding: 3px 7px; font-size: 12px; }
.btn-icon { padding: 4px 6px; color: var(--muted); }
.btn-icon:hover { color: var(--text); }

/* Ust cubuktaki "Asistan" tusu - her sayfada bulundugu icin burada. */
.btn-assistant {
  gap: 5px; font-weight: 550; color: var(--accent); background: var(--accent-subtle);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-assistant:hover { background: var(--accent-subtle); border-color: var(--accent); }
.btn-assistant svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* --- Formlar ------------------------------------------------------------- */

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=search], input[type=month], select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

.field { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1 1 200px; margin-bottom: 0; }
.row + .row { margin-top: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }

/* --- Giris ve hata sayfalari --------------------------------------------- */

.login-wrap { max-width: 340px; margin: 12vh auto; padding: 0 20px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 20px; }
.login-brand .brand-mark { width: 28px; height: 28px; font-size: 14px; }
.login-brand span { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

.hata-sayfasi { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.hata-kutu { max-width: 520px; padding: 26px; background: var(--bg);
             border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.hata-kutu h1 { font-size: 18px; margin-bottom: 8px; }
.hata-detay {
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px;
  background: var(--bg-subtle); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: 11px; max-height: 300px; overflow: auto;
}

/* --- Dar ekran ----------------------------------------------------------- */

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto; width: auto; height: auto; position: static;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { border-bottom: 0; height: 46px; }
  .nav {
    flex-direction: row; overflow-x: auto; padding: 0 8px 8px;
    scrollbar-width: none; gap: 4px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; }
  .sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 8px; }
  .user-chip { padding: 0; margin-right: auto; }
  .topbar { padding: 0 14px; height: auto; min-height: 48px; flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  /* Dar ekranda asistan tusu yalnizca ikon kalir - ust cubuk zaten kalabalik. */
  .btn-assistant span { display: none; }
  .content { padding: 14px 14px 48px; }
  .row > .field { flex: 1 1 100%; }
}
