/* =========================================================
   Difsan — modern uygulama arayüzü
   Standart: kontrol 52px, tutarlı boşluk, net hiyerarşi
   ========================================================= */

:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f1f5f9;
  --bg-mesh-1: #ccfbf1;
  --bg-mesh-2: #e0f2fe;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-ink: #f0fdfa;
  --accent-soft: #ccfbf1;
  --accent-ring: rgba(15, 118, 110, 0.22);
  --ok: #15803d;
  --bad: #dc2626;
  --sidebar: #0b1220;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --sidebar-active: #134e4a;
  --sidebar-hover: rgba(255, 255, 255, 0.06);

  --control-h: 52px;
  --control-radius: 14px;
  --control-pad-x: 1.05rem;
  --control-fs: 1rem;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
  --font: "Sora", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar-w: 272px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at -10% -10%, var(--bg-mesh-1), transparent 55%),
    radial-gradient(800px 480px at 110% 0%, var(--bg-mesh-2), transparent 50%),
    var(--bg);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Sidebar (koyu, modern) ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 1.35rem 0.9rem 1rem;
  background: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand,
.brand-desk {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: #f8fafc;
  text-decoration: none;
  line-height: 1.3;
  margin: 0.15rem 0.75rem 1.4rem;
}
.brand:hover,
.brand-desk:hover { color: #fff; }
.brand-desk { display: block; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
}
.nav-label {
  margin: 1rem 0.9rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}
.side-nav > .nav-label:first-child { margin-top: 0.15rem; }

.side-nav a,
.side-account-link {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0.7rem 0.95rem;
  margin: 0 0.2rem;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.side-nav a:hover,
.side-account-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.side-nav a.active,
.side-account-link.active {
  background: linear-gradient(135deg, #115e59, #0f766e);
  color: #f0fdfa;
  font-weight: 650;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.25);
}
.side-account {
  flex-shrink: 0;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.nav-logout:hover {
  background: rgba(220, 38, 38, 0.15) !important;
  color: #fca5a5 !important;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  padding: 2rem 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-inner {
  flex: 1 0 auto;
  width: 100%;
}
.main-full {
  max-width: none;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  min-height: 100vh;
}
.main-full .main-inner { width: 100%; }
.auth-body { display: block; }
.auth-body .main { display: grid; min-height: 100vh; }

/* Footer yalnızca içerik kolonunda — sol menüye yapışmaz */
.site-footer {
  flex: 0 0 auto;
  margin-top: 2.5rem;
  padding: 1rem 0 0.25rem;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: none;
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
}
.site-footer p {
  margin: 0;
  line-height: 1.45;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.8vw, 2.2rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
  font-weight: 700;
  color: var(--ink);
}
h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  font-weight: 650;
}
h3 { margin: 1.25rem 0 0.6rem; font-size: 1.02rem; }
.lede {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 40rem;
}
.hint { color: var(--muted); margin: 0 0 1rem; font-size: 0.95rem; line-height: 1.5; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.92rem; }

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 0.65rem; flex-wrap: wrap; align-items: center; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--control-h);
  padding: 0 1.3rem;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  border-color: transparent;
  color: #fff;
}
.btn-danger {
  background: #fff;
  border-color: #fca5a5;
  color: var(--bad);
}
.btn-danger:hover {
  background: #fef2f2;
  border-color: var(--bad);
  color: var(--bad);
}
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  min-height: 44px;
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ---------- Forms ---------- */
.fields, .stack { display: flex; flex-direction: column; gap: 1.1rem; }
.stack { margin-top: 1.35rem; }

label,
.pw-label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="tel"],
input[type="url"],
input:not([type]),
select,
textarea,
.pw-field .pw-input,
.filter-bar input,
.filter-bar select,
.captcha-answer {
  width: 100%;
  min-height: var(--control-h);
  padding: 0.85rem var(--control-pad-x);
  border: 1.5px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--control-fs);
  font-weight: 500;
  line-height: 1.35;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 128px;
  resize: vertical;
  padding-top: 1rem;
}

select {
  background-color: var(--panel);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.4rem) calc(50% - 0.15rem),
    calc(100% - 1rem) calc(50% - 0.15rem);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.8rem;
  cursor: pointer;
}

input:hover, select:hover, textarea:hover, .pw-field .pw-input:hover {
  border-color: var(--line-strong);
}
input:focus, select:focus, textarea:focus, .pw-field .pw-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
input::placeholder, textarea::placeholder { color: #94a3b8; font-weight: 450; }

.row-2, .row-3 { display: grid; gap: 1rem; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: repeat(3, 1fr); }

fieldset { border: none; margin: 0; padding: 0; }
legend { font-weight: 650; margin-bottom: 0.65rem; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}
.check-grid.provinces {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  max-height: 320px;
  overflow: auto;
  padding: 0.85rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--control-radius);
  background: var(--panel-2);
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  font-weight: 550;
  min-height: 50px;
  padding: 0.7rem 0.95rem;
  border: 1.5px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--panel);
  cursor: pointer;
  color: var(--ink);
}
.check:hover { border-color: var(--accent); background: var(--accent-soft); }
.check.inline {
  border: none;
  background: transparent;
  padding: 0.2rem 0;
  min-height: auto;
  width: fit-content;
}
.check input {
  width: 1.15rem;
  height: 1.15rem;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions { margin-top: 0.75rem; }
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 1rem 0 0.35rem;
  background: linear-gradient(transparent, var(--bg) 40%);
}

/* ---------- Auth (split modern) ---------- */
.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border-radius: 28px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 560px;
}
.auth-visual {
  position: relative;
  padding: 2.5rem 2.2rem;
  background:
    radial-gradient(500px 320px at 20% 20%, rgba(45, 212, 191, 0.35), transparent 60%),
    radial-gradient(420px 280px at 80% 80%, rgba(56, 189, 248, 0.28), transparent 55%),
    linear-gradient(160deg, #0f172a, #134e4a 70%, #0f766e);
  color: #ecfeff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.auth-visual .brand-mark {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
  margin: 0 0 0.75rem;
}
.auth-visual p {
  margin: 0;
  color: rgba(236, 254, 255, 0.82);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 22rem;
}
.auth-wrap, .login-wrap { width: min(980px, 100%); }
.auth-panel, .login-panel {
  padding: 2.4rem 2.1rem;
  background: var(--panel);
}
.auth-panel h1, .login-panel h1 {
  font-size: 1.85rem;
}
.auth-footer { margin-top: 1.35rem; text-align: center; font-size: 0.95rem; }
.tiny { font-size: 0.8rem; margin-top: 0.85rem; }
.req { color: var(--bad); }

/* fallback if old structure */
.auth-body .auth-wrap:not(:has(.auth-shell)) .auth-panel {
  width: min(440px, 100%);
  margin: 0 auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- Panels / stats / cards ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.seed-block,
.provinces-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.25rem 0 0.5rem;
}
.provinces-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.provinces-head h3 { margin: 0; }
.provinces-all {
  padding: 0.45rem 0.75rem !important;
  border: 1.5px solid var(--line) !important;
  border-radius: 12px !important;
  background: var(--panel) !important;
}
.info-box {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid #99f6e4;
  background: #f0fdfa;
  color: #134e4a;
}
.info-box p { margin: 0 0 0.55rem; font-size: 0.94rem; line-height: 1.5; font-weight: 500; }
.info-box p:last-child { margin-bottom: 0; }
.info-box-title {
  font-weight: 700 !important;
  font-size: 0.98rem !important;
  margin-bottom: 0.45rem !important;
  color: #0f766e;
}

.scan-help { margin-bottom: 1.1rem; }
.scan-status {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  font-weight: 550;
}
.scan-status.is-running {
  background: var(--accent-soft);
  border-color: #5eead4;
  color: #115e59;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: 0.7;
}
.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  position: relative;
  z-index: 1;
}
.stat strong {
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
}
.card-list { display: grid; gap: 0.85rem; }
.m-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.m-card:hover {
  border-color: #99f6e4;
  transform: translateY(-1px);
}
.m-card.tight { padding: 0.9rem 1rem; }
.m-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.td-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  white-space: nowrap;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.94rem;
  box-shadow: var(--shadow);
}
.table th, .table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  background: var(--panel-2);
  font-weight: 650;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.mono { font-family: var(--mono); font-size: 0.86rem; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.bad { background: #fee2e2; color: var(--bad); }
.score-high { background: #166534; color: #fff; }
.score-good { background: #15803d; color: #fff; }
.score-mid { background: #c2410c; color: #fff; }
.score-low { background: #64748b; color: #fff; }
.err-cell { color: var(--bad); max-width: 280px; word-break: break-word; }

.flashes { margin-bottom: 1.1rem; display: grid; gap: 0.55rem; }
.flash {
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: #fff;
  font-weight: 550;
}
.flash-ok { border-color: #86efac; background: #f0fdf4; color: var(--ok); }
.flash-err { border-color: #fca5a5; background: #fef2f2; color: var(--bad); }

/* Password */
.pw-field { position: relative; display: flex; align-items: center; width: 100%; }
.pw-field .pw-input { padding-right: 3.4rem; }
.pw-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 10px;
  padding: 0;
}
.pw-toggle:hover { color: var(--accent); background: var(--accent-soft); }

/* Captcha */
.captcha-box { display: flex; flex-direction: column; gap: 0.55rem; }
.captcha-hint { margin: 0; font-size: 0.88rem; }
.captcha-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.captcha-img {
  max-width: min(100%, 300px);
  height: auto;
  min-height: 72px;
  border: 1.5px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
}

.filter-bar {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  grid-template-columns: 1fr;
}
.filter-bar .btn { width: 100%; }

.ai-keys h3 { margin: 1.25rem 0 0.55rem; font-size: 1.02rem; color: var(--accent); }
.ai-keys h3:first-child { margin-top: 0.35rem; }
.inline-form { display: inline; }
.done { text-decoration: line-through; opacity: 0.65; }
.extract {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: var(--control-radius);
  padding: 1rem;
  max-height: 280px;
  overflow: auto;
}
.muted-list { color: var(--muted); }
.small { font-size: 0.95rem; }
.bar-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.55rem;
}
.bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #0f766e, #2dd4bf); }

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.nav-toggle {
  border: 1.5px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  width: var(--control-h);
  height: var(--control-h);
  font-size: 1.25rem;
  cursor: pointer;
}
.top-user {
  margin-left: auto;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink-soft);
  text-decoration: none;
}
.top-user:hover { color: var(--accent); }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 45;
}
.nav-backdrop.show { display: block; }
.mobile-only { display: none; }
.desktop-only { display: table; }

@media (max-width: 960px) {
  body { flex-direction: column; }
  .topbar { display: flex; }
  .brand-desk { display: none; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 88vw);
    height: 100vh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .stat-row, .grid-2, .row-2, .row-3 { grid-template-columns: 1fr; }
  .main { padding: 1.15rem 1.1rem 2.75rem; max-width: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .actions { width: 100%; }
  .actions .btn, .inline-actions .btn { flex: 1; }
  .mobile-only { display: grid; }
  .desktop-only { display: none; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-visual { min-height: 180px; padding: 1.75rem 1.5rem; }
  .auth-panel, .login-panel { padding: 1.6rem 1.25rem 1.75rem; }
  input, select, textarea, button, .btn { font-size: 16px; }
}

@media (min-width: 961px) {
  .filter-bar {
    grid-template-columns: 2fr 1.1fr 1.2fr 0.9fr auto auto;
    align-items: center;
  }
  .filter-bar .btn { width: auto; min-width: 120px; }
}
