/* === Favorites Overlay === */
.favorites-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(14, 14, 14, 0.95);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1rem;
  overflow-y: auto;
}

.favorites-overlay.active {
  display: flex;
}

.favorites-overlay h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #fff;
  text-align: center;
}

#favorites-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 700px;
}

.team-btn {
  background: #222;
  border: 2px solid transparent;
  padding: 0.6rem;
  text-align: center;
  border-radius: 0.5rem;
  transition: 0.3s;
  cursor: pointer;
}

.team-btn img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 0.4rem;
}

.team-btn span {
  display: block;
  font-size: 0.85rem;
  color: #eee;
  word-break: break-word;
}

.team-btn.selected {
  border-color: #00ffcc;
  background: #333;
}

#closeFavorites {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: transparent;
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}
/* === Favorite Team Display === */
/* === Favorite Team Display === */
.favorite-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: #111;
  border-bottom: 1px solid #333;
}

.favorite-display.hidden {
  display: none;
}

.favorite-display img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.favorite-display #favorite-name {
  font-size: 1.2rem;
  color: #00ffcc;
}

#changeFavoriteBtn {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}
/* Ensure the overlay content is a flex container that stays on screen */
.overlay-content {
    max-height: 85vh; /* 85% of screen height */
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 450px;
}

/* Make ONLY the teams list scrollable */
#favorites-content {
    flex-grow: 1;
    overflow-y: auto; /* Enable scrolling */
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 10px;
    padding-right: 5px; /* Space for scrollbar */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}
/* --- Floating Gold Glow Badge (Top Right) --- */
#favorite-display {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 10px;
    /* Glassmorphism background */
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 14px 6px 8px;
    border-radius: 50px; /* Perfectly Rounded Pill */
    border: none; /* ❌ No border lines */
    /* ✨ Gold Shadow Glow */
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3), inset 0 0 5px rgba(255, 215, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#favorite-display:hover {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

#favorite-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#favorite-name {
    color: #ffd700; /* Gold Text */
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* Hide legacy elements */
#changeFavoriteBtn { display: none !important; }

/* --- Tray UI (Gold Glow & Scrollable) --- */
.favorites-overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.favorites-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    width: 92%;
    max-width: 420px;
    max-height: 75vh;
    background: #0d0d0d;
    border: none; /* ❌ Colorless Edges */
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* ✨ Soft outer glow for the tray */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.15);
}

#favorites-content {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 25px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

#favorites-content::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

.team-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border-radius: 20px;
    border: none; /* ❌ Colorless */
    transition: all 0.3s ease;
    background: transparent;
}

.team-btn img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.team-btn span {
    font-size: 0.7rem;
    color: #efefef;
    margin-top: 10px;
    text-align: center;
    font-weight: 500;
}

/* ✨ Selected State with Glow */
.team-btn.selected {
    background: rgba(255, 215, 0, 0.12);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.35); /* Glow instead of border */
    transform: translateY(-4px);
}

.team-btn.selected img {
    transform: scale(1.1);
}

#closeFavorites {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 16px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Gold Loader */
.loader-gold {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 215, 0, 0.1);
    border-top: 3px solid #ffd700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Mobile optimization */
@media (max-width: 400px) {
    #favorite-name { display: none; }
    #favorite-display { padding: 8px; }
    #favorites-content { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 15px; }
}
#favorite-display {
position: fixed;
top: 14px;
right: 14px;
z-index: 1001;
display: flex;
align-items: center;
gap: 10px;
background: rgba(15, 15, 15, 0.6);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
padding: 6px 12px;
border-radius: 50px;
border: none;
box-shadow: 0 0 15px rgba(255, 215, 0, 0.3), inset 0 0 5px rgba(255, 215, 0, 0.1);
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#favorite-logo {
width: 26px;
height: 26px;
object-fit: contain;
display: block;
margin: auto;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
