/*
 * VIDEO DISCOVERY
 * A Uiverse-inspired soft search field adapted to the existing Sim Village
 * cream, olive and oxblood design tokens.
 */

.video-library {
  position: relative;
}

.video-discovery {
  display: grid;
  grid-template-columns: minmax(230px, 340px) auto;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: -12px 0 30px;
}

.video-search {
  position: relative;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 94%, var(--sand));
  box-shadow: 0 8px 24px rgba(53, 64, 39, 0.06);
  transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}

.video-search:focus-within {
  border-color: color-mix(in srgb, var(--olive) 72%, transparent);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(82, 96, 59, 0.12), 0 10px 28px rgba(53, 64, 39, 0.08);
}

.video-search-icon {
  position: relative;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin-left: 18px;
  border: 2px solid var(--olive-dark);
  border-radius: 50%;
  opacity: 0.78;
}

.video-search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--olive-dark);
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.video-search-field {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 44px 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 650 0.9rem/1 var(--sans);
  appearance: none;
}

.video-search-field::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  opacity: 1;
}

.video-search-field::-webkit-search-cancel-button {
  display: none;
}

.video-search-clear {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--olive-dark);
  cursor: pointer;
}

.video-search-clear span::before,
.video-search-clear span::after {
  position: absolute;
  top: 15px;
  left: 10px;
  width: 12px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.video-search-clear span::before {
  transform: rotate(45deg);
}

.video-search-clear span::after {
  transform: rotate(-45deg);
}

.video-results {
  min-width: 92px;
  margin: 0;
  color: var(--muted);
  font: 750 0.72rem/1.2 var(--sans);
  text-align: right;
  white-space: nowrap;
}

.story-slide[hidden] {
  display: none !important;
}

.video-empty-state {
  min-height: 250px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  text-align: center;
}

.video-empty-state[hidden] {
  display: none;
}

.video-empty-state p {
  margin: 0;
  color: var(--muted);
}

.video-empty-state button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--olive);
  border-radius: 999px;
  background: transparent;
  color: var(--olive-dark);
  font: 800 0.78rem/1 var(--sans);
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .video-search-clear:hover,
  .video-empty-state button:hover {
    color: var(--oxblood);
  }

  .video-empty-state button:hover {
    border-color: var(--oxblood);
    background: rgba(123, 48, 43, 0.05);
  }
}

@media (max-width: 980px) {
  .video-discovery {
    grid-template-columns: minmax(220px, 340px) auto;
  }
}

@media (max-width: 680px) {
  .video-discovery {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 10px;
    margin: -14px 0 24px;
    padding: 12px;
    border: 1px solid rgba(37, 38, 31, 0.12);
    border-radius: 20px;
    background: rgba(255, 253, 247, 0.62);
    box-shadow: 0 12px 30px rgba(53, 64, 39, 0.05);
  }

  .video-results {
    grid-column: auto;
    padding-inline: 5px;
  }

  .video-search,
  .video-search-field {
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-search,
  .video-empty-state button {
    transition: none;
  }
}
