/* Base Variables */
:root {
  --primary: #0f9d58; /* Darker green for better contrast */
  --primary-dark: #0b7d46;
  --primary-light: #b7e4c7;
  --primary-lightest-bg: #f8fdfa;
  --primary-darkest-bg: #0a1f14;
  --gray-50: #ffffff; /* Pure white for better contrast */
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #adb5bd;
  --gray-500: #6c757d;
  --gray-600: #495057;
  --gray-700: #343a40;
  --gray-800: #212529;
  --gray-900: #121416;
  --red: rgb(255, 0, 0);
  --orange: rgb(255, 128, 0);
  --yellow: rgb(240, 200, 0);
  --green: rgb(0, 180, 0);
  --cyan: rgb(0, 192, 192);
  --blue: rgb(54, 54, 255);
  --purple: #6a1b9a;
  --brown: rgb(170, 100, 0);
  --bronze: rgb(160, 92, 64);
  --bronze-light: rgb(255, 218, 189);
  --silver: rgb(127, 127, 127);
  --silver-light: rgb(224, 224, 224);
  --gold: rgb(245, 200, 0);  
  --gold-light: rgb(235, 228, 200);
  color-scheme: light dark;
}

/* Theme Modes */
/* Light mode (default) */
:root[data-mode="light"] {
  --bg-color: var(--primary-lightest-bg);
  --text-color: var(--gray-800);
  --card-bg: white;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-color: var(--gray-200);
  --hover-bg: var(--gray-100);
  --header-bg: var(--gray-50);
  --title-color: var(--gray-900);
  --difficulty-color: var(--gray-700);
  --empty-color: var(--gray-400);
  --empty-border-color: var(--gray-300);
}

/* Dark mode */
:root[data-mode="dark"] {
  --bg-color: var(--primary-darkest-bg);
  --text-color: var(--gray-100);
  --card-bg: var(--gray-800);
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4),
    0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --border-color: var(--gray-600);
  --hover-bg: var(--gray-700);
  --header-bg: var(--gray-800);
  --title-color: var(--gray-50);
  --difficulty-color: var(--gray-100);
  --empty-color: var(--gray-500);
  --empty-border-color: var(--gray-600);
}

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

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  padding: 0;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1.5rem 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

:root[data-mode="dark"] header {
  background: linear-gradient(135deg, #22313a 0%, var(--primary-dark) 100%);
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 2;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.1;
}

.header-bg-circle {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: float 6s ease-in-out infinite;
}

.circle-1 {
  width: 300px;
  height: 300px;
  top: -150px;
  left: -100px;
  animation-delay: 0s;
}

.circle-2 {
  width: 200px;
  height: 200px;
  bottom: -100px;
  right: -50px;
  animation-delay: 2s;
}

.header-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  animation: fadeInDown 0.8s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

.header-content h2 {
  font-size: 1.25rem;
  font-weight: 500;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.3s;
  animation-fill-mode: forwards;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }
  header {
    padding: 1.25rem 0;
    margin-bottom: 1.25rem;
  }
  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.125rem;
  }
  .card-header {
    padding: 0.875rem 1rem;
  }
  .card-title {
    font-size: 1.125rem;
  }
  .card-body {
    padding: 1rem;
  }
  .stats-table {
    font-size: 0.8125rem;
  }
  .stats-table th,
  .stats-table td {
    padding: 0.625rem 0.5rem;
  }
  .stats-table th {
    font-size: 0.6875rem;
  }
  .count {
    font-size: 0.8125rem;
  }
  .percentage {
    font-size: 0.6875rem;
  }
  .floating-button {
    width: 2.75rem;
    height: 2.75rem;
    bottom: 1.25rem;
    right: 1.25rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  header {
    padding: 1rem 0;
    margin-bottom: 1rem;
  }
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 1rem;
  }
  .card-header {
    padding: 0.75rem;
  }
  .card-title {
    font-size: 1rem;
  }
  .card-body {
    padding: 0.75rem;
  }
  .stats-table {
    font-size: 0.75rem;
  }
  .stats-table th,
  .stats-table td {
    padding: 0.5rem 0.375rem;
  }
  .stats-table th {
    font-size: 0.625rem;
  }
  .count {
    font-size: 0.75rem;
  }
  .percentage {
    font-size: 0.625rem;
  }
  .floating-button {
    width: 2.5rem;
    height: 2.5rem;
    bottom: 1rem;
    right: 1rem;
  }
}

/* Card Styles */
.card {
  background-color: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 2rem;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s ease;
}

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

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--header-bg);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--title-color);
  animation: fadeInRight 0.8s ease-out;
  transition: color 0.3s ease;
}

.card-body {
  padding: 1.25rem;
  background-color: white;
}

/* Table Styles */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0;
  border-radius: 0.5rem;
  box-shadow: var(--card-shadow);
  background-color: var(--card-bg);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.table-responsive::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.stats-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  min-width: 800px;
}

.stats-table th,
.stats-table td {
  padding: 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  background-color: var(--card-bg);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.stats-table th {
  background-color: var(--header-bg);
  font-weight: 600;
  color: var(--difficulty-color);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
  animation: fadeIn 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

.stats-table tr:last-child td {
  border-bottom: none;
}

.stats-table tr {
  animation: fadeIn 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-table tr:hover {
  background-color: var(--hover-bg);
  transform: translateX(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Different hover effect for header row */
.stats-table thead tr:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stats-table tr:hover td {
  background-color: var(--hover-bg);
}

.stats-table tr:hover th {
  background-color: var(--hover-bg);
}

.stats-table tr:hover .score-label {
  color: var(--primary);
  transform: translateX(5px);
  background-color: var(--hover-bg);
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.2);
}

:root[data-mode="dark"] .stats-table tr:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

:root[data-mode="dark"] .stats-table thead tr:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.score-label {
  font-weight: 600;
  color: var(--difficulty-color);
  position: sticky;
  left: 0;
  background-color: var(--card-bg);
  z-index: 5;
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1);
  padding-right: 1rem;
  border-right: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.score-label:hover {
  color: var(--primary);
  transform: translateX(5px);
  background-color: var(--hover-bg);
  border-right: 1px solid var(--border-color);
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.2);
}

:root[data-mode="dark"] .score-label {
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.4);
}

:root[data-mode="dark"] .score-label:hover {
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.5);
  background-color: var(--gray-700);
}

.stats-table th:first-child {
  position: sticky;
  left: 0;
  background-color: var(--header-bg);
  z-index: 15;
  box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1);
  border-right: 1px solid var(--border-color);
}

.stats-table tr:hover th:first-child {
  background-color: var(--header-bg);
}

/* Add shadow to indicate scrollable content */
.table-responsive::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 20;
}

.table-responsive:hover::after {
  opacity: 1;
}

/* Ensure the table container has proper positioning */
.tab-content {
  position: relative;
  overflow: hidden;
  display: none;
}

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

.stats-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  animation: fadeIn 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}

.circle-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid;
  position: relative;
  overflow: hidden;
  animation: pulse 2s infinite;
}

.progress-circle-inner {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  border-radius: 0;
  transition: height 1s ease-in-out;
}

.count {
  font-weight: 600;
  font-size: 0.875rem;
  transition: transform 0.2s ease;
}

.count:not(.empty-color):hover {
  transform: scale(1.1);
}

.percentage {
  font-size: 0.75rem;
  opacity: 0.8;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.percentage:not(.empty-color):hover {
  transform: scale(1.1);
  opacity: 1;
}

.stats-container:not(.empty-color):hover .count:not(.empty-color),
.stats-container:not(.empty-color):hover .percentage:not(.empty-color) {
  transform: scale(1.1);
}

.stats-container:not(.empty-color):hover .percentage:not(.empty-color) {
  opacity: 1;
}

/* Button Styles */
.floating-button {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 50;
}

.floating-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  background-color: var(--primary-dark);
}

.floating-button img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

/* Color Classes */
.color-grey {
  color: var(--gray-500);
  border-color: var(--gray-500);
}

.color-brown {
  color: var(--brown);
  border-color: var(--brown);
}

.color-green {
  color: var(--green);
  border-color: var(--green);
}

.color-cyan {
  color: var(--cyan);
  border-color: var(--cyan);
}

.color-blue {
  color: var(--blue);
  border-color: var(--blue);
}

.color-yellow {
  color: var(--yellow);
  border-color: var(--yellow);
}

.color-orange {
  color: var(--orange);
  border-color: var(--orange);
}

.color-red {
  color: var(--red);
  border-color: var(--red);
}

.color-bronze {
  color: var(--bronze);
  border-color: var(--bronze);
}
.bg-bronze,
.difficulty-circle.color-bronze,
.difficulty-circle.bronze {
  background: linear-gradient(
    to right,
    var(--bronze),
    var(--bronze-light),
    var(--bronze)
  );
  border-color: var(--bronze);
}
.color-silver {
  color: var(--silver);
  border-color: var(--silver);
}
.bg-silver,
.difficulty-circle.color-silver,
.difficulty-circle.silver {
  background: linear-gradient(
    to right,
    var(--silver),
    var(--silver-light),
    var(--silver)
  );
  border-color: var(--silver);
}

.color-gold {
  color: var(--gold);
  border-color: var(--gold);
}
.bg-gold,
.difficulty-circle.color-gold,
.difficulty-circle.gold {
  background: linear-gradient(
    to right,
    var(--gold),
    var(--gold-light),
    var(--gold)
  );
  border-color: var(--gold);
}

.bg-bronze {
  background-color: var(--bronze);
}

.bg-silver {
  background-color: var(--silver);
}

.bg-gold {
  background-color: var(--gold);
}

.color-purple {
  color: var(--purple);
  border-color: var(--purple);
}

.bg-grey {
  background-color: var(--gray-500);
}

.bg-brown {
  background-color: var(--brown);
}

.bg-green {
  background-color: var(--green);
}

.bg-cyan {
  background-color: var(--cyan);
}

.bg-blue {
  background-color: var(--blue);
}

.bg-yellow {
  background-color: var(--yellow);
}

.bg-orange {
  background-color: var(--orange);
}

.bg-red {
  background-color: var(--red);
}

.bg-purple {
  background-color: var(--purple);
}

.empty-color {
  color: var(--empty-color);
  border-color: var(--empty-border-color);
  opacity: 0.5;
}

:root[data-mode="dark"] .empty-color {
  opacity: 0.25;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  animation: fadeInDown 0.8s ease-out;
}

.tab:hover {
  color: var(--primary);
  background-color: var(--tab-hover-bg);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInLeft {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Add animation delay for table rows */
.stats-table tr {
  animation: fadeIn 0.5s ease-out;
  opacity: 0;
  animation-fill-mode: forwards;
}
@keyframes labelFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 50;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
  background-color: var(--primary-dark);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

.theme-toggle .moon-icon {
  display: none;
}

:root[data-mode="dark"] .theme-toggle .sun-icon {
  display: none;
}

:root[data-mode="dark"] .theme-toggle .moon-icon {
  display: block;
}

/* Theme color schemes */
:root[data-color="green"] {
  --primary: #0f9d58;
  --primary-dark: #0b7d46;
  --primary-light: #b7e4c7;
  --primary-lightest-bg: #f8fdfa;
  --primary-darkest-bg: #0a1f14;
  --tab-hover-bg: rgba(15, 157, 88, 0.08);
}

:root[data-color="blue"] {
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-light: #bfdbfe;
  --primary-lightest-bg: #f8fbff;
  --primary-darkest-bg: #0a1428;
  --tab-hover-bg: rgba(59, 130, 246, 0.08);
}

:root[data-color="purple"] {
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #ddd6fe;
  --primary-lightest-bg: #faf9ff;
  --primary-darkest-bg: #1a0f2e;
  --tab-hover-bg: rgba(124, 58, 237, 0.08);
}

:root[data-color="orange"] {
  --primary: #f97316;
  --primary-dark: #c2410c;
  --primary-light: #fed7aa;
  --primary-lightest-bg: #fffbf7;
  --primary-darkest-bg: #2a1508;
  --tab-hover-bg: rgba(249, 115, 22, 0.08);
}

:root[data-color="pink"] {
  --primary: #ec4899;
  --primary-dark: #be185d;
  --primary-light: #fbcfe8;
  --primary-lightest-bg: #fff9fc;
  --primary-darkest-bg: #2a0a1a;
  --tab-hover-bg: rgba(236, 72, 153, 0.08);
}

/* Color theme toggle button */
.color-theme-toggle {
  position: fixed;
  bottom: 8.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 50;
}

.color-theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
  background-color: var(--primary-dark);
}

.color-theme-toggle svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

/* Remove bottom padding if table-responsive is last in card-body */
.card-body > .table-responsive:last-child {
  margin-bottom: 0;
}

.progress-circle.empty-color {
  animation: none !important;
}

/* Remove underline from box links in main table */
.box-link {
  text-decoration: none;
}
.box-link:hover {
  text-decoration: none;
}
