/* ==========================================================================
   YKS Tercih — design tokens
   ========================================================================== */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10);
  font-size: 15px;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  -webkit-font-smoothing: antialiased;
}

/* Sayfa icerigi kisa oldugunda (orn. bos Tercih Listesi) footer ekranin
   ortasinda kalmasin diye - her zaman viewport'un altina sabitlenir. */
body {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
header { flex: 0 0 auto; }
.page-content { flex: 1 0 auto; }
footer.footer { flex: 0 0 auto; }

h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
h2 { font-size: 1.4rem; }

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

small, .small { font-size: 0.8rem; }

/* ==========================================================================
   Layout shell
   ========================================================================== */
.app-shell { max-width: 1360px; margin: 0 auto; padding: 0 1.25rem 3rem; width: 100%; }
.navbar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding-top: 0; padding-bottom: 0; width: 100%; }
.footer-inner { padding-bottom: 0; }
.footer-contact {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer-contact a {
  color: var(--brand-dark);
  font-weight: 550;
  text-decoration: none;
}
.footer-contact a:hover { text-decoration: underline; }
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 2000;
  padding: 0.4rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
.seo-faq .accordion-button {
  font-size: 0.92rem;
  font-weight: 600;
}

.navbar {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border);
  box-shadow: none !important;
  padding: 0.65rem 0;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar-brand .brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.85rem; font-weight: 700;
}
.nav-link {
  color: var(--text-muted) !important;
  font-size: 0.85rem;
  font-weight: 550;
  padding: 0.4rem 0.75rem !important;
  border-radius: var(--radius-sm);
  transition: background-color .15s, color .15s;
}
.nav-link:hover { color: var(--text) !important; background: var(--bg); }
.nav-link.active { color: var(--brand) !important; background: var(--brand-soft); }

footer.footer {
  border-top: 1px solid var(--border) !important;
  color: var(--text-faint);
  font-size: 0.78rem;
  padding: 1rem 0;
  margin-top: 2rem;
}

/* ==========================================================================
   Cards / panels
   ========================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: block;
}

/* ==========================================================================
   Form controls
   ========================================================================== */
.form-select, .form-control {
  font-size: 0.85rem;
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
}
.form-select:focus, .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.form-check-label { font-size: 0.83rem; }

.btn { font-size: 0.83rem; font-weight: 550; border-radius: var(--radius-sm); padding: 0.45rem 0.9rem; }
.btn-sm { font-size: 0.76rem; padding: 0.3rem 0.6rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--border-strong); }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-strong); }
.btn-outline-success { color: var(--success); border-color: var(--border-strong); }
.btn-outline-danger { border-color: var(--border-strong); color: var(--danger); }
.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ==========================================================================
   Tom Select — align with the rest of the form
   ========================================================================== */
.ts-wrapper.form-select .ts-control,
.ts-control {
  font-size: 0.85rem;
  border-color: var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 38px;
  box-shadow: none !important;
}
.ts-wrapper.focus .ts-control { border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-soft) !important; }
.ts-control .item {
  background: var(--brand-soft) !important;
  color: var(--brand-dark) !important;
  border: none !important;
  border-radius: 999px !important;
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem !important;
}
.ts-dropdown { font-size: 0.85rem; border-color: var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.ts-dropdown .active { background: var(--brand-soft) !important; color: var(--brand-dark) !important; }

/* ==========================================================================
   Badges / pills
   ========================================================================== */
.badge { font-weight: 550; font-size: 0.7rem; border-radius: 999px; padding: 0.3em 0.65em; }
.badge.bg-secondary { background: var(--bg) !important; color: var(--text-muted) !important; border: 1px solid var(--border); }
.badge.bg-info { background: var(--brand-soft) !important; color: var(--brand-dark) !important; }
.badge.bg-success { background: var(--success-soft) !important; color: #166534 !important; }
.badge.bg-warning { background: var(--warning-soft) !important; color: #92400e !important; }
.badge.bg-light { background: var(--bg) !important; color: var(--text-muted) !important; }

/* ==========================================================================
   Table
   ========================================================================== */
.table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table { font-size: 0.83rem; margin-bottom: 0; }
.table thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}
.table thead th a { color: var(--text-muted); }
.table thead th a:hover { color: var(--brand); }
.table tbody td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: none; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: transparent; }
.table-hover > tbody > tr:hover > * { background-color: var(--bg); }
.table tbody td.td-actions {
  text-align: center;
  vertical-align: middle;
}
.td-actions-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
}
.td-actions-row form {
  display: inline;
  margin: 0;
}
.table tbody td.td-actions .btn-ekle {
  min-width: 7.5rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.83rem;
  font-weight: 550;
}
.table tbody tr.row-eklendi > * {
  background-color: #fff9e6 !important;
}
.table tbody tr.row-eklendi:hover > * {
  background-color: #fff3cc !important;
}
.btn-ozel-kosul {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0.3rem 0.45rem;
}
.ozel-kosul-list {
  padding-left: 1.15rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { --bs-pagination-padding-y: .35rem; --bs-pagination-padding-x: .65rem; }
.page-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-color: var(--border);
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
}
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-link:hover { background: var(--brand-soft); color: var(--brand-dark); }

/* ==========================================================================
   Yerlesme-durumu renk kodlamasi (Tercih Listesi)
   ========================================================================== */
.yerlesme-yuksek > td { background-color: #ecfdf3 !important; }
.yerlesme-olasi > td { background-color: #f2fbf5 !important; }
.yerlesme-sinirda > td { background-color: #fefbea !important; }
.yerlesme-dusuk > td { background-color: transparent !important; }
.tahmini-yerlesme > td { background-color: #d3f8df !important; font-weight: 600; }
.en-yakin-secenek > td { background-color: var(--warning-soft) !important; }
.sira-bozuk > td { background-color: #ffcccc !important; }

.legend-chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.4rem;
  font-size: 0.76rem;
  font-weight: 550;
}
.legend-chip.yerlesme-yuksek { background: #ecfdf3; color: #166534; }
.legend-chip.yerlesme-olasi { background: #f2fbf5; color: #15803d; }
.legend-chip.yerlesme-sinirda { background: #fefbea; color: #92400e; }
.legend-chip.yerlesme-dusuk { background: var(--bg); color: var(--text-muted); }
.legend-chip.tahmini-yerlesme { background: #d3f8df; color: #14532d; }

.admin-login-wrap {
  display: flex;
  justify-content: center;
  padding: 2rem 0 3rem;
}
.admin-login-panel {
  width: 100%;
  max-width: 420px;
}
.admin-row-eksik td {
  background: #fff7ed !important;
}
.admin-sehir-form .form-control {
  font-size: 0.82rem;
}

/* Yukarı çık butonu */
.scroll-top-btn {
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  z-index: 1040;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #7c3aed);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35), 0 2px 6px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(0.92);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.scroll-top-btn:active { transform: scale(0.94); }

@media (min-width: 768px) {
  .scroll-top-btn { right: 1.5rem; bottom: 1.75rem; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */
html { overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }

.toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}
.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.legend-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.25rem; }

@media (max-width: 767.98px) {
  :root { font-size: 15px; }

  body {
    background:
      radial-gradient(1200px 480px at 10% -10%, rgba(79, 70, 229, 0.10), transparent 55%),
      radial-gradient(900px 420px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 50%),
      #eef2f7;
  }

  .app-shell { padding: 0 0.85rem 2rem; }
  .page-content > main { padding-top: 1rem !important; }

  h2 { font-size: 1.28rem; letter-spacing: -0.02em; line-height: 1.25; }
  .text-muted { color: #5b6b7c !important; }

  .panel {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(8px);
  }

  .navbar {
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(10px);
  }
  .navbar-collapse {
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
  }
  .navbar-nav { gap: 0.25rem !important; }
  .nav-link { padding: 0.55rem 0.75rem !important; }

  .filter-actions {
    flex-direction: column-reverse;
  }
  .filter-actions .btn { width: 100%; }

  .toolbar-row { flex-direction: column; align-items: stretch; }
  .toolbar-row > .btn,
  .toolbar-row > a.btn { width: 100%; text-align: center; }
  .toolbar-meta .form-select { width: 100% !important; max-width: none; }

  .input-group { width: 100%; }
  .form-control, .form-select, .ts-wrapper { width: 100%; max-width: 100%; }
  .ts-wrapper.form-select { max-width: 100%; }

  footer.footer { font-size: 0.72rem; line-height: 1.4; }
  .footer-inner { padding-left: 0.85rem; padding-right: 0.85rem; }

  .pagination { flex-wrap: wrap; justify-content: center; row-gap: 0.25rem; }
  .page-link { padding: 0.45rem 0.65rem; font-weight: 600; }

  /* Tables → stacked cards */
  .table-shell { overflow: visible; border: none; background: transparent; box-shadow: none; }
  .table-responsive { overflow: visible; }
  .table-mobile thead { display: none; }
  .table-mobile,
  .table-mobile tbody { display: block; width: 100%; }
  .table-mobile tr {
    display: block;
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    box-shadow:
      0 1px 2px rgba(15, 23, 42, 0.04),
      0 10px 28px rgba(15, 23, 42, 0.10),
      0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    margin-bottom: 1rem;
    padding: 0.15rem 0 0.2rem;
    overflow: hidden;
  }
  .table-mobile tr::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--brand), #818cf8);
  }
  .table-mobile tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    width: 100%;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    padding: 0.7rem 1rem;
    text-align: right;
    white-space: normal;
    background: transparent !important;
    font-size: 0.95rem;
    font-weight: 550;
    line-height: 1.45;
    color: #0f172a;
  }
  .table-mobile tbody td:nth-child(even) {
    background: rgba(248, 250, 252, 0.72) !important;
  }
  .table-mobile tbody td:last-child { border-bottom: none; }
  .table-mobile tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 38%;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    line-height: 1.35;
    padding-top: 0.15rem;
  }
  .table-mobile tbody td > * { text-align: right; }
  .table-mobile tbody td .text-muted,
  .table-mobile tbody td small.text-muted {
    color: #475569 !important;
    font-size: 0.82rem !important;
    font-weight: 500;
  }
  .table-mobile tbody td[data-label="Bölüm"],
  .table-mobile tbody td[data-label="Üniversite"] {
    font-size: 1rem;
    font-weight: 650;
    color: #0b1220;
  }
  .table-mobile tbody td[data-label="2025 Sıra"],
  .table-mobile tbody td[data-label="2025 Puan"],
  .table-mobile tbody td[data-label="2026 Kont."] {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--brand-dark);
  }
  .table-mobile .badge {
    font-size: 0.72rem;
    padding: 0.35em 0.7em;
    margin-top: 0.2rem;
    display: inline-block;
  }
  .table-mobile tbody td.td-actions {
    justify-content: center;
    align-items: center;
    padding-top: 0.95rem;
    padding-bottom: 1rem;
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.35), rgba(248, 250, 252, 0.9)) !important;
  }
  .table-mobile tbody td.td-actions::before { display: none; }
  .table-mobile tbody td.td-actions .td-actions-row {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  .table-mobile tbody td.td-actions form {
    width: auto;
    display: inline-flex;
    margin: 0;
    text-align: center;
  }
  .table-mobile tbody td.td-actions .btn-ozel-kosul {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    height: 2.6rem;
    padding: 0.4rem 0.55rem;
    margin: 0;
    flex: 0 0 auto;
  }
  .table-mobile tbody td.td-actions .btn-ekle,
  .table-mobile tbody td.td-actions form .btn {
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 650;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.18);
  }
  .table-mobile tbody td.td-actions .btn-outline-danger {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.12);
  }
  .table-mobile .drag-handle { font-size: 1.15rem; padding: 0.25rem; color: #64748b; }

  /* Yerleşme durumu: kart zemin + sol şerit */
  .table-mobile tr.yerlesme-yuksek,
  .table-mobile tr.yerlesme-olasi,
  .table-mobile tr.yerlesme-sinirda,
  .table-mobile tr.yerlesme-dusuk,
  .table-mobile tr.tahmini-yerlesme,
  .table-mobile tr.en-yakin-secenek,
  .table-mobile tr.sira-bozuk { border-left: none; }
  .table-mobile tr.sira-bozuk { background: linear-gradient(180deg, #ffe0e0, #ffcccc); }
  .table-mobile tr.sira-bozuk::before { background: linear-gradient(180deg, #dc2626, #f87171); }
  .table-mobile tr.yerlesme-yuksek { background: linear-gradient(180deg, #f0fdf4, #ecfdf3); }
  .table-mobile tr.yerlesme-yuksek::before { background: linear-gradient(180deg, #16a34a, #4ade80); }
  .table-mobile tr.yerlesme-olasi { background: linear-gradient(180deg, #f7fef9, #f0fdf4); }
  .table-mobile tr.yerlesme-olasi::before { background: linear-gradient(180deg, #22c55e, #86efac); }
  .table-mobile tr.yerlesme-sinirda { background: linear-gradient(180deg, #fffbeb, #fef3c7); }
  .table-mobile tr.yerlesme-sinirda::before { background: linear-gradient(180deg, #d97706, #fbbf24); }
  .table-mobile tr.yerlesme-dusuk::before { background: linear-gradient(180deg, #94a3b8, #cbd5e1); }
  .table-mobile tr.tahmini-yerlesme { background: linear-gradient(180deg, #dcfce7, #bbf7d0); }
  .table-mobile tr.tahmini-yerlesme::before { background: linear-gradient(180deg, #15803d, #22c55e); }
  .table-mobile tr.en-yakin-secenek { background: linear-gradient(180deg, #fff7ed, #ffedd5); }
  .table-mobile tr.en-yakin-secenek::before { background: linear-gradient(180deg, #ea580c, #fb923c); }
  .table-mobile tr.row-eklendi {
    background: linear-gradient(180deg, #fffbeb, #fef9c3) !important;
  }
  .table-mobile tr.row-eklendi::before {
    background: linear-gradient(180deg, #facc15, #fde68a);
  }
  .table-mobile tr.row-eklendi > * {
    background-color: transparent !important;
  }

  .legend-panel { font-size: 0.8rem; line-height: 1.45; }
  .legend-chip { margin-bottom: 0.25rem; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }

  .puan-form .form-control { width: 100% !important; max-width: none !important; }
  .puan-form .btn { flex: 1 1 auto; }
  .action-btns { flex-direction: column; }
  .action-btns .btn { width: 100%; }

  .table-mobile tbody td.td-drag {
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
  }
  .table-mobile tbody td.td-drag::before { content: attr(data-label); }
}

@media (max-width: 575.98px) {
  .app-shell { padding: 0 0.7rem 1.75rem; }
  .table-mobile tr {
    border-radius: 14px;
    margin-bottom: 0.9rem;
    box-shadow:
      0 1px 2px rgba(15, 23, 42, 0.05),
      0 12px 30px rgba(15, 23, 42, 0.12);
  }
  .table-mobile tbody td {
    flex-direction: column;
    align-items: stretch;
    gap: 0.28rem;
    text-align: left;
    padding: 0.75rem 0.95rem;
    font-size: 1rem;
  }
  .table-mobile tbody td::before {
    max-width: none;
    flex-basis: auto;
    font-size: 0.66rem;
    opacity: 0.92;
  }
  .table-mobile tbody td > * { text-align: left; }
  .table-mobile tbody td[data-label="Bölüm"],
  .table-mobile tbody td[data-label="Üniversite"] {
    font-size: 1.05rem;
  }
}
