/* =========================================
   Teams Page Specific Styles
   ========================================= */

/* 1. Page Hero (Smaller than Homepage) */
.page-hero {
  position: relative;
  height: 40vh; /* 比首頁矮 */
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 0;
  color: #fff;
  background: #000;
}

.page-hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.page-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.page-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,70,46,0.8) 0%, rgba(0,0,0,0.4) 100%);
}

.page-hero-content {
  position: relative;
  z-index: 1;
}

.page-hero-content h1 {
  font-size: 3rem;
  margin-bottom: 16px;
  color: #fff;
  text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.page-hero-content p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* 2. Sticky Filter Nav */
.filter-nav {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: var(--header-height); /* 黏在 Header 下方 */
  z-index: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  transition: 0.3s;
}

.filter-container {
  display: flex;
  gap: 10px;
  overflow-x: auto; /* 手機版可橫向捲動 */
  padding: 16px 20px;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}
.filter-container::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome */

.filter-btn {
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f4f6f8;
  border: 1px solid transparent;
  transition: all 0.3s ease; /* 加強過渡效果 */
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.filter-btn:hover::before {
  left: 100%;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30, 174, 96, 0.3);
}


/* 3. Continent Sections */
.continent-header {
  margin-bottom: 40px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 16px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}

.continent-header h2 {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.continent-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Continent Dots */
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-yellow { background: #f9a825; } /* Asia */
.dot-blue { background: #1565c0; }   /* Europe */
.dot-green { background: #2e7d32; }  /* S.America */
.dot-red { background: #c62828; }    /* N.America */

/* 4. Team Card Design */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* RWD Magic */
  gap: 24px;
}

.team-card {
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.team-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-color);
}

/* Flag Area */
.flag-wrapper {
  position: relative;
  width: 100%;
  padding-top: 60%; /* 3:2 Aspect Ratio */
  background: #f0f0f0;
  overflow: hidden;
  border-bottom: 1px solid #f0f0f0;
}

.flag-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.5s;
}

.team-card:hover .flag-wrapper img {
  transform: scale(1.05);
}

/* Badges */
.badge-champ, .badge-host {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.badge-champ { background: var(--secondary); color: #000; }
.badge-champ.gold { background: linear-gradient(135deg, #ffd700, #ffb300); }
.badge-host { background: var(--primary); color: #fff; }

/* Info Area */
.team-info {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.team-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rank {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 4px;
}

.team-info h3 {
  font-size: 1.25rem;
  margin-bottom: 4px;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.team-info h3 small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.btn-text {
  margin-top: 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: 0.2s;
}

.team-card:hover .btn-text {
  color: var(--secondary);
  transform: translateX(4px);
}

/* Highlight Card Style (例如衛冕冠軍) */
.team-card.highlight {
  border: 1px solid var(--secondary);
}

/* 添加非洲和大洋洲的顏色 */
.dot-orange { background: #ff6f00; }  /* Africa */
.dot-cyan { background: #00bcd4; }    /* Oceania */

/* Responsive */
@media (max-width: 768px) {
  .page-hero h1 { font-size: 2.2rem; }
  .teams-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .team-info { padding: 16px; }
  .team-info h3 { font-size: 1.1rem; }
  
  /* Filter Nav 橫向滾動優化 */
  .filter-container {
    padding: 12px 16px;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
  }
  
  .filter-container::-webkit-scrollbar {
    height: 4px;
    display: block;
  }
  
  .filter-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
  }
  
  .filter-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
  }
  
  .filter-btn {
    flex-shrink: 0; /* 防止按鈕縮小 */
    font-size: 0.9rem;
    padding: 10px 18px;
    white-space: nowrap; /* 確保文字不換行 */
    min-width: fit-content;
  }
}

@media (max-width: 480px) {
  .teams-grid { grid-template-columns: 1fr; } /* 手機單欄顯示 */
  .flag-wrapper { padding-top: 50%; } /* 稍微矮一點 */
}