/* ============================================
   SSSR 賽鴿成績公佈網站 - 共用樣式表
   現代化響應式設計
   ============================================ */

/* ---------- CSS 變數 ---------- */
:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --accent: #c0392b;
  --accent-light: #e74c3c;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: all 0.3s ease;
  --header-height: 180px;
  --max-width: 1100px;
}

/* ---------- 基礎重設 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', '微軟正黑體', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 頁首橫幅 ---------- */
.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #3498db 100%);
  color: #fff;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #f39c12, var(--accent));
}

.header-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 32px;
  position: relative;
  z-index: 1;
  text-align: center;
}

.header-content h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 6px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  margin-bottom: 6px;
}

.header-content .subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  letter-spacing: 3px;
  font-weight: 300;
}

.header-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 0.8rem;
  margin-top: 10px;
  backdrop-filter: blur(4px);
}

/* ---------- 主容器 ---------- */
.main-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ---------- 資訊區域（宗旨 + 最新消息） ---------- */
.info-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: var(--transition);
}

.info-card:hover {
  box-shadow: var(--shadow-hover);
}

.info-card h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card h3 .icon {
  font-size: 1.2rem;
}

.info-card ul {
  list-style: none;
  padding: 0;
}

.info-card ul li {
  padding: 5px 0;
  padding-left: 18px;
  position: relative;
  font-size: 0.92rem;
  color: #444;
  line-height: 1.7;
}

.info-card ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 8px;
  background: var(--primary-light);
  border-radius: 50%;
}

.info-card .news-text {
  font-size: 0.92rem;
  color: #444;
  line-height: 1.8;
}

/* ---------- 成績區段卡片 ---------- */
.score-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
  transition: var(--transition);
}

.score-section:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.section-row {
  display: flex;
  align-items: stretch;
  min-height: 56px;
}

.section-label {
  flex: 0 0 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-align: center;
  gap: 6px;
}

.section-label .icon {
  font-size: 1.1rem;
}

.section-links {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.score-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.score-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 82, 118, 0.3);
}

.score-link.highlight {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
  will-change: opacity;
}

.score-link.highlight:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  animation: none;
}

.score-link.small-text {
  font-size: 0.78rem;
  min-width: 70px;
  padding: 6px 10px;
}

.score-link.empty {
  visibility: hidden;
  pointer-events: none;
}

/* Preserve the template's labeled score buttons when that club has not uploaded the PDF yet. */
.score-link.disabled {
  visibility: visible;
  cursor: not-allowed;
  opacity: 0.62;
}

/* Empty alignment cells are intentionally hidden; labeled unavailable items are not. */
.score-link.empty-slot {
  visibility: hidden;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 分隔線（兩行之間） */
.section-row + .section-row {
  border-top: 1px solid #f0f0f0;
}

/* ---------- 頁尾 ---------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto 40px;
  padding: 0 16px;
}

.footer-content {
  background: linear-gradient(135deg, #34495e, #2c3e50);
  color: #bdc3c7;
  border-radius: var(--radius);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

.footer-content .contact {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-content .version {
  color: #e74c3c;
  font-size: 0.8rem;
}

/* ---------- 自動更新狀態列 ---------- */
.refresh-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(44, 62, 80, 0.95);
  color: #ecf0f1;
  padding: 8px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.refresh-bar .dot {
  width: 8px;
  height: 8px;
  background: #2ecc71;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.refresh-bar .countdown {
  font-variant-numeric: tabular-nums;
}

/* ---------- 響應式設計 ---------- */

/* 平板 */
@media (max-width: 768px) {
  :root {
    --header-height: 140px;
  }

  .header-content h1 {
    font-size: 1.8rem;
    letter-spacing: 3px;
  }

  .header-content .subtitle {
    font-size: 0.95rem;
  }

  .info-section {
    grid-template-columns: 1fr;
  }

  .section-row {
    flex-direction: column;
  }

  .section-label {
    flex: none;
    padding: 10px 16px;
    justify-content: flex-start;
  }

  .section-links {
    padding: 10px 12px;
  }

  .score-link {
    flex: 1 1 calc(33.33% - 8px);
    min-width: 80px;
    text-align: center;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-content .contact {
    justify-content: center;
  }
}

/* 手機 */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .header-content h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }

  .header-content .subtitle {
    font-size: 0.85rem;
  }

  .section-label {
    font-size: 0.95rem;
  }

  .score-link {
    flex: 1 1 calc(50% - 8px);
    min-width: 70px;
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .main-container {
    padding: 16px 10px 80px;
  }
}

/* ---------- 站點列表首頁 ---------- */
.home-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a5276, #2980b9, #3498db);
  padding: 40px 20px;
}

.home-title {
  color: #fff;
  font-size: 2rem;
  letter-spacing: 4px;
  margin-bottom: 40px;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 800px;
  width: 100%;
}

.home-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.home-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.home-card h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.home-card p {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ---------- 有底部更新列時給 body 加 padding ---------- */
body.has-refresh-bar {
  padding-bottom: 44px;
}
