/* Depends on: tokens.css -- linked as separate <link>
   tags by every template that uses this file, NOT @import-ed here.
   @import is a serialized waterfall: the browser cannot discover an
   imported file until it has downloaded and parsed the one importing
   it, so this site's deepest chain (tokens -> nav -> calendar ->
   event_detail) cost four sequential round trips before first paint.
   Separate links are all visible in the initial HTML and download in
   parallel. Templates list dependencies first, so the cascade is
   unchanged -- see core/tests/test_template_lint.py, which fails if
   an @import is reintroduced here. */
/* ---------- Topbar search form + typeahead dropdown ----------
   Included on every page that has a topbar search box. Relies on each page's
   own `.search` pill styling; only adds the wrapper + dropdown. */
.search-form { position: relative; flex: 1; max-width: 460px; display: flex; }

/* On a phone the field gives way to an icon that opens /buscar/. */
.btn-ghost.icon-only.search-icon-link { display: none; }
@media (max-width: 700px) {
  .search-form { display: none; }
  .btn-ghost.icon-only.search-icon-link { display: grid; }
}

@media (max-width: 980px) {
  /* No min-width set above means this flex item's floor defaults to its
     content's own min-content size -- and since .search-form .search
     input already has min-width:0 (can shrink to nothing), that floor is
     really just the magnifying-glass icon + padding, not the full 460px.
     But nav-links (nav.css, same topbar row, same 980px breakpoint) only
     gets that room if this is explicitly told it's allowed to shrink
     that far too -- without this, .search-form's implicit "auto" min-
     width still wins every space negotiation against nav-links' explicit
     min-width:120px, crushing nav-links to 0. Degrades gracefully: down
     to icon-only if the row is genuinely this tight, full-width input if
     there's room. */
  .search-form { min-width: 0; }
}

/* The search pill itself. dashboard/directory/profile also style `.search`
   in their own CSS, but the calendar-shell pages (team, circuit, search
   results) don't -- so define it here to keep the box self-contained and
   stop the magnifying-glass icon from rendering at its intrinsic size. */
.search-form .search {
  flex: 1;
  max-width: none;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 13px;
  color: var(--text-tertiary);
}
.search-form .search svg { width: 15px; height: 15px; flex-shrink: 0; }
.search-form .search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  padding: 1px 2px; /* the browser default these fields always had */
}
.search-form .search input::placeholder { color: var(--text-tertiary); }

.search-drop {
  position: absolute;
  top: calc(100% + 8px);
  /* Anchored to the field's right edge, at least as wide as the field and never
     narrower than 360px: between 700px and 980px the field squeezes to almost
     nothing (see the media query above), and a dropdown as narrow as the field
     was a 2px column nobody could click. */
  left: auto;
  right: 0;
  width: max(100%, min(360px, 92vw));
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.55);
  overflow-y: auto;
  max-height: 420px;
  z-index: 50;
}
.search-drop[hidden] { display: none; }

.sd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover,
.sd-item.active { background: var(--surface-hover); }
.sd-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
}
.sd-av img { width: 100%; height: 100%; object-fit: cover; }
.sd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sd-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-sub {
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.sd-type {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 7px;
  border-radius: 100px;
  flex-shrink: 0;
}
.sd-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--text-tertiary); }

/* ---------- Loading skeleton (shown while a suggest fetch is in flight) ---------- */
.sd-skel-item { display: flex; align-items: center; gap: 11px; padding: 10px 13px; }
.sd-skel-item:last-child { border-bottom: none; }
.skel-bar {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.4s ease infinite;
}
.sd-skel-av.skel-bar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.sd-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.sd-skel-lines .skel-bar:first-child { height: 11px; width: 70%; }
.sd-skel-lines .skel-bar:last-child { height: 9px; width: 40%; }
@keyframes skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@media (max-width: 600px) {
  .search-drop { max-height: 60vh; }
}

/* ---------- Full results page ---------- */
/* The in-page field for phones; the top bar's own field takes over above 700px. */
.sr-mobile-search { display: none; }
@media (max-width: 700px) {
  .sr-mobile-search { display: block; padding-top: 16px; }
  .sr-mobile-search label {
    display: flex; align-items: center; gap: 8px;
    padding: 0 12px; height: 42px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  }
  .sr-mobile-search svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-tertiary); }
  .sr-mobile-search input {
    flex: 1; min-width: 0; background: none; border: 0; outline: 0;
    font: inherit; font-size: 16px; /* 16px: iOS zooms the page on focus below that */
    color: var(--text-primary);
  }
  .sr-mobile-search label:focus-within { border-color: var(--accent-line, var(--accent)); }
}

.sr-head { padding: 30px 0 10px; }
.sr-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.sr-head h1 span { color: var(--accent); }
.sr-head p { font-size: 13.5px; color: var(--text-secondary); margin-top: 7px; }

.sr-group { margin-top: 26px; }
.sr-group-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sr-group-head h2 { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.sr-count { font-size: 12px; color: var(--text-tertiary); font-weight: 600; }

.sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.sr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.sr-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.sr-av {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-secondary);
}
.sr-av.round { border-radius: 50%; }
.sr-av img { width: 100%; height: 100%; object-fit: cover; }
.sr-info { min-width: 0; flex: 1; }
.sr-name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sr-name .check { width: 13px; height: 13px; color: var(--accent); }
.sr-recruiting-dot { font-size: 11px; margin-left: 4px; }
.sr-sub { display: block; font-size: 12px; color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sr-recent { margin: 20px 0 30px; }
.sr-recent-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-tertiary); margin-bottom: 10px;
}
.sr-recent-clear {
  background: none; border: none; color: var(--text-tertiary); font-size: 11.5px;
  font-weight: 600; text-transform: none; letter-spacing: normal; cursor: pointer;
}
.sr-recent-clear:hover { color: var(--accent); }
.sr-recent-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sr-recent-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-secondary);
}
.sr-recent-chip:hover { border-color: var(--accent-line); color: var(--text-primary); }
.sr-trending-chip { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.sr-empty { padding: 50px 20px; text-align: center; }
.sr-empty svg { width: 34px; height: 34px; color: var(--text-tertiary); }
.sr-empty h2 { font-size: 17px; margin-top: 12px; }
.sr-empty p { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
