/* search.css — página de búsqueda. */

.search-page {
  max-width: 620px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-3) var(--sp-10);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Input ── */
.search-form {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--sp-3) 0;
  background: var(--bg-page);
  margin: 0 calc(var(--sp-3) * -1);
  padding-left: var(--sp-3);
  padding-right: var(--sp-3);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-radius: var(--r-full);
  border: 1px solid transparent;
  padding: 0 var(--sp-3);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.search-input-wrap:focus-within {
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  background: var(--bg-card);
}

.search-input-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary, #8a8f98);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 12px var(--sp-3);
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font: inherit;
  font-size: .95em;
}
.search-input::placeholder {
  color: var(--text-secondary, #8a8f98);
}
.search-input:focus { outline: none; }
.search-input::-webkit-search-cancel-button { display: none; }

.search-clear {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--bg-hover, rgba(128,128,128,.18));
  color: var(--text-secondary, #8a8f98);
  font-size: 1.1em;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* ── Tabs ── */
.search-tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid rgba(128, 128, 128, .14);
  padding-bottom: var(--sp-2);
}

.search-tab {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-full);
  color: var(--text-secondary, #8a8f98);
  font-weight: 500;
  font-size: .92em;
  text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.search-tab:hover { color: var(--text-primary); }
.search-tab.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ── Lista de usuarios ── */
.search-users {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur) var(--ease);
}
.search-user:hover {
  background: var(--bg-elevated);
}

.search-user-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1em;
  box-shadow: 0 0 0 1px rgba(128, 128, 128, .18);
}
.search-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-user-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-user-line {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.search-user-name {
  font-weight: 600;
  font-size: .96em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-user-badge {
  font-size: .7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  color: var(--accent);
}

.search-user-handle {
  font-size: .86em;
  color: var(--text-secondary, #8a8f98);
}

.search-user-bio {
  font-size: .86em;
  color: var(--text-secondary, #8a8f98);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  margin-top: 2px;
}

/* ── Posts ── */
.search-posts {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Empty states ── */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
}

.search-empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--bg-elevated);
  color: var(--text-secondary, #8a8f98);
  margin-bottom: var(--sp-2);
}
.search-empty-icon svg {
  width: 28px;
  height: 28px;
}

.search-empty-title {
  margin: 0;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-primary);
}

.search-empty-desc {
  margin: 0;
  font-size: .92em;
  color: var(--text-secondary, #8a8f98);
  max-width: 340px;
  line-height: 1.5;
}
.search-empty-desc strong { color: var(--text-primary); }

/* ── Autocompletado (suggest) ── */
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color, rgba(128,128,128,.18));
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  padding: var(--sp-1);
  z-index: 30;
  max-height: 360px;
  overflow-y: auto;
}

.search-suggest-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur) var(--ease);
}
.search-suggest-item:hover,
.search-suggest-item.is-active {
  background: var(--bg-hover);
}

.search-suggest-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: .9em;
  box-shadow: 0 0 0 1px rgba(128, 128, 128, .18);
}
.search-suggest-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-suggest-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.search-suggest-name {
  font-weight: 600;
  font-size: .92em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-suggest-handle {
  font-size: .82em;
  color: var(--text-secondary, #8a8f98);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-suggest-badge {
  font-size: .68em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .search-user-bio { display: none; }
  .search-user-avatar { width: 42px; height: 42px; }
  .search-suggest { max-height: 300px; }
}