/* statistics.css - Styles for DXLook Statistics Dashboard */

/* ===== Global & Layout ===== */
/* Override styles.css overflow:hidden for scrollable page */
html, body {
  overflow: auto !important;
  overscroll-behavior: auto !important;
  touch-action: auto !important;
  height: auto !important;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Header ===== */
.stats-header {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  padding: 30px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.stats-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.logo-section {
  flex-shrink: 0;
}

.logo-section a {
  display: block;
  transition: opacity 0.2s ease;
}

.logo-section a:hover {
  opacity: 0.8;
}

.stats-logo {
  width: 80px;
  height: 80px;
  opacity: 0.95;
}

.title-section {
  flex-grow: 1;
}

.title-section h1 {
  margin: 0 0 5px 0;
  font-size: 2rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  font-size: 1rem;
  opacity: 0.9;
}

.nav-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.back-to-map-btn {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-to-map-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.donate-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donate-label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-right: 4px;
}

.donate-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.donate-btn.paypal {
  background: linear-gradient(135deg, #ffd96a 0%, #ffb400 100%);
  color: #333;
}

.donate-btn.paypal:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.donate-btn.stripe {
  background: linear-gradient(135deg, #ffd96a 0%, #ffb400 100%);
  color: #333;
}

.donate-btn.stripe:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.update-section {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.update-label {
  font-size: 0.85rem;
  opacity: 0.85;
}

.update-time {
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
}

.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  opacity: 0.85;
}

.refresh-dot {
  width: 8px;
  height: 8px;
  background-color: #4CAF50;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

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

/* ===== Main Content ===== */
.stats-main {
  padding: 40px 20px;
}

.stats-section {
  margin-bottom: 40px;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 0 0 5px 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c3e50;
}

.section-subtitle {
  margin: 0;
  font-size: 1rem;
  color: #666;
}

/* ===== Cards ===== */
.stats-card {
  background: white;
  border-radius: 8px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== Data Source Activity ===== */
.total-spots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 6px;
}

.total-label {
  font-size: 1.2rem;
  font-weight: 600;
  color: #495057;
}

.total-number {
  font-size: 2rem;
  font-weight: 700;
  color: #4A90E2;
  font-family: 'Monaco', 'Courier New', monospace;
}

.source-table-container {
  overflow-x: auto;
}

.source-table {
  width: 100%;
  border-collapse: collapse;
}

.source-table thead {
  background-color: #f8f9fa;
}

.source-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}

.source-table td {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
}

.source-table tbody tr:hover {
  background-color: #f8f9fa;
}

.source-name {
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #2c3e50;
}

.spot-count {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 600;
  color: #4A90E2;
}

.activity-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-bar {
  height: 20px;
  background: linear-gradient(90deg, #4A90E2 0%, #357ABD 100%);
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.activity-percentage {
  font-size: 0.9rem;
  color: #666;
  min-width: 45px;
}

.trend {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 600;
  font-size: 0.95rem;
}

.trend.up {
  color: #28a745;
}

.trend.down {
  color: #dc3545;
}

.trend.neutral {
  color: #6c757d;
}

/* ===== Tabs ===== */
.tab-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 24px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background-color: #f8f9fa;
  border-color: #4A90E2;
}

.tab-btn.active {
  background-color: #4A90E2;
  color: white;
  border-color: #4A90E2;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Mode Filter ===== */
.mode-filter {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mode-btn {
  padding: 8px 16px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  filter: brightness(0.95);
}

.mode-btn.active {
  color: white;
}

.mode-btn[data-mode="all"].active {
  background-color: #6c757d;
  border-color: #6c757d;
}

.mode-btn[data-mode="digital"].active {
  background-color: #5AA1CF;
  border-color: #5AA1CF;
}

.mode-btn[data-mode="cw"].active {
  background-color: #5DC2B4;
  border-color: #5DC2B4;
}

.mode-btn[data-mode="ssb"].active {
  background-color: #F9BB4B;
  border-color: #F9BB4B;
}

/* ===== Leaderboard Tables ===== */
.leaderboard-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead {
  background-color: #f8f9fa;
}

.leaderboard-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}

.leaderboard-table .rank-col {
  width: 60px;
  text-align: center;
}

.leaderboard-table td {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
}

.leaderboard-table tbody tr:hover {
  background-color: #f8f9fa;
}

.rank-badge {
  display: inline-block;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
}

.rank-badge.gold {
  background-color: #FFD700;
  color: #333;
}

.rank-badge.silver {
  background-color: #C0C0C0;
  color: #333;
}

.rank-badge.bronze {
  background-color: #CD7F32;
  color: white;
}

.rank-badge.other {
  background-color: #e9ecef;
  color: #495057;
}

.callsign-link {
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #4A90E2;
  text-decoration: none;
}

.callsign-link:hover {
  text-decoration: underline;
}

.last-seen {
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
}

.loading-cell {
  text-align: center;
  padding: 40px !important;
  color: #999;
  font-style: italic;
}

/* ===== CTA Box ===== */
.cta-box {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 6px;
  text-align: center;
}

.cta-text {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  color: #495057;
}

.cta-button {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cta-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.cta-button.primary {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
}

.cta-button.secondary {
  background: linear-gradient(135deg, #5DC2B4 0%, #4AA89D 100%);
}

/* ===== CTA Section ===== */
.cta-section {
  margin-top: 50px;
}

.cta-card {
  text-align: center;
  padding: 40px;
}

.cta-card h2 {
  margin: 0 0 15px 0;
  font-size: 2rem;
  color: #2c3e50;
}

.cta-card > p {
  margin: 0 0 25px 0;
  font-size: 1.1rem;
  color: #666;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cta-footer {
  margin: 20px 0 0 0;
  font-size: 1rem;
  color: #999;
  font-style: italic;
}

/* ===== Footer ===== */
.stats-footer {
  background-color: #2c3e50;
  color: white;
  padding: 30px 0;
  margin-top: 60px;
  text-align: center;
}

.stats-footer p {
  margin: 10px 0;
  font-size: 0.95rem;
}

.stats-footer a {
  color: #4A90E2;
  text-decoration: none;
  margin: 0 10px;
}

.stats-footer a:hover {
  text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .stats-header .container {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .stats-logo {
    width: 60px;
    height: 60px;
  }

  .title-section h1 {
    font-size: 1.5rem;
  }

  .nav-section {
    align-items: center;
    width: 100%;
  }

  .back-to-map-btn {
    width: auto;
  }

  .donate-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .update-section {
    align-items: center;
  }

  .section-header h2 {
    font-size: 1.4rem;
  }

  .total-spots {
    flex-direction: column;
    gap: 10px;
  }

  .total-number {
    font-size: 1.5rem;
  }

  .tab-btn {
    font-size: 0.9rem;
    padding: 10px 16px;
  }

  .stats-card {
    padding: 15px;
  }

  .source-table th,
  .source-table td,
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 8px;
    font-size: 0.9rem;
  }

  .cta-card {
    padding: 25px;
  }

  .cta-card h2 {
    font-size: 1.5rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .stats-main {
    padding: 20px 15px;
  }

  .activity-bar-container {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Hide some columns on very small screens */
  .source-table th:nth-child(4),
  .source-table td:nth-child(4) {
    display: none;
  }

  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) {
    display: none;
  }
}
