/* MakerTube — Estilos modulares para Barra de Filtros Unificada y Header de Usuario */

/* Botón / Chip de usuario en header */
.header-user-box {
  display: inline-flex;
  align-items: center;
}
.header-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  white-space: nowrap;
}
.header-login-btn:hover {
  border-color: var(--ink);
  background: var(--line);
}
.header-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
  max-width: 190px;
}
.header-user-pill:hover {
  border-color: var(--accent);
}
.header-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.header-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Barra Unificada de Filtros en Inicio (1 sola fila limpia y alineada)
   ========================================================================== */
.home-filters-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.hf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.025);
}

.hf-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.hf-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Garantiza que cada slot y separador esté perfectamente centrado en eje Y */
.hf-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hf-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex-shrink: 0;
}

/* Control segmentado moderno (Formato: Todo / Videos / Shorts y Ámbito) */
.hf-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  height: 36px;
}

.hf-seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  user-select: none;
}

.hf-seg-item:hover {
  color: var(--ink);
}

.hf-seg-item.on {
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

/* Botones desplegables compactos (Categorías e Idioma) */
.lang-drop-wrapper,
.cat-drop-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.hf-drop-trigger,
.cat-drop-trigger.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}

.hf-drop-trigger:hover,
.cat-drop-trigger.chip:hover {
  border-color: var(--muted);
  background: var(--line);
}

.hf-drop-trigger.on,
.cat-drop-trigger.chip.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.hf-chevron,
.cat-chevron {
  transition: transform .18s ease;
  opacity: 0.75;
}

.lang-drop-wrapper.is-open .hf-chevron,
.cat-drop-wrapper.is-open .cat-chevron {
  transform: rotate(180deg);
}

/* Menú Popover de Idioma */
.hf-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 105;
  min-width: 235px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 6px;
  flex-direction: column;
  gap: 2px;
}

:root[data-theme="dark"] .hf-drop-menu {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52);
}

.lang-drop-wrapper.is-open .hf-drop-menu {
  display: flex;
}

.hf-drop-head {
  padding: 5px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 3px;
}

.hf-drop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}

.hf-drop-item:hover {
  background: var(--bg);
}

.hf-drop-item.on {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.hf-drop-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hf-drop-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}

.hf-drop-item.on .hf-drop-count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  border-color: transparent;
}

/* Píldoras de código de idioma (reemplaza banderas rotas en Windows) */
.lang-code-pill {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: var(--line);
  color: var(--ink);
}
.lang-code-pill.is-es {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}
.lang-code-pill.is-fr {
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
}
.lang-code-pill.is-en {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
}
.hf-drop-item.on .lang-code-pill {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}

/* Buscador por Usuario / Creador */
.creator-filter-wrap {
  position: relative;
  min-width: 215px;
  max-width: 270px;
}

.creator-search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 9px 0 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}

.creator-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 79, 224, 0.12);
}

.creator-search-box.has-value {
  border-color: var(--ink);
}

.creator-search-icon {
  color: var(--muted);
  flex-shrink: 0;
  display: inline-flex;
}

.creator-search-input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.creator-search-input::placeholder {
  color: var(--muted);
}

.creator-clear-btn {
  border: 0;
  background: var(--line);
  color: var(--ink);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  display: none;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.creator-search-box.has-value .creator-clear-btn {
  display: grid;
}

.creator-clear-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.creator-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 250px;
  z-index: 105;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 6px;
  max-height: 290px;
  overflow-y: auto;
}

:root[data-theme="dark"] .creator-dropdown {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.52);
}

.creator-filter-wrap.is-open .creator-dropdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.creator-drop-head {
  padding: 5px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 3px;
}

.creator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}

.creator-item:hover {
  background: var(--bg);
}

.creator-item.is-selected {
  background: var(--ink);
  color: var(--bg);
}

.creator-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.creator-item-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.creator-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creator-item-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  flex-shrink: 0;
}

.creator-item.is-selected .creator-item-count {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}

/* Resumen de filtros activos (aparece solo cuando se filtra algo) */
.hf-active-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
}

.hf-active-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.hf-active-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hf-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(31, 79, 224, 0.1);
  color: var(--accent);
  border: 1px solid rgba(31, 79, 224, 0.25);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}

.hf-active-pill:hover {
  background: rgba(31, 79, 224, 0.18);
}

.hf-clear-all {
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.hf-clear-all:hover {
  background: var(--line);
}

/* Micro-etiqueta de idioma en tarjetas / reproductor / studio */
.vid-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--line);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

@media (max-width: 860px) {
  .hf-toolbar {
    padding: 8px;
    gap: 8px;
  }
  .hf-toolbar-left {
    width: 100%;
    gap: 6px;
  }
  .hf-slot {
    max-width: 100%;
  }
  .hf-seg {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .hf-seg::-webkit-scrollbar {
    display: none;
  }
  .hf-divider {
    display: none;
  }
  .hf-toolbar-right {
    width: 100%;
    margin-left: 0;
  }
  .creator-filter-wrap {
    max-width: 100%;
    width: 100%;
  }
  .creator-dropdown,
  .hf-drop-menu {
    left: 0;
    right: auto;
    max-width: calc(100vw - 28px);
  }
  .header-user-name {
    display: none;
  }
  .header-user-pill {
    padding: 3px;
  }
}
