:root {
  --primary-green: #2e7d32; /* Matches the green in your mockups */
  --bg-color: #f4f5f7;
  --card-bg: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #888888;
  --badge-bg: #222222;
  --badge-text: #ffffff;
  --item-bg: #fafafa;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding: 30px 20px;
}

.dashboard-header h1 {
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 40px;
  font-size: 2.5rem;
  font-weight: 900;
  color: #111;
}

.dashboard-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Grid Layouts */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* Card Styles */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  padding: 25px;
  display: flex;
  flex-direction: column;
  max-height: 800px; /* Keeps lists uniform */
}

.card-header {
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.card-header h2 {
  color: var(--primary-green);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Dropdown styling to blend into headers */
.header-dropdown {
  font-size: 1.2rem;
  color: var(--primary-green);
  font-weight: 800;
  border: none;
  border-bottom: 2px solid rgba(46, 125, 50, 0.3);
  background: transparent;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  padding: 0 5px;
  transition: border-color 0.2s;
}

.header-dropdown:hover, .header-dropdown:focus {
  border-bottom-color: var(--primary-green);
}

.header-dropdown option {
  color: #111;
  font-size: 1rem;
  font-weight: normal;
}

/* Scrollable Content Area */
.card-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 5px;
}

/* Scrollbar styling */
.card-content::-webkit-scrollbar { width: 6px; }
.card-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.card-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.card-content::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* List Item Styles (The mockup rows) */
.list-item {
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--item-bg);
  border-left: 6px solid var(--primary-green);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.list-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.item-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.item-rank {
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.95rem;
  min-width: 45px;
}

.item-text {
  display: flex;
  flex-direction: column;
}
.item-title {
  font-size: 0.9rem; /* Shrunk down from 1.05rem */
  
  /* Existing properties */
  font-weight: 700;
  color: #222;
}

.item-sub {
  font-size: 0.75rem; /* Shrunk down from 0.8rem */
  
  /* Existing properties */
  color: #aaa;
  font-weight: 600;
  margin-top: 2px;
}

.item-badge {
  font-size: 0.8rem; /* Shrunk down from 0.9rem */
  padding: 4px 10px; /* Reduced padding inside the badge */
  
  /* Existing properties */
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 20px;
  font-weight: 700;
  min-width: 80px;
  text-align: center;
}

.loading-text {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 20px;
}

/* --- Monthly Detailed Table Styles --- */
.monthly-table-wrapper {
  width: 100%;
  overflow-x: auto; /* Allows side-scrolling on small screens */
  padding-bottom: 10px;
}

.monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 1200px; /* Ensures columns don't crush together */
}

.monthly-table th {
  background-color: var(--primary-green);
  color: white;
  font-weight: 700;
  padding: 10px;
  border: 1px solid #1a4a1c;
  text-align: center;
  white-space: nowrap;
}

.monthly-table td {
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  vertical-align: middle;
}

.monthly-table tr.active-row {
  font-weight: 700;
  background-color: #ffffff;
}

.monthly-table tr.inactive-row {
  font-weight: 400;
  background-color: #f9f9f9;
  color: #666;
}

.monthly-table td.text-left { text-align: left; }
.monthly-table td.text-center { text-align: center; }

.status-cell {
  color: #000; /* Dark text for readability against bright colors */
  text-shadow: 0 0 2px rgba(255,255,255,0.5); /* Helps legibility */
}

.grand-total-row td {
  background-color: #111;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  border-color: #000;
}

/* --- Top 25 Spotlight Table --- */
.top25-table { 
  width: 100%; 
  border-collapse: collapse; 
  font-size: 0.85rem; 
}
.top25-table th { 
  background-color: var(--primary-green); /* Switched to green */
  color: white; 
  font-weight: 700; /* Made the font bold like the others */
  padding: 10px; 
  border: 1px solid #1a4a1c; /* Added the dark green border */
  text-align: center; /* Centered the headers */
  position: sticky;
  top: 0;
  z-index: 10;
}
.top25-table td { 
  padding: 8px 10px; 
  border: 1px solid #e0e0e0; /* Added the full grid lines */
  text-align: center; /* Centered the data text */
  vertical-align: middle;
}
.top25-table tr:nth-child(even) { background-color: #fafafa; }
.top25-table tr:hover { background-color: #f1f1f1; }

/* --- Hover History Tooltip --- */
.hover-trigger { 
  cursor: help; 
  border-bottom: 1px dotted var(--primary-green); 
}

.game-tooltip {
  position: absolute;
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  padding: 15px;
  border-radius: 8px;
  width: 350px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1000;
  font-size: 0.85rem;
  backdrop-filter: blur(5px);
}
.game-tooltip.visible { 
  opacity: 1; 
  pointer-events: auto; /* <--- ADDED HERE */
}
.game-tooltip h3 { 
  color: #4CAF50; 
  margin-bottom: 10px; 
  font-size: 1.1rem; 
  border-bottom: 1px solid #444; 
  padding-bottom: 5px; 
}
.tooltip-entry { 
  margin-bottom: 10px; 
  padding-bottom: 10px; 
  border-bottom: 1px dashed #333; 
}
.tooltip-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.tooltip-meta { font-weight: bold; color: #aaa; margin-bottom: 3px; }
.tooltip-note { color: #ddd; line-height: 1.4; }

/* Scrollbar for tooltip */
.game-tooltip::-webkit-scrollbar { width: 4px; }
.game-tooltip::-webkit-scrollbar-thumb { background: #666; border-radius: 4px; }

/* --- Analysis Tables --- */
.analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 900px;
}
.analysis-table th {
  background-color: var(--primary-green);
  color: white;
  padding: 10px;
  border: 1px solid #1a4a1c;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.analysis-table td {
  padding: 8px;
  border: 1px solid #e0e0e0;
  text-align: center;
}
.analysis-table tr:nth-child(even) { background-color: #fafafa; }
.analysis-table tr:hover { background-color: #f1f1f1; }
.analysis-table tr.all-time-row td { font-weight: bold; background-color: #e8f5e9; }

/* --- Milestone Tracker --- */
.milestone-item {
  position: relative;
  padding: 0 0 20px 25px;
  border-left: 2px solid var(--primary-green);
  margin-left: 10px;
}
.milestone-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-green);
  box-shadow: 0 0 0 3px #e8f5e9;
}
.milestone-item:last-child { border-left-color: transparent; }
.milestone-date { font-weight: 800; color: var(--primary-green); font-size: 0.85rem; margin-bottom: 5px; }
.milestone-detail { font-size: 0.9rem; color: #333; line-height: 1.4; }

/* --- Heatmap --- */
.heatmap-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 0.75rem;
}
.heatmap-table th {
  padding: 4px;
  color: #555;
  font-weight: bold;
}
.heatmap-table td {
  width: 25px;
  height: 25px;
  border: 1px solid #fff;
  text-align: center;
  cursor: crosshair;
  transition: transform 0.1s;
}
.heatmap-table td:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 5;
  position: relative;
}
.heatmap-empty { background-color: #eee; }

/* --- Dashboard Entrance Animations --- */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  /* This ensures the cards are invisible before the animation fires */
  opacity: 0; 
  /* cubic-bezier gives it that buttery smooth "snap into place" feel */
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Sticky Headers for Monthly Summary --- */
.monthly-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Adds a tiny drop shadow when scrolling */
}

.spotlight-subtitle {
  background: var(--primary-green);
  color: #fff;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  border-radius: 8px 8px 0 0;
  margin: 0;
  text-transform: uppercase;
}

/* Highlight bolded entries in spotlight with a subtle green tint */
.top25-table td[style*="font-weight: 800"] {
  border-left: 4px solid var(--primary-green);
}

.spotlight-dual-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.spotlight-section {
  flex: 1;
  min-width: 400px;
}

/* Adjust table to fit with sub-header */
.spotlight-section .top25-table {
  border-top: none;
}

/* Mobile Tweak */
@media (max-width: 1000px) {
  .spotlight-section {
    min-width: 100%;
  }
}

/* Monthly Summary Accordion Styles */
.accordion-toggle-row {
  transition: background-color 0.2s ease;
}

.accordion-toggle-row:hover {
  background-color: rgba(0, 0, 0, 0.08) !important; /* Slightly darkens when you mouse over */
}

.toggle-icon {
  display: inline-block;
  width: 16px; /* Keeps spacing consistent between ▶ and ▼ */
  text-align: center;
  font-size: 0.8rem;
}
