/* KNSDD - Gruplar sayfası: filtre çubuğu ve tablo arası düzen */

#knsdd-status-management .knsdd-filters {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  grid-auto-flow: row dense; /* konteyner genişliğine göre satır satır doldur */
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px; /* tablo başlığından nefes */
  /* Sıra: Search | StatusLabel | Status | SortLabel | Sort | AdvLabel | Adv */
  grid-template-columns:
    minmax(220px, 0.8fr)
    fit-content(120px) minmax(170px, 0.5fr)
    fit-content(120px) minmax(230px, 1.5fr)
    fit-content(120px) minmax(250px, 1.5fr);
  overflow: visible; /* dropdown'ın görünmesi için */
}

/* Etiketler sabit genişlik ve taşma yönetimi */
#knsdd-status-management .knsdd-filters .knsdd-filter-label {
  display: inline-block;
  text-align: right;
  white-space: normal; /* uzun dillerde 2 satıra inebilir */
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(10px, 0.95vw, 12px); /* biraz daha küçük etiket yazısı */
}

/* Arama genişleyecek, fakat toplam sıranın yaklaşık yarısını kaplasın */
#knsdd-status-management .knsdd-filters input[type="search"] {
  min-width: 160px;
  width: 100%;
  max-width: none; /* kolon genişliği kadar büyüsün */
  margin: 0;
}

#knsdd-status-management .knsdd-filters select {
  width: 100%;
  min-width: 150px;
  margin: 0; /* WP varsayılan marjları sıfırla */
}

/* Select2 konteyneri her zaman kolon genişliğini kullansın */
#knsdd-status-management .knsdd-filters .select2-container {
  width: 100% !important;
}

/* Grid olduğu için genişlikler minmax ile kontrol ediliyor; ekstra sabit genişliğe gerek yok. */

/* Sayfalama kontrolleri */
.knsdd-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.knsdd-pagination-info {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.knsdd-pagination-controls {
  display: flex;
  gap: 4px;
}

.knsdd-pagination-controls .button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 16px;
  line-height: 1;
}

.knsdd-pagination-controls .button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive sayfalama */
@media (max-width: 782px) {
  .knsdd-pagination {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}

/* Taban görünüm: WP admin ile uyumlu border, bg ve gölge */
#knsdd-status-management .knsdd-filters input[type="search"],
#knsdd-status-management .knsdd-filters select,
#knsdd-status-management .knsdd-filters .select2-selection {
  outline: none;
  border: 1px solid #8c8f94;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
  border-radius: 3px;
  font-size: 13px;
  box-sizing: border-box; /* taşmaları engelle */
}

/* WebKit arama inputu */
#knsdd-status-management .knsdd-filters input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  height: 32px;
  padding: 4px 8px;
}

/* Arama kutusundaki X (clear) butonu */
#knsdd-status-management .knsdd-filters input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
  filter: brightness(0) saturate(100%) invert(25%) sepia(93%) saturate(1352%) hue-rotate(188deg) brightness(85%) contrast(95%);
}

#knsdd-status-management .knsdd-filters input[type="search"]::-webkit-search-cancel-button:hover {
  filter: brightness(0) saturate(100%) invert(25%) sepia(93%) saturate(1352%) hue-rotate(188deg) brightness(85%) contrast(95%) opacity(0.8);
}

/* Focus durumları */
#knsdd-status-management .knsdd-filters input[type="search"]:focus,
#knsdd-status-management .knsdd-filters input[type="search"]:focus-visible,
#knsdd-status-management .knsdd-filters select:focus,
#knsdd-status-management .knsdd-filters select:focus-visible,
#knsdd-status-management .knsdd-filters .select2-selection:focus,
#knsdd-status-management .knsdd-filters .select2-container--open .select2-selection--single {
  outline: none !important;
  border-color: #2271b1;
  box-shadow: none;
}

/* Select2 */
#knsdd-status-management .knsdd-filters .select2-container--default .select2-selection--single {
  height: 32px;
  display: flex;
  align-items: center;
  border: 1px solid #8c8f94;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
  border-radius: 3px;
}

/* Select yükseklik */
#knsdd-status-management .knsdd-filters select {
  height: 32px;
  padding: 2px 28px 2px 8px;
}

/* Select ok simgesi */
#knsdd-status-management .knsdd-filters select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2350575e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
#knsdd-status-management .knsdd-filters select:hover { border-color: #2271b1; background-color: #f6f7f7; }
#knsdd-status-management .knsdd-filters select:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232271b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
}

/* Durum filtresi - özel checkbox dropdown */
.knsdd-status-filter-wrapper {
  position: relative;
  width: 100%;
  min-width: 150px;
}

.knsdd-status-filter-button {
  width: 100%;
  height: 32px;
  padding: 2px 28px 2px 8px;
  border: 1px solid #8c8f94;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2350575e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>") no-repeat right 8px center;
  background-size: 12px 12px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
  border-radius: 3px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.knsdd-status-filter-button:hover { border-color: #2271b1; background-color: #f6f7f7; }
.knsdd-status-filter-button:focus,
.knsdd-status-filter-button:focus-visible { outline: none; border-color: #2271b1; box-shadow: none; }
.knsdd-status-filter-button:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232271b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
}
.knsdd-status-filter-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.knsdd-status-filter-arrow { display: none; }

.knsdd-status-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: #f0f0f1;
  border: 1px solid #8c8f94;
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 99999;
  max-height: 250px;
  overflow-y: auto;
}

.knsdd-status-filter-option {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #2c3338;
  background-color: #f0f0f1;
}

.knsdd-status-filter-option:hover {
background-color: #2271b1;
color: #fff;
}
.knsdd-status-filter-option:first-child { font-weight: 500; }

/* Seçimleri Temizle */
.knsdd-status-filter-clear { color: #2c3338; }
.knsdd-status-filter-clear span::before {
  content: '✕ ';
  color: #dc3545;
  font-weight: bold;
  margin-right: 2px;
  font-size: 11px;
}
.knsdd-status-filter-clear:hover { background-color: #f0f0f1; color: #2c3338; }
.knsdd-status-filter-clear:hover span::before { color: #dc3545; }

.knsdd-status-filter-checkbox-item {
  padding-right: 8px;
}

.knsdd-status-filter-checkbox-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.knsdd-status-filter-checkbox-item span {
  flex: 1;
  margin-right: 8px;
}

/* Çok dar ekranlarda (ör. <1100px) kırılmaya izin ver ve alt satıra geçsin */
@media (max-width: 1100px) {
  #knsdd-status-management .knsdd-filters {
    grid-auto-flow: row;
    grid-template-columns: 1fr; /* küçük ekranda alt alta */
  }
  #knsdd-status-management .knsdd-filters .knsdd-filter-label {
    text-align: left;
  }
}

/* Orta genişlikte daha erken rahatlama */
@media (max-width: 1280px) and (min-width: 1101px) {
  #knsdd-status-management .knsdd-filters {
    grid-template-columns:
      minmax(180px, 1fr)
      minmax(70px, 120px) minmax(140px, 210px)
      minmax(70px, 130px) minmax(150px, 230px)
      minmax(70px, 130px) minmax(150px, 230px);
  }
}
