/* Terim Bankası — Ortak Stil Dosyası */

:root {
  --paper: #FBF9F4; --panel: #fff;
  --ink: #1C2B31;   --muted: #5A6D74;
  --rule: #E4DED2;  --rule2: #EFEAE0;
  --accent: #A8432F;--tag: #2E4A52; --ok: #2E6B4F;
  --maxw-content: 680px; --maxw-terim: 720px; --maxw-admin: 960px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1E2B31; --panel: #243239;
    --ink: #E0DAD1;   --muted: #8EA5AE;
    --rule: #2D3E47;  --rule2: #273540;
    --accent: #C55840; --tag: #5D9AAD; --ok: #5BA87A;
  }
}
[data-theme="dark"] {
  --paper: #1E2B31; --panel: #243239;
  --ink: #E0DAD1;   --muted: #8EA5AE;
  --rule: #2D3E47;  --rule2: #273540;
  --accent: #C55840; --tag: #5D9AAD; --ok: #5BA87A;
}

/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6; font-size: 17px;
  display: flex; flex-direction: column; min-height: 100vh;
}
body.admin { font-size: 15px; line-height: 1.55; }

/* ===== Header ===== */
header {
  border-bottom: 1px solid var(--rule);
  padding: 20px clamp(20px, 5vw, 40px);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
header.admin-header { padding: 16px clamp(16px, 4vw, 32px); gap: 14px; }

/* ===== Logo ===== */
.logo {
  font-family: 'Lora', serif; font-weight: 600; font-size: 22px;
  letter-spacing: .04em; color: var(--ink); text-decoration: none;
  display: flex; align-items: baseline; gap: 8px;
}
.logo b {
  color: var(--paper); background: var(--ink);
  padding: 2px 8px; border-radius: 3px; font-weight: 600; letter-spacing: .06em;
}
.logo .badge {
  color: var(--muted); font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
}

/* Hero logo (index sayfası) */
.logo-hero {
  font-family: 'Lora', serif; font-weight: 600;
  font-size: clamp(40px, 9vw, 64px); letter-spacing: .02em;
  display: flex; align-items: baseline; gap: 14px;
}
.logo-hero b {
  color: var(--paper); background: var(--ink);
  border-radius: 6px; padding: 4px 16px; font-weight: 600; letter-spacing: .06em;
}

/* ===== Search — kompakt (header içi) ===== */
header .search {
  flex: 1; min-width: 220px; display: flex;
  border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: #fff;
}
header .search input {
  flex: 1; border: 0; padding: 11px 14px; font-size: 15px;
  font-family: inherit; color: var(--ink); background: transparent;
}
header .search input:focus { outline: none; }
header .search:focus-within { border-color: var(--tag); }
header .search button {
  border: 0; background: var(--ink); color: var(--paper);
  padding: 0 18px; font-family: inherit; font-size: 14px; cursor: pointer; letter-spacing: .02em;
}
header .search button:hover { background: var(--tag); }

/* ===== Search — hero (index sayfası) ===== */
.search-hero {
  display: flex; width: min(560px, 100%); margin-top: 30px;
  border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: #fff;
  box-shadow: 0 1px 2px rgba(28,43,49,.04);
}
.search-hero input {
  flex: 1; border: 0; padding: 15px 18px; font-size: 17px;
  font-family: inherit; color: var(--ink); background: transparent;
}
.search-hero input:focus { outline: none; }
.search-hero:focus-within { border-color: var(--tag); }
.search-hero button {
  border: 0; background: var(--ink); color: var(--paper);
  padding: 0 24px; font-family: inherit; font-size: 15px; cursor: pointer; letter-spacing: .02em;
}
.search-hero button:hover { background: var(--tag); }

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--rule);
  padding: 24px clamp(20px, 5vw, 40px);
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  align-items: center; font-size: 14px; color: var(--muted);
}
footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
footer a[aria-disabled="true"] { opacity: .55; cursor: default; pointer-events: none; }
footer .fspacer { flex: 1; }
footer small { font-size: 13px; }

/* ===== Index (Ana Sayfa) ===== */
main.home {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px clamp(20px, 5vw, 40px); gap: 8px;
}
.tagline { color: var(--muted); font-size: 16px; margin-top: 4px; max-width: 440px; }
.stat { margin-top: 22px; font-size: 13px; color: var(--muted); letter-spacing: .03em; }
.stat b { color: var(--ink); font-weight: 600; }

/* ===== Statik (İçerik Sayfaları) ===== */
main.content {
  flex: 1; width: 100%; max-width: var(--maxw-content);
  margin: 0 auto; padding: clamp(36px, 6vw, 60px) clamp(20px, 5vw, 40px);
  line-height: 1.65;
}
.eyebrow {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 10px;
}
h1 {
  font-family: 'Lora', serif; font-weight: 600;
  font-size: clamp(30px, 6vw, 40px); line-height: 1.1; margin-bottom: 8px;
}
.title-rule { height: 2px; width: 56px; background: var(--ink); margin: 18px 0 32px; }
main.content p { margin-bottom: 18px; }
main.content h2 { font-family: 'Lora', serif; font-weight: 600; font-size: 22px; margin: 34px 0 12px; }
main.content a { color: var(--tag); text-decoration: underline; text-underline-offset: 2px; }
main.content a:hover { color: var(--accent); }
main.content ul { margin: 0 0 18px 22px; }
main.content li { margin-bottom: 6px; }

/* ===== Terim Sayfası ===== */
main.terim {
  flex: 1; width: 100%; max-width: var(--maxw-terim);
  margin: 0 auto; padding: clamp(32px, 6vw, 56px) clamp(20px, 5vw, 40px);
}
.entry-head {
  display: flex; align-items: baseline;
  justify-content: space-between; gap: 16px; margin-bottom: 4px;
}
.term { font-family: 'Lora', serif; font-weight: 600; font-size: clamp(38px, 8vw, 52px); line-height: 1.05; letter-spacing: -.01em; }
.count { font-size: 13px; color: var(--muted); white-space: nowrap; letter-spacing: .03em; }
.term-rule { height: 2px; background: var(--ink); width: 56px; margin: 18px 0 34px; }

.sense { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid var(--rule); }
.sense:first-of-type { border-top: 0; padding-top: 0; }
.sense-no { font-family: 'Lora', serif; font-size: 20px; color: var(--accent); font-weight: 600; line-height: 1.3; min-width: 24px; }
.sense-body { min-width: 0; }
.tag {
  display: inline-block; font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--tag); border: 1px solid var(--rule); border-radius: 100px;
  padding: 2px 10px; margin-bottom: 10px; font-weight: 600;
}
.tag-etiket { color: var(--muted); border-color: currentColor; font-style: italic; letter-spacing: .04em; text-transform: none; }
.def { font-family: 'Lora', serif; font-size: 19px; line-height: 1.55; margin-bottom: 6px; }
.src { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
.src::before { content: "Kaynak — "; color: var(--ink); font-weight: 500; }

@media (max-width: 520px) {
  main.terim .sense { grid-template-columns: 1fr; gap: 8px; }
  .sense-no { min-width: 0; }
}

/* ===== Admin ===== */
main.admin {
  flex: 1; width: 100%; max-width: var(--maxw-admin);
  margin: 0 auto; padding: clamp(24px, 4vw, 40px) clamp(16px, 4vw, 32px);
  display: grid; gap: 28px;
}
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: clamp(18px, 3vw, 26px); }
.card h2 { font-family: 'Lora', serif; font-weight: 600; font-size: 19px; margin-bottom: 2px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--tag); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--rule); border-radius: 5px;
  padding: 10px 12px; font-family: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
}
.field textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--tag); background: #fff; }
.field select { cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.btn { border: 0; border-radius: 5px; padding: 10px 20px; font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; letter-spacing: .01em; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--tag); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--rule); }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }
.saved { color: var(--ok); font-size: 13px; font-weight: 500; opacity: 0; transition: opacity .2s; }
.saved.show { opacity: 1; }

.list-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.list-search { flex: 1; min-width: 200px; display: flex; border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; background: var(--paper); }
.list-search input { flex: 1; border: 0; padding: 9px 12px; font-family: inherit; font-size: 14px; background: transparent; color: var(--ink); }
.list-search input:focus { outline: none; }
.list-search:focus-within { border-color: var(--tag); }
.list-count { font-size: 13px; color: var(--muted); white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 10px 10px; border-bottom: 1px solid var(--rule); }
td { padding: 12px 10px; border-bottom: 1px solid var(--rule2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.t-term { font-family: 'Lora', serif; font-weight: 600; font-size: 16px; white-space: nowrap; }
.t-tag { display: inline-block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--tag); border: 1px solid var(--rule); border-radius: 100px; padding: 1px 9px; font-weight: 600; }
.t-src { color: var(--muted); font-size: 13px; max-width: 340px; }
.t-actions { text-align: right; white-space: nowrap; }
.icon-btn { border: 1px solid var(--rule); background: #fff; color: var(--muted); border-radius: 5px; padding: 5px 11px; font-family: inherit; font-size: 13px; cursor: pointer; margin-left: 6px; }
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn.del:hover { color: var(--accent); border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; flex-wrap: wrap; }
.pager .pinfo { font-size: 13px; color: var(--muted); }
.pager .pbtns { display: flex; gap: 8px; }
.pbtn { border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 5px; padding: 7px 14px; font-family: inherit; font-size: 13px; cursor: pointer; }
.pbtn:hover:not([disabled]) { border-color: var(--muted); }
.pbtn[disabled] { color: var(--muted); opacity: .5; cursor: not-allowed; }

@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  .t-src { display: none; }
  .t-actions .lbl { display: none; }
}

/* ===== Admin Login ===== */
main.login {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px clamp(20px, 5vw, 40px);
}
.login-box {
  width: min(360px, 100%); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 8px; padding: 32px 28px;
}
.login-box h1 { font-family: 'Lora', serif; font-size: 22px; margin-bottom: 20px; }
.login-error { color: var(--accent); font-size: 13px; margin-bottom: 14px; }

/* ===== Admin Tab Nav ===== */
.tab-nav {
  display: flex; flex-wrap: wrap; gap: 0;
  border-bottom: 1px solid var(--rule); margin-bottom: 4px;
}
.tab-nav a {
  padding: 10px 18px; font-size: 13px; font-weight: 500; letter-spacing: .02em;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tab-nav a:hover { color: var(--ink); }
.tab-nav a.active,
.tab-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ===== İstatistik Kartları ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 14px; margin-top: 4px; }
.stat-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 18px; }
.stat-card .sc-val { font-family: 'Lora', serif; font-size: 32px; font-weight: 600; line-height: 1; }
.stat-card .sc-lbl { font-size: 12px; color: var(--muted); margin-top: 6px; letter-spacing: .04em; text-transform: uppercase; }

/* ===== Admin extras ===== */
.flash {
  background: #EAF4EE; border: 1px solid #B2D8BE; color: var(--ok);
  border-radius: 6px; padding: 12px 16px; font-size: 14px; font-weight: 500;
  transition: opacity .4s;
}
.flash.hide { opacity: 0; }
.form-meta { font-size: 12px; color: var(--muted); align-self: center; }
.t-durum-aktif { font-size: 11px; font-weight: 600; color: var(--ok); letter-spacing: .04em; text-transform: uppercase; }
.t-durum-gizli { font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
tr.row-gizli td { opacity: .5; }
.pbtn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.list-top-right { display: flex; align-items: center; gap: 14px; }
.entry-date { font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: .01em; }

/* ===== bk. (Bakınız) alanı ===== */
.bk-wrap { position: relative; }
.bk-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 200;
  background: var(--panel); border: 1px solid var(--rule);
  border-top: none; border-radius: 0 0 5px 5px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.bk-item {
  padding: 9px 12px; font-size: 14px; cursor: pointer;
  border-bottom: 1px solid var(--rule2); line-height: 1.4;
}
.bk-item:last-child { border-bottom: none; }
.bk-item:hover { background: var(--paper); }
.bk-hint { color: var(--muted); font-size: 12px; }
.bk-empty { padding: 9px 12px; font-size: 13px; color: var(--muted); }
.bk-selected { font-size: 12px; color: var(--ok); margin-top: 4px; display: block; min-height: 16px; }
.lbl-opt { font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 11px; }

/* bk. görünümü — terim sayfası */
.bk-ref { font-family: 'Lora', serif; font-size: 19px; line-height: 1.55; margin-bottom: 6px; }
.bk-ref a { color: var(--tag); text-decoration: underline; text-underline-offset: 2px; }
.bk-ref a:hover { color: var(--accent); }

/* Sense highlight — anchor ile gelince */
@keyframes sense-hl {
  0%, 100% { background: transparent; }
  20%, 80%  { background: rgba(168,67,47,.10); }
}
.sense-flash { animation: sense-hl 1.8s ease both; border-radius: 4px; }

/* ===== Theme Toggle ===== */
.theme-btn {
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
  border-radius: 5px; padding: 5px 10px; cursor: pointer;
  font-size: 12px; font-weight: 500; letter-spacing: .03em; line-height: 1;
  flex-shrink: 0; font-family: inherit;
}
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light,
:root:not([data-theme="light"]):is(:root) .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-icon-dark { display: inline; }
}

/* Dark mode — sabit renk (hardcoded #fff) geçersiz kılma */
[data-theme="dark"] header .search,
[data-theme="dark"] .search-hero,
[data-theme="dark"] .list-search { background: var(--panel); }
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .pbtn { background: var(--panel); }
[data-theme="dark"] .flash { background: #1A3325; border-color: #2A5040; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) header .search,
  :root:not([data-theme="light"]) .search-hero,
  :root:not([data-theme="light"]) .list-search { background: var(--panel); }
  :root:not([data-theme="light"]) .icon-btn,
  :root:not([data-theme="light"]) .pbtn { background: var(--panel); }
  :root:not([data-theme="light"]) .flash { background: #1A3325; border-color: #2A5040; }
}

/* ===== Focus & Motion ===== */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
