/* ============================================================
   universitetler.html — universities catalog page
   ============================================================ */

/* ===== Filter pills row ===== */
.ul-filter-panel {
  padding-top: 0;
  padding-bottom: 0;
  background: transparent;
  box-shadow: none;
}
.ul-filter-wrap {
  background: #fff;
  border-radius: var(--r-card);
  padding: 24px 28px;
  box-shadow: 0 4px 14px rgba(26, 26, 77, 0.06);
}

/* ===== Search bar (above filter pills) ===== */
.ul-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 52px;
  background: rgba(91, 79, 207, 0.05);
  border: 1.5px solid transparent;
  border-radius: 999px;
  transition: background 200ms, border-color 200ms, box-shadow 200ms;
  margin-bottom: 18px;
}
.ul-search:focus-within {
  background: #fff;
  border-color: rgba(91, 79, 207, 0.35);
  box-shadow: 0 0 0 4px rgba(91, 79, 207, 0.10);
}
.ul-search > svg {
  width: 20px;
  height: 20px;
  color: var(--ink);
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 200ms;
}
.ul-search:focus-within > svg {
  opacity: 0.85;
  color: var(--brand);
}
.ul-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.ul-search input::placeholder {
  color: var(--ink);
  opacity: 0.45;
  font-weight: 400;
}
/* Hide native search clear "X" — we provide our own */
.ul-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.ul-search-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(26, 26, 77, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 200ms;
}
.ul-search-clear:hover {
  background: rgba(26, 26, 77, 0.16);
}
.ul-search-clear svg {
  width: 12px;
  height: 12px;
  color: var(--ink);
  opacity: 0.7;
}
.ul-search-clear[hidden] {
  display: none;
}

.ul-search-count {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  flex-shrink: 0;
  padding-left: 4px;
  border-left: 1px solid rgba(26, 26, 77, 0.10);
  margin-left: 4px;
  padding-left: 14px;
}
.ul-search-count[hidden] {
  display: none;
}

@media (max-width: 700px) {
  .ul-search {
    height: 46px;
    padding: 0 14px;
    gap: 10px;
  }
  .ul-search > svg { width: 18px; height: 18px; }
  .ul-search input { font-size: 0.875rem; }
  .ul-search-count { display: none; }
}

/* ===== Search row + filter toggle =====
   On desktop the toggle is hidden and country pills always show inline.
   On mobile the toggle reveals/hides the pill list with a smooth height
   animation, so the page above the cards stays compact. */
.ul-search-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.ul-search-row .ul-search { flex: 1; min-width: 0; }

.ul-filter-toggle {
  display: none;            /* hidden on desktop — pills always visible */
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  background: transparent;  /* no pill chrome — just the icon */
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  opacity: 0.7;
  transition: opacity 200ms, color 200ms;
}
.ul-filter-toggle svg {
  width: 22px;
  height: 22px;
  transition: transform 320ms var(--ease-out);
}
.ul-filter-toggle:hover {
  opacity: 1;
  color: var(--brand);
}
.ul-filter-toggle[aria-expanded="true"] {
  opacity: 1;
  color: var(--brand);
}
.ul-filter-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Collapsible wrapper around the pill list. On desktop it's static; on
   mobile we animate max-height for the open/close transition. */
.ul-filters-collapse {
  margin-top: 14px;
}

.ul-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.ul-filter-loading {
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  opacity: 0.5;
  padding: 12px;
}

.ul-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--inner);
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  transition: all 200ms var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.ul-pill:hover {
  background: var(--brand-soft);
  transform: translateY(-1px);
}
.ul-pill.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 4px 12px rgba(91, 79, 207, 0.18);
}
.ul-pill-flag {
  font-size: 1.0625rem;
  line-height: 1;
}
.ul-pill-count {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink);
  min-width: 28px;
  text-align: center;
}
.ul-pill.is-active .ul-pill-count {
  background: var(--brand-gradient);
  color: #fff;
}
.ul-pill-label {
  font-weight: 600;
}

/* ===== Card grid ===== */
.ul-grid-panel {
  margin-top: 24px;
  background: transparent;
  box-shadow: none;
  padding: 0;
  /* base .panel sets overflow:hidden — bu, hover-də qalxan kartın yuxarısını
     kəsir. Grid paneli şəffaf olduğundan overflow-u açırıq. */
  overflow: visible;
}
.ul-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.ul-empty {
  text-align: center;
  padding: 80px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  opacity: 0.6;
  background: #fff;
  border-radius: var(--r-card);
}

/* ===== Load more button (icon-only) =====
   A minimal circular button with a chevron-down icon. Tapping it reveals
   the next page of cards. Branded soft-purple background on hover. */
.ul-load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}
.ul-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26, 26, 77, 0.06);
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    border-color 220ms,
    background 200ms,
    color 200ms;
}
.ul-load-more svg {
  width: 22px;
  height: 22px;
  transition: transform 220ms var(--ease-out);
}
.ul-load-more:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(91, 79, 207, 0.18);
  border-color: rgba(91, 79, 207, 0.35);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.ul-load-more:hover svg {
  transform: translateY(2px);
}
.ul-load-more:active {
  transform: translateY(0);
}

/* ===== University card ===== */
.ul-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 22px 24px;
  background: #fff;
  border-radius: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 14px rgba(26, 26, 77, 0.06);
  transition: transform 240ms var(--ease-out), box-shadow 240ms var(--ease-out);
  animation: ulCardIn 420ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
  overflow: hidden;
}
@keyframes ulCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards appended via "Daha çox göstər" — softer, longer fade with a gentle
   upward drift. Existing cards above stay completely still (no re-render),
   and the new ones ease in one after another with a 35ms stagger. */
.ul-card.ul-card--enter {
  animation: ulCardEnter 560ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  will-change: opacity, transform;
}
@keyframes ulCardEnter {
  0%   { opacity: 0; transform: translateY(20px) scale(0.98); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ul-card,
  .ul-card.ul-card--enter {
    animation: none;
  }
}
.ul-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(26, 26, 77, 0.12);
}

.ul-card-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(0, 0, 0, 0.08) 100%);
  background-blend-mode: overlay;
}
/* Image variant: white card hosting transparent PNG; subtle border */
.ul-card-logo--img {
  background: #fff;
  background-image: none;
  border: 1px solid rgba(26, 26, 77, 0.08);
  padding: 6px;
  box-sizing: border-box;
}
.ul-card-logo--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ul-card-logo-text {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ul-card-body {
  min-width: 0;
}
.ul-card-country {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ul-card-flag {
  font-size: 0.9375rem;
  line-height: 1;
}
.ul-card-country-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ul-card-dtp {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  color: #92400E;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid #FCD34D;
  margin-left: 4px;
}
.ul-card-dtp svg { width: 9px; height: 9px; }

.ul-card-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
  line-height: 1.3;
  /* Bütün kartlar eyni hündürlükdə olsun deyə ad dəqiq 2 sətrə kilidlənir */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.ul-card-loc {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--ink);
  opacity: 0.6;
  margin: 0 0 10px 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ul-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px; /* teqsiz kartlar da eyni yer tutsun → vahid hündürlük */
}

.ul-card-arrow {
  position: absolute;
  bottom: 22px;
  right: 24px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.125rem;
  color: var(--ink);
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
}
.ul-card:hover .ul-card-arrow {
  opacity: 1;
  color: var(--brand);
  transform: translateX(3px);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .ul-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .ul-grid { grid-template-columns: 1fr; gap: 14px; }
  /* Symmetric padding so search bar sits visually centred when filters
     are collapsed. Vertical 12px matches the breathing room around the
     search field's own internal padding. */
  .ul-filter-wrap { padding: 12px 14px; }

  /* Show the toggle button only on mobile — its purpose is to reveal
     the country pills, which are hidden by default to keep the page short. */
  .ul-filter-toggle { display: inline-flex; }

  /* Collapsed by default: pills hidden behind a max-height clip with
     smooth open/close animation. When the user taps the toggle, JS
     flips aria-expanded on the toggle and adds .is-open here. */
  .ul-filters-collapse {
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    transition: max-height 360ms var(--ease-out), margin-top 200ms ease;
  }
  .ul-filters-collapse.is-open {
    max-height: 1200px;     /* generous cap — fits all 24+ country pills */
    margin-top: 14px;
  }

  /* Tighter gaps + smaller pills so country filters fit ~3 per row instead
     of 2. Keeps long names like "Birləşmiş Krallıq" readable but compact. */
  .ul-filter-row { gap: 6px; }
  .ul-pill {
    padding: 5px 10px 5px 5px;
    font-size: 0.75rem;
    gap: 5px;
  }
  .ul-pill-flag {
    width: 22px;
    height: 22px;
    font-size: 0.875rem;
  }
  .ul-pill-count {
    font-size: 0.6875rem;
    padding: 1px 5px;
    min-width: 20px;
  }
  .ul-pill-label { font-weight: 600; }
  .ul-card { padding: 18px 18px; gap: 14px; }
  .ul-card-logo { width: 48px; height: 48px; border-radius: 12px; }
  .ul-card-logo-text { font-size: 1rem; }
  .ul-card-arrow { display: none; }
}
