/* ============================================================================
   LEADERBOARD PAGE STYLES - Nigerian Independence Trivia
   ============================================================================ */

:root {
  /* Nigerian Colors */
  --nigeria-green: #008751;
  --nigeria-white: #FFFFFF;
  --dark-green: #006B3F;
  --light-green: #4CAF50;

  /* Accent Colors */
  --gold: #FFC72C;
  --silver: #C0C0C0;
  --bronze: #CD7F32;

  /* UI Colors */
  --bg-gray: #F8F8FA;
  --text-dark: #1F2937;
  --text-muted: #6B7280;
  --border-gray: #E5E7EB;

  /* Animation Colors */
  --green-glow: rgba(0, 135, 81, 0.3);
  --red-fade: rgba(239, 68, 68, 0.3);
  --yellow-flash: rgba(255, 199, 44, 0.3);
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  color: var(--nigeria-green);
  border: 2px solid var(--nigeria-green);
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.back-button:hover {
  background: var(--nigeria-green);
  color: white;
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(0, 135, 81, 0.2);
}

.header-card {
  background: linear-gradient(135deg, white 0%, #f0fdf4 100%);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--nigeria-green);
}

.header-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--nigeria-green) 0%, var(--light-green) 50%, var(--gold) 100%);
}

.flag-decoration-mini {
  width: 60px;
  height: 40px;
  margin: 0 auto 1rem;
  background: linear-gradient(to right,
    var(--nigeria-green) 33.33%,
    var(--nigeria-white) 33.33%,
    var(--nigeria-white) 66.66%,
    var(--nigeria-green) 66.66%);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--nigeria-green);
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Live Indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 135, 81, 0.1);
  border-radius: 20px;
  border: 1px solid var(--nigeria-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--nigeria-green);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.live-text {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--nigeria-green);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.update-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================================
   STATS OVERVIEW
   ============================================================================ */

.stats-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-gray);
  transition: all 0.3s ease;
}

.stat-box:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 135, 81, 0.15);
}

.stat-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--nigeria-green), var(--light-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================================
   LOADING & ERROR STATES
   ============================================================================ */

.loading-container {
  background: white;
  padding: 4rem 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--border-gray);
  border-top-color: var(--nigeria-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.error-container {
  background: white;
  padding: 3rem 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid #FEE2E2;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.retry-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: var(--nigeria-green);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 135, 81, 0.3);
}

.retry-button:hover {
  background: var(--dark-green);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 135, 81, 0.4);
}

.empty-container {
  background: white;
  padding: 4rem 2rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.empty-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.empty-message {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.empty-button {
  display: inline-block;
  padding: 1rem 2rem;
  background: var(--nigeria-green);
  color: white;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 135, 81, 0.3);
}

.empty-button:hover {
  background: var(--dark-green);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 135, 81, 0.4);
}

/* ============================================================================
   PODIUM SECTION (TOP 3)
   ============================================================================ */

.podium-section {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--nigeria-green);
  text-align: center;
  margin-bottom: 2rem;
}

.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 1.5rem;
  align-items: flex-end;
  padding: 2rem;
  background: linear-gradient(135deg, var(--nigeria-green), var(--dark-green));
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 135, 81, 0.3);
}

.podium-card {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.podium-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* First Place */
.first-place {
  min-height: 240px;
  border: 4px solid var(--gold);
  z-index: 10;
}

.first-place:hover {
  transform: translateY(-8px);
}

/* Second Place */
.second-place {
  min-height: 200px;
  border: 4px solid var(--silver);
}

/* Third Place */
.third-place {
  min-height: 200px;
  border: 4px solid var(--bronze);
}

.podium-rank {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  animation: bounce-in 0.6s ease-out;
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.podium-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.first-place .podium-name {
  font-size: 1.375rem;
}

.podium-score {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--nigeria-green), var(--light-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.first-place .podium-score {
  font-size: 3rem;
  background: linear-gradient(135deg, var(--gold), #FFD700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.podium-details {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Change badge for podium cards only - absolutely positioned */
.podium-card .change-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  animation: badge-pop 0.4s ease-out;
}

@keyframes badge-pop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.podium-card .change-badge.up {
  background: #10B981;
  color: white;
}

.podium-card .change-badge.down {
  background: #EF4444;
  color: white;
}

.podium-card .change-badge.new {
  background: var(--gold);
  color: var(--text-dark);
}

/* ============================================================================
   REMAINING RANKS SECTION
   ============================================================================ */

.remaining-ranks-section {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Desktop Table */
.desktop-table {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(60px + (20 * 70px)); /* Header (60px) + 20 rows (70px each) = ~1460px */
  width: 100%;
  position: relative;
}

.desktop-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.desktop-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #F9FAFB;
}

.table-header {
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: #F9FAFB;
  border-bottom: 2px solid var(--border-gray);
  white-space: nowrap;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table-header:first-child {
  width: 8%;
}

.table-header:nth-child(2) {
  width: 30%;
}

.table-header:nth-child(3) {
  width: 12%;
}

.table-header:nth-child(4) {
  width: 12%;
}

.table-header:nth-child(5) {
  width: 13%;
}

.table-header:nth-child(6) {
  width: 25%;
}

.table-row {
  border-bottom: 1px solid var(--border-gray);
  transition: all 0.3s ease;
  cursor: pointer;
}

.table-row:hover {
  background: #F9FAFB;
  transform: translateX(4px);
}

.table-cell {
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 1rem;
  vertical-align: middle;
}

.rank-cell {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--nigeria-green);
}

.name-cell {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 1.05rem;
}

.score-cell {
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--gold);
}

.rate-cell {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.change-cell {
  text-align: center;
  font-size: 0.875rem;
}

.subsidiary-cell {
  font-size: 0.875rem;
}

/* Subsidiary Capsule/Badge Styling */
.subsidiary-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subsidiary-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Color-coded subsidiaries */
.subsidiary-blackcod {
  background: #2C2C2C;
  color: #FFFFFF;
}

.subsidiary-bluebulb {
  background: #FCD34D;
  color: #1F2937;
}

.subsidiary-bluebulbtech {
  background: #3B82F6;
  color: #FFFFFF;
}

.subsidiary-rabafast {
  background: #A78BFA;
  color: #FFFFFF;
}

.subsidiary-chriborough {
  background: #F97316;
  color: #FFFFFF;
}

.subsidiary-sendova {
  background: #10B981;
  color: #FFFFFF;
}

.subsidiary-buyletlive {
  background: #EC4899;
  color: #FFFFFF;
}

.subsidiary-dealmakers {
  background: #6366F1;
  color: #FFFFFF;
}

.subsidiary-dynasty {
  background: #DC2626;
  color: #FFFFFF;
}

.subsidiary-unknown {
  background: #9CA3AF;
  color: #FFFFFF;
}

/* Change Badge Styling - For table cells (inline display) */
.change-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.3px;
  position: relative; /* Override any absolute positioning */
}

.change-up {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #10B981;
}

.change-down {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #EF4444;
}

.change-new {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #F59E0B;
}

.change-none {
  background: #F3F4F6;
  color: #6B7280;
  border: 1px solid #D1D5DB;
}

/* Mobile List */
.mobile-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-list-item {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-gray);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.mobile-list-item:hover {
  border-color: var(--nigeria-green);
  box-shadow: 0 4px 12px rgba(0, 135, 81, 0.15);
  transform: translateX(4px);
}

.mobile-rank {
  font-size: 1rem;
  font-weight: 700;
  color: var(--nigeria-green);
  min-width: 2.5rem;
}

.mobile-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-score {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--gold);
  margin-left: auto;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Moving Up Animation */
.moving-up {
  animation: move-up 0.8s ease-out;
  box-shadow: 0 0 20px var(--green-glow) !important;
}

@keyframes move-up {
  0% {
    transform: translateY(20px);
    opacity: 0.5;
  }
  50% {
    box-shadow: 0 0 30px var(--green-glow);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Moving Down Animation */
.moving-down {
  animation: move-down 0.8s ease-out;
}

@keyframes move-down {
  0% {
    transform: translateY(-20px);
    opacity: 0.5;
  }
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
}

/* New Entry Animation */
.new-entry {
  animation: new-entry-flash 1.5s ease-out;
}

@keyframes new-entry-flash {
  0%, 100% {
    background-color: white;
  }
  25%, 75% {
    background-color: rgba(255, 199, 44, 0.2);
  }
  50% {
    background-color: rgba(255, 199, 44, 0.4);
  }
}

/* Score Pulse Animation */
.pulse-score {
  animation: pulse-score 0.6s ease-out;
}

@keyframes pulse-score {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
    color: var(--gold);
  }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Large screens - expand columns more */
@media (min-width: 1280px) {
  .remaining-ranks-section {
    padding: 3rem;
  }

  .table-cell {
    padding: 1.5rem 2rem;
    font-size: 1.1rem;
  }

  .rank-cell {
    font-size: 1.5rem;
  }

  .name-cell {
    font-size: 1.15rem;
  }

  .score-cell {
    font-size: 1.75rem;
  }

  .table-header {
    padding: 1.25rem 2rem;
    font-size: 0.95rem;
  }
}

@media (max-width: 768px) {
  .header-title {
    font-size: 1.75rem;
  }

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

  .stats-overview {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .podium-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .first-place,
  .second-place,
  .third-place {
    height: auto !important;
    min-height: 160px;
    transform: none !important;
  }

  .first-place:hover,
  .second-place:hover,
  .third-place:hover {
    transform: translateY(-4px) !important;
  }

  .podium-rank {
    font-size: 2.5rem;
  }

  .section-title {
    font-size: 1.375rem;
  }

  .remaining-ranks-section {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .back-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .header-card {
    padding: 1.5rem;
  }

  .live-indicator {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .mobile-rank {
    width: 20%;
  }

  .mobile-score {
    font-size: 1.25rem;
  }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Note: Using .is-hidden instead of .hidden to avoid conflicts with Tailwind's responsive hidden classes */
.is-hidden {
  display: none !important;
}

.fade-in {
  animation: fade-in 0.4s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
