/* =============================================
   LGS Tercih Robotu Modern UI
   ============================================= */

/* ========== HERO SECTION ========== */
.lgs-hero {
  background: linear-gradient(135deg, rgb(30, 39, 98) 0%, #0d2b4a 50%, #1a1a2e 100%);
  color: #fff;
  padding: 72px 5% 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.lgs-hero::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(194,0,0,.12) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.lgs-hero::after {
  content: "";
  position: absolute;
  bottom: -40%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(251,197,49,.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.lgs-hero__inner {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  animation: lgs-fadeUp .6s ease;
}
.lgs-hero__title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.lgs-hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: #cbd5e1;
  margin: 0 0 28px;
  line-height: 1.7;
  font-weight: 400;
}
.lgs-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #c20000, #e63946);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(194, 0, 0, .3);
  transition: transform .2s, filter .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.lgs-hero__cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80px;
  width: 60px;
  height: 100%;
  background: rgba(255,255,255,.25);
  transform: skewX(-20deg);
  animation: lgs-shine 3s infinite;
}
.lgs-hero__cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 12px 36px rgba(194, 0, 0, .35);
}

.lgs-hero__badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 28px;
}
.lgs-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(4px);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: .3px;
}

/* ========== PAGE LAYOUT (single column, wide) ========== */
.lgs-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 4% 48px;
  display: block;
}
.lgs-main {
  min-width: 0;
  max-width: 100%;
}

/* ========== CARD ========== */
.lgs-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 28px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
  animation: lgs-fadeUp .4s ease;
}
.lgs-card--accent {
  border-top: 3px solid #c20000;
}
#filterCard {
  scroll-margin-top: 90px;
}
.lgs-card__header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}
.lgs-card__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0d2b4a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lgs-card__icon {
  font-size: 1.2rem;
}
.lgs-card__desc {
  margin: 0;
  font-size: .9rem;
  color: #6b7280;
}

/* ========== FORM ========== */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  align-items: end;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: .85rem;
  font-weight: 700;
  color: #374151;
  margin-left: 2px;
}
.form-helper {
  font-size: .75rem;
  color: #9ca3af;
  margin-left: 2px;
  margin-bottom: 2px;
}

.lgs-page input,
.lgs-page select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: .92rem;
  font-family: inherit;
  background: #fafbfc;
  color: #1f2937;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
  height: 44px;
}
.lgs-page input:focus,
.lgs-page select:focus {
  outline: none;
  border-color: #c20000;
  box-shadow: 0 0 0 3px rgba(194,0,0,.10);
  background: #fff;
}
.lgs-page select[multiple] {
  height: 110px;
  padding: 6px;
}
/* Disabled input styling (puan/yüzdelik toggle) */
.lgs-page input.is-disabled,
.lgs-page input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: .6;
}
.range-group {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 6px;
}
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid #f0f0f0;
}

/* ========== BUTTONS ========== */
.lgs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.lgs-btn--primary {
  background: linear-gradient(135deg, #c20000, #e63946);
  color: #fff;
  box-shadow: 0 4px 16px rgba(194,0,0,.18);
  padding: 12px 28px;
  position: relative;
}
.lgs-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(194,0,0,.25);
  filter: brightness(1.06);
}
.lgs-btn--primary .lgs-btn__spinner {
  display: none;
}
.lgs-btn--primary.is-loading .lgs-btn__text {
  opacity: 0;
}
.lgs-btn--primary.is-loading .lgs-btn__spinner {
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lgs-spin .6s linear infinite;
}

.lgs-btn--ghost {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  padding: 12px 28px;
}
.lgs-btn--ghost:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.lgs-btn--outline {
  background: #fff;
  color: #4b5563;
  border: 1.5px solid #d1d5db;
}
.lgs-btn--outline:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.lgs-btn--success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5,150,105,.18);
}
.lgs-btn--success:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.lgs-btn--page {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  padding: 8px 18px;
  font-size: .85rem;
  border-radius: 8px;
}
.lgs-btn--page:hover {
  background: #e5e7eb;
}

.lgs-btn--sm {
  padding: 5px 10px;
  font-size: .78rem;
  border-radius: 6px;
  background: #6b7280;
  color: #fff;
}
.lgs-btn--sm:hover {
  background: #4b5563;
}
.lgs-btn--danger {
  background: #dc2626 !important;
}
.lgs-btn--danger:hover {
  background: #b91c1c !important;
}

/* Keep old btn-ekle / btn-cikar for JS-generated buttons */
button {
  font-family: inherit;
}
.btn-ekle {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(5,150,105,.18);
}
.btn-ekle:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-cikar {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(220,38,38,.18);
}
.btn-cikar:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ========== SEARCH BAR ========== */
.lgs-search-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lgs-search-bar__input-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
  min-width: 200px;
}
.lgs-search-bar__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
}
.lgs-search-bar__input-wrap input {
  padding-left: 40px;
}
.lgs-search-bar__count {
  font-size: .9rem;
  color: #6b7280;
  font-weight: 600;
}
.badge-count {
  display: inline-block;
  background: linear-gradient(135deg, #c20000, #e63946);
  color: #fff;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .3px;
}

/* ========== TABLE ========== */
.lgs-page .table-responsive {
  overflow-x: visible;
  min-height: 200px;
}
.lgs-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  table-layout: auto;
}

/* --- Main table column widths --- */
/* İl | İlçe | Okul | Öğretim | Alan | Süre | Pans. | Mini-tablo | İşlem */
#mainTable { table-layout: fixed; }
#mainTable > thead > tr > th:nth-child(1) { width: 8%; }   /* İl */
#mainTable > thead > tr > th:nth-child(2) { width: 9%; }   /* İlçe */
#mainTable > thead > tr > th:nth-child(3) { width: 17%; }  /* Okul */
#mainTable > thead > tr > th:nth-child(4) { width: 7%; }   /* Öğretim */
#mainTable > thead > tr > th:nth-child(5) { width: 11%; }   /* Alan */
#mainTable > thead > tr > th:nth-child(6) { width: 6%; }   /* Süre */
#mainTable > thead > tr > th:nth-child(7) { width: 6%; }   /* Pans. */
#mainTable > thead > tr > th:nth-child(8) { width: 23%; }  /* Mini-tablo (Yıl/Puan/Yüzde/Kont) */
#mainTable > thead > tr > th:nth-child(9) { width: 7%; }   /* İşlem */

/* Compact Ekle/Çıkar buttons */
.btn-ekle, .btn-cikar {
  padding: 6px 12px;
  font-size: .78rem;
  white-space: nowrap;
}

/* --- Tercih Listesi column widths --- */
/* # | İl | İlçe | Okul | Öğretim | Alan | Puan | Yüzde | Kont. | İşlem */
#prefTable { table-layout: fixed; }
#prefTable > thead > tr > th:nth-child(1)  { width: 4%; }   /* # */
#prefTable > thead > tr > th:nth-child(2)  { width: 10%; }  /* İl */
#prefTable > thead > tr > th:nth-child(3)  { width: 12%; }  /* İlçe */
#prefTable > thead > tr > th:nth-child(4)  { width: 24%; }  /* Okul */
#prefTable > thead > tr > th:nth-child(5)  { width: 8%; }   /* Öğretim */
#prefTable > thead > tr > th:nth-child(6)  { width: 8%; }   /* Alan */
#prefTable > thead > tr > th:nth-child(7)  { width: 8%; }   /* Puan */
#prefTable > thead > tr > th:nth-child(8)  { width: 7%; }   /* Yüzde */
#prefTable > thead > tr > th:nth-child(9)  { width: 6%; }   /* Kont. */
#prefTable > thead > tr > th:nth-child(10) { width: 13%; }  /* İşlem */
.lgs-page th {
  font-weight: 700;
  color: #374151;
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
  user-select: none;
  white-space: normal;
  vertical-align: middle;
  position: sticky;
  top: 0;
  z-index: 5;
}
.lgs-page th:hover {
  background: #f0f4f8;
  color: #0d2b4a;
}
.lgs-page td {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px;
  text-align: left;
  vertical-align: middle;
  color: #374151;
  white-space: normal;
  word-break: break-word;
}

/* Zebra rows */
#sonucBody tr:nth-child(even),
#tercihBody tr:nth-child(even) {
  background: #fafbfc;
}
#sonucBody tr:hover,
#tercihBody tr:hover {
  background: #f0f7ff;
  transition: background .15s;
}

/* Sort icons */
.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: #9ca3af;
}
th.sorted-asc .sort-icon::after { content: "▲"; color: #c20000; }
th.sorted-desc .sort-icon::after { content: "▼"; color: #c20000; }

/* ========== MINI TABLE (year breakdown) ========== */
.mini-tablo {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  table-layout: auto;
}
.col-yil  { width: 22%; text-align: center; }
.col-puan { width: 28%; text-align: center; }
.col-yuzde { width: 28%; text-align: center; }
.col-kont { width: 22%; text-align: center; }

.header-mini th {
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  font-size: .82rem;
  font-weight: 700;
  color: #374151;
  text-transform: none;
  padding: 12px 4px;
  text-align: center;
}

.mini-tablo td {
  padding: 5px;
  border-bottom: 1px solid rgba(0,0,0,.04);
  text-align: center;
}

/* Year row colors */
.row-2025 { background-color: #dcfce7; color: #166534; }
.row-2024 { background-color: #fee2e2; color: #991b1b; }
.row-2023 { background-color: #dbeafe; color: #1e3a8a; }
.row-2022 { background-color: #ffedd5; color: #9a3412; }
.row-2021 { background-color: #f3e8ff; color: #6b21a8; }

.val-puan  { font-weight: 700; }
.val-yuzde { font-weight: 800; font-size: .84rem; }
.val-kont  { font-style: italic; opacity: 0.75; }

/* ========== YEAR FILTER DROPDOWN ========== */
.yil-dropdown {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
  border-radius: 12px;
  padding: 12px;
  z-index: 1000;
  min-width: 140px;
  text-align: left;
  top: 100%;
  left: 0;
}
.yil-dropdown.show { display: block; }

.yil-option {
  display: flex;
  align-items: center;
  padding: 6px 4px;
  cursor: pointer;
  font-size: .85rem;
  color: #374151;
  border-radius: 6px;
  transition: background .15s;
}
.yil-option:hover { background: #f3f4f6; }
.yil-option input { width: auto; height: auto; margin-right: 8px; cursor: pointer; accent-color: #c20000; }
.filter-icon::after { content: " ▼"; font-size: 10px; }

/* ========== PAGINATION ========== */
.lgs-pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
}
.lgs-page-info {
  padding: 0 14px;
  font-weight: 700;
  font-size: .9rem;
  color: #374151;
}

/* ========== PREFERENCE LIST HEADER ========== */
.lgs-pref-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 36px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.lgs-pref-header__title {
  font-weight: 800;
  color: #0d2b4a;
  font-size: 1.15rem;
}
.lgs-pref-header__actions {
  display: flex;
  gap: 8px;
}

/* ========== TERCIH ACTIONS (buttons inline) ========== */
.tercih-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

/* ========== MOBILE NAVBAR AUTO-HIDE ========== */
.navbar {
  transition: transform .3s ease;
}
.navbar--hidden {
  transform: translateY(-100%);
}

/* (Sidebar removed) */

/* ========== ANIMATIONS ========== */
@keyframes lgs-fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lgs-spin {
  to { transform: rotate(360deg); }
}
@keyframes lgs-shine {
  0%   { left: -90px; }
  40%  { left: 120%; }
  100% { left: 120%; }
}

@media (max-width: 960px) {
  .lgs-page {
    padding: 28px 3% 40px;
  }
}
@media (max-width: 768px) {
  .lgs-hero {
    padding: 52px 5% 40px;
  }
  .lgs-hero__title {
    font-size: 1.8rem;
  }
  .filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .lgs-search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .lgs-search-bar__input-wrap {
    max-width: 100%;
  }
  .lgs-pref-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .button-group {
    flex-direction: column;
  }
  .button-group .lgs-btn {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .lgs-hero__badges {
    flex-direction: column;
    align-items: center;
  }
  td, th {
    padding: 8px 6px;
    font-size: .8rem;
  }

  /* --- PORTRAIT: Sonuç tablosu ---
     Görünen: Okul(3), Mini-tablo(8), İşlem(9)
     Gizlenen: İl(1), İlçe(2), Öğretim(4), Alan(5), Süre(6), Pans(7) */
  #mainTable > thead > tr > th:nth-child(1),
  #mainTable > thead > tr > th:nth-child(2),
  #mainTable > thead > tr > th:nth-child(4),
  #mainTable > thead > tr > th:nth-child(5),
  #mainTable > thead > tr > th:nth-child(6),
  #mainTable > thead > tr > th:nth-child(7),
  #mainTable > tbody > tr > td:nth-child(1),
  #mainTable > tbody > tr > td:nth-child(2),
  #mainTable > tbody > tr > td:nth-child(4),
  #mainTable > tbody > tr > td:nth-child(5),
  #mainTable > tbody > tr > td:nth-child(6),
  #mainTable > tbody > tr > td:nth-child(7) {
    display: none;
  }

  /* --- PORTRAIT: Tercih tablosu ---
     Görünen: Okul(4), Puan(7), Yüzde(8), İşlem(10)
     Gizlenen: #(1), İl(2), İlçe(3), Öğretim(5), Alan(6), Kont(9) */
  #prefTable > thead > tr > th:nth-child(1),
  #prefTable > thead > tr > th:nth-child(2),
  #prefTable > thead > tr > th:nth-child(3),
  #prefTable > thead > tr > th:nth-child(5),
  #prefTable > thead > tr > th:nth-child(6),
  #prefTable > thead > tr > th:nth-child(9),
  #prefTable > tbody > tr > td:nth-child(1),
  #prefTable > tbody > tr > td:nth-child(2),
  #prefTable > tbody > tr > td:nth-child(3),
  #prefTable > tbody > tr > td:nth-child(5),
  #prefTable > tbody > tr > td:nth-child(6),
  #prefTable > tbody > tr > td:nth-child(9) {
    display: none;
  }

  /* Portrait column widths — visible columns get more room */
  #mainTable { table-layout: fixed; }
  #mainTable > thead > tr > th:nth-child(3) { width: 32%; }  /* Okul */
  #mainTable > thead > tr > th:nth-child(8) { width: 54%; }  /* Mini-tablo */
  #mainTable > thead > tr > th:nth-child(9) { width: 14%; }  /* İşlem */

  #prefTable { table-layout: fixed; }
  #prefTable > thead > tr > th:nth-child(4)  { width: 25%; }  /* Okul */
  #prefTable > thead > tr > th:nth-child(7)  { width: 25%; }  /* Puan */
  #prefTable > thead > tr > th:nth-child(8)  { width: 20%; }  /* Yüzde */
  #prefTable > thead > tr > th:nth-child(10) { width: 30%; }  /* İşlem */
}

/* ========== PRINT ========== */
@media print {
  body * { visibility: hidden; }
  #printableArea, #printableArea * { visibility: visible; }
  #printableArea { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
  .lgs-card { border: none; box-shadow: none; }
  .lgs-hero, .tab-buttons { display: none !important; }
}