/* ==========================================================================
   NOCALIA THEME PARK & RESORT - STATS DASHBOARD DESIGN SYSTEM
   Theme: Obsidian Dark / Royal Gold / Glassmorphism
   ========================================================================== */

:root {
  --bg-main: #06080d;
  --bg-card: rgba(13, 17, 26, 0.75);
  --bg-card-hover: rgba(20, 27, 40, 0.9);
  --border-card: rgba(212, 175, 55, 0.18);
  --border-card-hover: rgba(255, 230, 128, 0.45);

  --gold-primary: #d4af37;
  --gold-bright: #ffe680;
  --gold-gradient: linear-gradient(135deg, #ffe680 0%, #d4af37 100%);
  --gold-glow: rgba(212, 175, 55, 0.25);

  --text-main: #f0f4fc;
  --text-muted: #8a96a8;
  --text-subtle: #525c6d;

  --accent-blue: #38bdf8;
  --accent-purple: #c084fc;
  --accent-green: #4ade80;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Ambient Background Lights */
.ambient-fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.22;
}

.sphere-gold {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #d4af37, transparent);
  top: -150px;
  left: 15%;
}

.sphere-purple {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #7c3aed, transparent);
  bottom: 5%;
  right: -100px;
}

.sphere-blue {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #0284c7, transparent);
  bottom: 20%;
  left: -100px;
}

/* Page Layout */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Glassmorphic Components */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--border-card-hover);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.6), 0 0 24px var(--gold-glow);
}

/* Typography & Badges */
.gold-gradient {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gold-text {
  color: var(--gold-bright);
}

.badge-gold {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1400;
  background: var(--gold-gradient);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.section-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  text-transform: uppercase;
  margin-bottom: 2px;
  display: inline-block;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

/* Header */
.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  margin-bottom: 28px;
  gap: 20px;
}

.header-branding .brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.brand-tagline {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--gold-bright);
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulseAnimation 2s infinite;
}

@keyframes pulseAnimation {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 16px var(--accent-green); }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.live-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-green);
}

.header-search .search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 5px 8px 5px 16px;
  width: 320px;
  transition: var(--transition-smooth);
}

.search-box:focus-within {
  border-color: var(--gold-bright);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.3);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.88rem;
  width: 100%;
  margin-left: 8px;
}

.search-submit-btn {
  background: var(--gold-gradient);
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #0b0f19;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-submit-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 12px var(--gold-bright);
}

/* KPI Hero Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  display: flex;
  align-items: center;
  padding: 22px 24px;
  gap: 18px;
}

.kpi-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.gold-glow {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.2);
}

.purple-glow {
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.2);
}

.blue-glow {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.2);
}

.cyan-glow {
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.3);
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.2);
}

.kpi-details {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.kpi-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.kpi-subtext {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* Charts & Analytics Row */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 36px;
}

.chart-card {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.card-subnote {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 500;
}

/* Attractions Layout */
.attractions-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: center;
  min-height: 220px;
}

.chart-canvas-container {
  position: relative;
  width: 180px;
  height: 180px;
}

.attractions-legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(212, 175, 55, 0.3);
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
}

.legend-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-rides-count {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold-bright);
}

.legend-percent {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 45px;
  text-align: right;
}

/* Podium & Leaderboard */
.podium-container {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 22px;
  padding-top: 10px;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 10px 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.podium-step:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-4px);
}

.podium-step.step-1 {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.15) 0%, rgba(13, 17, 26, 0.8) 100%);
  border-color: rgba(255, 230, 128, 0.5);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.podium-step.step-2 {
  border-color: rgba(200, 210, 220, 0.35);
}

.podium-step.step-3 {
  border-color: rgba(205, 127, 50, 0.35);
}

.podium-avatar-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.podium-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  image-rendering: pixelated;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.step-1 .podium-avatar {
  width: 58px;
  height: 58px;
  border-color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.5);
}

.podium-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.badge-1st { background: var(--gold-gradient); color: #07080c; }
.badge-2nd { background: #cbd5e1; color: #07080c; }
.badge-3rd { background: #d97706; color: #ffffff; }

.podium-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.podium-rides {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-bright);
}

/* Ranks Table */
.ranks-table-wrapper {
  overflow-x: auto;
}

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

.ranks-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.ranks-table td {
  padding: 10px 12px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ranks-table tr {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.ranks-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.table-rank-num {
  font-weight: 700;
  color: var(--text-muted);
}

.table-player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-player-avatar {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  image-rendering: pixelated;
}

.table-player-name {
  font-weight: 600;
  color: var(--text-main);
}

.text-right {
  text-align: right;
}

.table-rides-count {
  font-weight: 700;
  color: var(--gold-bright);
}

/* Player Modal */
.player-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 5, 8, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: var(--transition-smooth);
}

.player-modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.player-modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: #0b0f19;
  border: 1px solid var(--border-card-hover);
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(212, 175, 55, 0.25);
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: #fff;
  transform: rotate(90deg);
}

.modal-profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.player-bust-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  image-rendering: pixelated;
  border: 2px solid var(--gold-bright);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.modal-username {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-uuid {
  font-size: 0.72rem;
  color: var(--text-subtle);
  font-family: monospace;
}

.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.modal-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.modal-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 2px;
}

.modal-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-section-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.modal-rides-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-ride-entry {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

/* Live Park Atmosphere & Operations Strip */
.live-ops-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  margin-bottom: 24px;
  background: rgba(13, 17, 26, 0.85);
}

.ops-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.ops-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.ops-data {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
}

.ops-value.show-status {
  color: var(--gold-bright);
}

.ops-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ops-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.ops-divider {
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 16px;
}

.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse 2s infinite;
}

.pulse-dot-gold {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4af37;
  box-shadow: 0 0 8px #d4af37;
  animation: pulse 2s infinite;
}

.pulse-dot-blue {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse 2s infinite;
}

.pulse-dot-purple {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c084fc;
  box-shadow: 0 0 8px #c084fc;
  animation: pulse 2s infinite;
}

/* Leaderboard Tabs */
.leaderboard-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lead-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: inherit;
}

.lead-tab:hover {
  color: #ffffff;
}

.lead-tab.active {
  background: var(--gold-gradient);
  color: #120e00;
  box-shadow: 0 2px 8px var(--gold-glow);
  font-weight: 700;
}

/* 24-Hour Activity Section */
.activity-section {
  margin-top: 24px;
}

.full-width {
  width: 100%;
}

.hourly-canvas-container {
  position: relative;
  width: 100%;
  height: 240px;
  margin-top: 12px;
}

/* Modal Achievements Section */
.modal-achievements-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-achievements-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
}

.modal-ach-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px;
  transition: var(--transition-smooth);
}

.modal-ach-card:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--gold-bright);
}

.modal-ach-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 2px;
}

.modal-ach-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Footer */
.stats-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.footer-links a {
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.footer-links a:hover {
  color: #ffffff;
}

.dot-sep {
  color: var(--text-subtle);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
  .live-ops-strip {
    flex-wrap: wrap;
    gap: 16px;
  }
  .ops-divider {
    display: none;
  }
  .ops-item {
    min-width: 45%;
  }
}

@media (max-width: 768px) {
  .stats-header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-search .search-box {
    width: 100%;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .attractions-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .ops-item {
    min-width: 100%;
  }
  .leaderboard-tabs {
    flex-wrap: wrap;
    border-radius: var(--radius-md);
  }
}
