/* -------------------------------------------------------
   TOF Directory (Coach / Referee / Club)
   - Kurumsal kart görünümü
   - Filtreler: flash yok + doğru kolon dağılımı (boşluk/üst üste binme yok)
   - Foto/Logo: data-type bazlı
   - Load more bar
   - Loader overlay
-------------------------------------------------------- */

.tof-directory {
  --tof-accent: #f58220;
  --tof-bar: #5f6a73;
  --tof-border: rgba(0, 0, 0, .10);
  --tof-soft: rgba(0, 0, 0, .06);
  --tof-text: #222;
  position: relative;
  overflow: visible;
}

/* -------------------------------------------------------
   Filters
-------------------------------------------------------- */
.tof-directory__filters {
  position: relative;
  border: 1px solid var(--tof-border);
  border-top: 10px solid var(--tof-bar);
  background: #fff;
  padding: 16px;
  margin-bottom: 16px;

  display: grid;
  gap: 12px;
  align-items: center;

  /* Default: 3 alan (Ara + Bölge + Kademe/Statü) */
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) minmax(220px, 320px);
}

.tof-directory__filters::before {
  content: "FİLTRELER";
  position: absolute;
  top: -10px;
  left: 14px;
  transform: translateY(-50%);
  background: var(--tof-bar);
  color: #fff;
  padding: 8px 14px;
  font-weight: 500;
  font-family: 'Barlow Condensed';
  letter-spacing: .5px;
  font-size: 14px;
}

.tof-directory__filters input,
.tof-directory__filters select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--tof-border);
  background: #fff;
  color: var(--tof-text);
  border-radius: 4px;
  /* Daha modern hafif yuvarlak kafa */
  outline: none;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.tof-directory__filters input:focus,
.tof-directory__filters select:focus {
  border-color: rgba(245, 130, 32, .6);
  box-shadow: 0 0 0 2px rgba(245, 130, 32, .14);
}

/* -------------------------------------------------------
   Arama Kutusu Düzeni (Input Group Formunda)
-------------------------------------------------------- */
.tof-directory__search-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.tof-directory__search-wrap .tof-directory__q {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.tof-directory__search-btn {
  background: #f8f9fa;
  border: 1px solid var(--tof-border);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  padding: 0 16px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tof-directory__search-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

/* Flash yok: default gizle */
.tof-directory__kademe,
.tof-directory__statu {
  display: none;
}

/* Type'a göre göster */
.tof-directory[data-type="coach"] .tof-directory__kademe {
  display: block;
}

.tof-directory[data-type="referee"] .tof-directory__statu {
  display: block;
}

/* Club: 2 alan (Ara + Bölge) */
.tof-directory[data-type="club"] .tof-directory__filters {
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px);
}

/* Responsive */
@media (max-width: 1100px) {
  .tof-directory__filters {
    grid-template-columns: 1fr 1fr;
  }

  .tof-directory[data-type="club"] .tof-directory__filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .tof-directory__filters {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------
   Grid + Card
-------------------------------------------------------- */
.tof-directory__grid {
  display: grid;
  gap: 14px;
  overflow: visible;
}

/* Default: 4 kolon */
.tof-directory:not([data-type="athlete"]) .tof-directory__grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Athlete: 6 kolon (portrait kart için) */
.tof-directory[data-type="athlete"] .tof-directory__grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1400px) {
  .tof-directory[data-type="athlete"] .tof-directory__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .tof-directory[data-type="athlete"] .tof-directory__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .tof-directory[data-type="athlete"] .tof-directory__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .tof-directory[data-type="athlete"] .tof-directory__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .tof-directory[data-type="athlete"] .tof-directory__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .tof-directory:not([data-type="athlete"]) .tof-directory__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .tof-directory:not([data-type="athlete"]) .tof-directory__grid {
    grid-template-columns: 1fr;
  }
}

.tof-dir__card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--tof-border);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.tof-dir__card:hover {
  border-color: rgba(245, 130, 32, .5);
  box-shadow: 0 2px 10px rgba(245, 130, 32, .15);
}

.tof-dir__avatar {
  flex: 0 0 auto;
}

.tof-dir__meta {
  min-width: 0;
}

.tof-dir__title {
  font-weight: 500;
  text-transform: uppercase;
  font-size: 16px;
  font-family: 'Barlow Condensed';
  line-height: 1.15;
  color: var(--tof-text);
}

.tof-dir__subtitle {
  opacity: .8;
  font-size: 13px;
  margin-top: 4px;

}

/* Badges */
.tof-dir__badges {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tof-dir__badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 2px;
  background: #f2f2f2;
  border-left: 4px solid var(--tof-accent);
  color: rgba(0, 0, 0, .82);
  line-height: 1.2;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* -------------------------------------------------------
   Avatar / Logo
-------------------------------------------------------- */
.tof-dir__avatar img {
  width: 56px;
  height: 56px;
  border-radius: 2px;
  object-fit: cover;
  border: 1px solid var(--tof-soft);
  background: #fff;
  display: block;
}

/* Athlete: dikdörtgen, sadece sol radius */
.tof-directory[data-type="coach"] .tof-dir__avatar img,
.tof-directory[data-type="referee"] .tof-dir__avatar img {
  height: 100px;
  width: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
  border-radius: 12px 0 0 12px;
}

/* Fallback: aspect-ratio yoksa */
@supports not (aspect-ratio: 1 / 1) {

  .tof-directory[data-type="coach"] .tof-dir__avatar img,
  .tof-directory[data-type="referee"] .tof-dir__avatar img {
    width: 80px;
  }
}

/* Club: kare logo */
.tof-directory[data-type="club"] .tof-dir__avatar img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px 0 0 12px;
  background: #fff;
  padding: 6px;
}

/* Responsive grid + avatar */
@media (max-width: 700px) {

  .tof-directory[data-type="coach"] .tof-dir__avatar img,
  .tof-directory[data-type="referee"] .tof-dir__avatar img {
    height: 120px;
  }

  @supports not (aspect-ratio: 1 / 1) {

    .tof-directory[data-type="coach"] .tof-dir__avatar img,
    .tof-directory[data-type="referee"] .tof-dir__avatar img {
      width: 96px;
    }
  }

  .tof-directory[data-type="club"] .tof-dir__avatar img {
    width: 84px;
    height: 84px;
  }
}

/* -------------------------------------------------------
   Load more
-------------------------------------------------------- */
.tof-directory__more {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 0;
  background: var(--tof-accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 14px 0 0;
  gap: 12px;
}

.tof-directory__more::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
}

.tof-directory__more:hover {
  filter: brightness(0.95);
}

.tof-directory__more:disabled {
  opacity: .7;
  cursor: not-allowed;
  filter: none;
}

/* -------------------------------------------------------
   Loader overlay (JS setLoading ile aç/kapat)
-------------------------------------------------------- */
.tof-dir-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.tof-dir-loading.is-on {
  display: flex;
}

.tof-dir-loading span {
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  margin-top: 6px;
}

.tof-dir-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--tof-border);
  color: red;
}

.tof-dir-empty__title {
  font-weight: 500;
  font-size: 26px;
  margin-bottom: 6px;
  font-family: 'Barlow Condensed';
}

.tof-dir-empty__text {
  opacity: .75;
}

/* -------------------------------------------------------
   Athlete - Badge Stilleri (İkonlu)
-------------------------------------------------------- */
.tof-dir__badge img {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}

/* -------------------------------------------------------
   Athlete - Madalya Göstergesi
-------------------------------------------------------- */
.tof-dir__medals {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  /* Kart yüksekliğini kısmak için 8px'ten 4px'e düşürüldü */
  flex-wrap: nowrap;
  /* Madalyalar tek satır olacak */
  align-items: center;
  justify-content: center;
}

.tof-dir__medals .medal-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.tof-dir__medals .medal-gold {
  background: #fef9c3;
  color: #854d0e;
}

.tof-dir__medals .medal-silver {
  background: #f1f5f9;
  color: #475569;
}

.tof-dir__medals .medal-bronze {
  background: #fef3c7;
  color: #92400e;
}

/* -------------------------------------------------------
   Tooltip Stilleri (Ortak / Genel Kullanım)
-------------------------------------------------------- */
.tof-tooltip {
  position: relative;
  cursor: pointer;
  display: inline-flex;
}

.tof-tooltiptext {
  visibility: hidden;
  position: absolute;
  width: max-content;
  max-width: 260px;
  background-color: #1f2937;
  color: #f9fafb;
  text-align: center;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 100;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  white-space: normal;
}

/* Küçük Ok (Arrow) */
.tof-tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.tof-tooltip:hover .tof-tooltiptext {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Madalya Özel Tooltip Kalıtımları */
.tof-dir__medals .tof-tooltiptext {
  width: 180px;
  max-width: 180px;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
}

.tof-dir__medals .tof-tooltip:hover .tof-tooltiptext {
  transform: translateX(-50%) translateY(0);
}

.tof-dir__medals .tof-tooltiptext::after {
  left: 50%;
  margin-left: -6px;
}

.tof-dir__medals .tof-tooltiptext strong {
  display: block;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #374151;
}

/* -------------------------------------------------------
   ATHLETE: Portrait Kart Tasarımı (Yeni - 1:1 Kare + Grid)
-------------------------------------------------------- */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  overflow: visible;
  background: #f9fafb;
  /* Default arka plan rengi */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  min-height: 330px;
  height: 100%;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none;
}

/* Zebra Renklendirme (Tek numaralı kartlar beyaz, çift numaralı kartlar gri) */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete:nth-child(odd) {
  background: #ffffff;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Foto - 4:5 oranı + object-fit contain/cover */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__avatar {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 8px;
  /* Önceden 10px */
  padding: 16px;
  box-sizing: border-box;
  position: relative;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Olympian Badge - Avatar Sağ Alt Köşe */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__avatar img.tof-dir__olympian-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  position: absolute;
  bottom: 12px;
  right: 12px;
  object-fit: contain;
  background: #fff;
  /* SVG logosu şeffaf olabileceği için kontrast oluşturur */
  padding: 2px;
}

/* İkonların Avatardan hemen sonraki hali */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__icon-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 6px;
  margin: -16px auto 10px;
  /* Avatar'ın üstüne biraz daha fazla binip arayı daraltsın */
  /* Avatar'ın üstüne binmesi ve tam ortalanması için */
  position: relative;
  z-index: 10;
}

/* İkonlar (yay türü/cinsiyet) */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--icons {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  gap: 6px;
  padding: 0;
  min-height: 32px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--icons .tof-dir__badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  padding: 0 !important;
  border-left: none !important;
  min-height: 0 !important;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--icons .tof-dir__badge img {
  width: 18px;
  height: 18px;
  min-width: 18px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Sadece SVG dosyası olan ikonlar tüm badge (32px) alanını doldursun */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--icons .tof-dir__badge img[src$=".svg"] {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

/* Rozetler - foto altında, ortada */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--inline {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  min-height: 28px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--inline .tof-dir__badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badges--inline .tof-dir__badge img {
  width: 12px;
  height: 12px;
}

/* İsim */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__name {
  font-weight: 500;
  font-size: 15px;
  /* Okunabilirliği 1 tık artırmak için */
  text-align: center;
  padding: 0 0 12px;
  color: #111827;
  font-family: system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
  word-wrap: break-word;
  display: block;
  width: 100%;
  margin: 0 auto;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__name strong {
  font-weight: 900;
}

/* Ayıraç Çizgisi */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__divider {
  width: 100%;
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
  /* Kartı küçültmek için boşluğu daralttık */
}

/* İkon renkleri */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.yay-klasik,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.recurve {
  background: #0ea5e9;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.yay-makarali,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.compound {
  background: #ef4444;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.cinsiyet-kadin,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.female {
  background: #ec4899;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.cinsiyet-erkek,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.male,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.ge_male {
  background: #3b82f6;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.badge-milli,
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.millisporcu {
  background: #dc2626;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.badge-tohm {
  background: #eab308;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.badge-paralimpik {
  background: #6366f1;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__badge.badge-olimpik-havuz {
  background: #8b5cf6;
}

/* Alt bilgi bloğu (Zebra Kart Tasarımı, Etiket ve Veri yan yana) */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__info {
  padding: 0;
  background: transparent;
  border-top: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #4b5563;
  padding: 0;
  line-height: 1.4;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__info-label {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: #1f2937;
  gap: 6px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__info-label i {
  color: #1f2937;
  width: 14px;
  text-align: center;
  font-size: 14px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__info-value {
  color: #4b5563;
  padding-left: 20px;
}

/* Madalya Görselleri (SVG) */
.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__medals {
  display: flex;
  justify-content: flex-start;
  padding: 12px 0 0;
  background: transparent;
  border-top: none;
  margin-top: auto;
  position: relative;
  /* tooltip için */
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__medals-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tof-directory[data-type="athlete"] .tof-dir__card--athlete .tof-dir__medal-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Grid - eşit yükseklik (redundant blocks clean up) */
.tof-directory[data-type="athlete"] .tof-directory__grid {
  display: grid;
  grid-auto-rows: 1fr;
  overflow: visible;
}