/* ============================================
   SHARED FEATURES — Search, Rating/Tags, Back-to-Top
   ============================================ */

/* ---------- Logo Override ---------- */
.logo img {
  width: auto !important;
  height: 36px !important;
  border-radius: 0 !important;
  object-fit: contain;
}

/* ---------- Search Bar ---------- */
.search-wrapper {
  position: relative;
}

.search-toggle {
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
}

.search-toggle:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.search-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  background: #15151a;
  border: 2px solid rgba(0, 255, 255, 0.2);
  border-radius: 12px;
  display: none;
  z-index: 200;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 255, 255, 0.08);
  overflow: hidden;
  animation: searchSlideIn 0.2s ease-out;
}

@keyframes searchSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-dropdown.active {
  display: block;
}

.search-input-wrap {
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  color: var(--text);
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.06);
}

.search-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0;
}

.search-results::-webkit-scrollbar {
  width: 4px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.65rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}

.search-result-item:hover {
  background: rgba(0, 255, 255, 0.06);
}

.search-result-item .result-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.search-result-item .result-info {
  flex: 1;
  min-width: 0;
}

.search-result-item .result-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .result-tags {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.search-result-item .result-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.search-result-item .result-rating {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.search-no-results {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* ---------- Rating & Tags Info Bar ---------- */
.game-info-bar {
  background: linear-gradient(180deg, #1a1a1f, #141417);
  padding: 0.6rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1000px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.game-rating {
  display: flex;
  align-items: center;
  gap: 10px;
}

.star-rating {
  display: flex;
  gap: 2px;
}

.star-rating .star {
  cursor: pointer;
  font-size: 1.25rem;
  color: #2a2a30;
  transition: color 0.12s, transform 0.12s, text-shadow 0.12s;
  user-select: none;
  line-height: 1;
}

.star-rating .star:hover {
  transform: scale(1.25);
}

.star-rating .star.filled {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.4);
}

.star-rating .star.hover-fill {
  color: var(--gold);
  opacity: 0.65;
}

.rating-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.rating-score {
  font-size: 0.95rem;
  color: var(--gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: 'Exo 2', sans-serif;
}

.rating-count {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.game-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.game-tag.tag-arcade {
  background: rgba(0, 255, 255, 0.08);
  color: #00e5e5;
  border-color: rgba(0, 255, 255, 0.2);
}

.game-tag.tag-rhythm {
  background: rgba(255, 140, 0, 0.08);
  color: #ff8c00;
  border-color: rgba(255, 140, 0, 0.2);
}

.game-tag.tag-platformer {
  background: rgba(0, 255, 0, 0.08);
  color: #00dd00;
  border-color: rgba(0, 255, 0, 0.2);
}

.game-tag.tag-extreme {
  background: rgba(255, 50, 50, 0.08);
  color: #ff4444;
  border-color: rgba(255, 50, 50, 0.2);
}

.game-tag.tag-free {
  background: rgba(255, 204, 0, 0.08);
  color: #e5b800;
  border-color: rgba(255, 204, 0, 0.2);
}

.game-tag.tag-adventure {
  background: rgba(160, 100, 255, 0.08);
  color: #b080ff;
  border-color: rgba(160, 100, 255, 0.2);
}

.game-tag.tag-challenge {
  background: rgba(255, 80, 80, 0.08);
  color: #ff5050;
  border-color: rgba(255, 80, 80, 0.2);
}

.game-tag.tag-ice {
  background: rgba(100, 200, 255, 0.08);
  color: #64c8ff;
  border-color: rgba(100, 200, 255, 0.2);
}

.game-tag.tag-speed {
  background: rgba(255, 80, 80, 0.08);
  color: #ff5050;
  border-color: rgba(255, 80, 80, 0.2);
}

.game-tag:hover {
  filter: brightness(1.3);
  transform: translateY(-1px);
}

/* ---------- Back to Top Button ---------- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--cyan, #00ffff);
  color: #000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 99;
  box-shadow:
    0 4px 16px rgba(0, 255, 255, 0.25),
    0 4px 0 rgba(0, 0, 0, 0.3);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  stroke-width: 3;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  background: var(--gold, #ffcc00);
  box-shadow:
    0 6px 20px rgba(255, 204, 0, 0.3),
    0 4px 0 rgba(0, 0, 0, 0.3);
  transform: translateY(-3px) scale(1.05);
}

.back-to-top:active {
  transform: translateY(2px) scale(0.95);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

/* Pulse animation on first appearance */
@keyframes bttPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 255, 255, 0.25), 0 4px 0 rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 4px 24px rgba(0, 255, 255, 0.5), 0 4px 0 rgba(0, 0, 0, 0.3); }
}

.back-to-top.pulse {
  animation: bttPulse 1.5s ease-in-out 1;
}

/* ---------- Lite YouTube Embed ---------- */
.yt-lite {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  background-color: #111;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  margin: 1.5rem auto 2rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.2s;
}

.yt-lite:hover {
  border-color: var(--cyan, #00ffff);
}

.yt-lite-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.yt-lite:hover .yt-lite-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.yt-lite iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .search-toggle span {
    display: none;
  }

  .search-dropdown {
    width: calc(100vw - 40px);
    right: -60px;
  }

  .game-info-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.8rem;
  }

  .back-to-top {
    bottom: 1.2rem;
    right: 1.2rem;
    width: 42px;
    height: 42px;
  }

  .back-to-top svg {
    width: 18px;
    height: 18px;
  }
}
