/* Google Fonts Import */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");

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

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo i {
  margin-right: 0.5rem;
  font-size: 1.4rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: #0369a1;
}

.theme-toggle {
  cursor: pointer;
  font-size: 1.2rem;
}

/* Hero Section */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #0c4a6e;
  text-align: center;
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 2.5rem;
  max-width: 600px;
  color: #0c4a6e;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.primary {
  background-color: #0c4a6e;
  color: white;
}

.secondary {
  background-color: white;
  color: #0c4a6e;
}

/* Feature Cards */
.feature-cards {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 1rem;
  color: #0c4a6e;
}

.card p {
  color: #555;
  margin-bottom: 1rem;
}

.feature-icon {
  font-size: 2rem;
  color: #0c4a6e;
  opacity: 0.8;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #0c4a6e;
  margin-top: auto;
}

/* Content Container - Layout */
.content-container {
  display: flex;
  flex: 1;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 20px 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Scoreboard */
.scoreboard {
  padding: 15px;
  border-radius: 0;
  margin-bottom: 20px;
}

.scoreboard h3 {
  margin: 0;
  font-size: 20px;
  color: #0c4a6e;
  text-align: left;
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard ul {
  list-style: none;
  padding: 0;
  margin: 15px 0;
  text-align: left;
}

.scoreboard li {
  padding: 10px 15px;
  font-size: 16px;
  color: #1a1a1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard li:last-child {
  border-bottom: none;
}

/* Game Area */
.game-area {
  flex-grow: 1;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Rocket Container */
.rocket-container {
  position: relative;
  height: 150px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
  margin: 1.5rem 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  backdrop-filter: blur(5px);
}

/* Rocket Image */
#rocket {
  width: 50px;
  position: absolute;
  bottom: 0;
  transition: bottom 0.2s ease-in-out;
}

/* Progress Bar Section */
.progress-section {
  margin: 1.5rem 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 1rem;
  border-radius: 1rem;
  backdrop-filter: blur(5px);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #0c4a6e;
  font-weight: 500;
}

.progress-info i {
  margin-right: 0.3rem;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 5px;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  background-color: #0c4a6e;
  transition: width 0.2s ease-in-out;
}

/* Sentence Container */
.sentence-container {
  font-size: 1.3rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  width: 100%;
  min-height: 100px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  backdrop-filter: blur(5px);
}

#sentenceContainer span {
  padding: 2px;
}

.correct {
  color: #0c4a6e;
  font-weight: 600;
}

.incorrect {
  color: #e11d48;
  text-decoration: underline;
}

/* Input Field */
#userInput {
  width: 100%;
  height: 100px;
  font-size: 1.1rem;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.2);
  color: #0c4a6e;
  font-family: "Poppins", sans-serif;
  resize: none;
  backdrop-filter: blur(5px);
}

#userInput:focus {
  outline: none;
  border-color: #0c4a6e;
}

/* Restart Button */
#restartBtn {
  margin-top: 1rem;
}

/* Leaderboard Styles */
.leaderboard-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.time-tabs {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.3rem;
  backdrop-filter: blur(5px);
}

.tab-btn {
  padding: 0.8rem 1.5rem;
  background: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  color: #0c4a6e;
  cursor: pointer;
  border-radius: 0.3rem;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
  background-color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

/* Stats Page Styles */
.stats-container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 2rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(5px);
  flex-wrap: wrap;
}

.profile-avatar {
  font-size: 4rem;
  color: #0c4a6e;
}

.profile-info {
  flex: 1;
  min-width: 200px;
}

.profile-info h2 {
  color: #0c4a6e;
  margin-bottom: 0.5rem;
}

.rank-badge {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rank-title {
  font-size: 0.8rem;
  opacity: 0.8;
}

.rank-name {
  font-weight: 600;
  font-size: 1.2rem;
  color: #0c4a6e;
}

.rank-progress {
  height: 0.5rem;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 0.25rem;
  overflow: hidden;
}

.rank-progress-bar {
  height: 100%;
  background-color: #0c4a6e;
}

.rank-next {
  font-size: 0.8rem;
  opacity: 0.8;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0c4a6e;
}

.stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

.stats-tabs {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.3rem;
  backdrop-filter: blur(5px);
  flex-wrap: wrap;
}

.stats-content {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(5px);
}

.tab-content {
  display: none;
}

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

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stats-card {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stats-card-header {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-card-header h3 {
  color: #0c4a6e;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-card-body {
  padding: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
  border-bottom: none;
}

.recent-performance,
.typing-patterns {
  margin-top: 2rem;
}

.recent-performance h3,
.typing-patterns h3 {
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.chart-container {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  padding: 1rem;
  height: 300px;
}

.patterns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.pattern-card {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  padding: 1rem;
}

.pattern-card h4 {
  color: #0c4a6e;
  margin-bottom: 1rem;
  text-align: center;
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.key-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.key {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-weight: 600;
}

.time-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 150px;
}

.time-bar {
  width: 20%;
  background-color: rgba(12, 74, 110, 0.7);
  border-radius: 0.3rem 0.3rem 0 0;
  position: relative;
  transition: height 0.3s;
}

.time-bar:hover {
  background-color: rgba(12, 74, 110, 1);
}

.time-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  white-space: nowrap;
}

.progress-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.progress-chart-container h3 {
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.rank-history {
  margin-top: 2rem;
}

.rank-history h3 {
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.rank-timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 3rem 0;
}

.rank-timeline::before {
  content: "";
  position: absolute;
  top: 25px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.3);
  z-index: 0;
}

.rank-milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.rank-icon {
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: #0c4a6e;
  margin-bottom: 0.5rem;
}

.rank-milestone.achieved .rank-icon {
  background-color: rgba(12, 74, 110, 0.8);
  color: white;
}

.rank-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rank-name {
  font-weight: 600;
  color: #0c4a6e;
}

.rank-date {
  font-size: 0.8rem;
  opacity: 0.8;
}

.improvement-tips {
  margin-top: 2rem;
}

.improvement-tips h3 {
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.tips-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.tip-card {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.tip-icon {
  font-size: 1.5rem;
  color: #0c4a6e;
}

.tip-content h4 {
  color: #0c4a6e;
  margin-bottom: 0.5rem;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.achievement-card {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0.7;
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
}

.achievement-card.achieved {
  opacity: 1;
}

.achievement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
  font-size: 2rem;
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.achievement-card.achieved .achievement-icon {
  color: gold;
}

.achievement-content h4 {
  color: #0c4a6e;
  margin-bottom: 0.5rem;
}

.achievement-date {
  font-size: 0.8rem;
  margin-top: 1rem;
  opacity: 0.8;
}

.achievement-progress {
  margin-top: 1rem;
  width: 100%;
}

.progress-bar {
  height: 0.5rem;
  background-color: rgba(12, 74, 110, 0.7);
  border-radius: 0.25rem;
  margin-bottom: 0.3rem;
}

.history-filters {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  padding: 0.5rem;
  border-radius: 0.3rem;
  border: none;
  background-color: rgba(255, 255, 255, 0.2);
  color: #0c4a6e;
  font-family: "Poppins", sans-serif;
}

.history-table-container {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 1rem;
  font-weight: 600;
  color: #0c4a6e;
}

.history-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.pagination-btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 0.3rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.pagination-btn:hover:not([disabled]) {
  background-color: rgba(255, 255, 255, 0.3);
}

.pagination-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 900px) {
  .feature-cards {
    flex-direction: column;
    padding: 0 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .profile-summary {
    flex-direction: column;
    text-align: center;
  }

  .profile-info {
    width: 100%;
  }

  .profile-stats {
    justify-content: center;
  }

  .rank-timeline {
    flex-direction: column;
    gap: 2rem;
  }

  .rank-timeline::before {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .action-buttons {
    flex-direction: column;
  }

  .content-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .game-area {
    padding: 1rem;
  }

  .time-tabs,
  .stats-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Dark Mode */
body.dark {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f1f5f9;
}

body.dark .navbar,
body.dark footer,
body.dark .sidebar {
  background-color: rgba(15, 23, 42, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .nav-links a {
  color: #f1f5f9;
}

body.dark .nav-links a:hover,
body.dark .nav-links a.active {
  color: #38bdf8;
}

body.dark h1,
body.dark .subtitle,
body.dark .scoreboard h3,
body.dark .progress-info {
  color: #f1f5f9;
}

body.dark .scoreboard li {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .primary {
  background-color: #38bdf8;
  color: #0f172a;
}

body.dark .secondary {
  background-color: #1e293b;
  color: #f1f5f9;
  border: 1px solid #38bdf8;
}

body.dark .rocket-container,
body.dark .progress-section,
body.dark .sentence-container,
body.dark #userInput {
  background-color: rgba(15, 23, 42, 0.5);
}

body.dark #progressBar {
  background-color: #38bdf8;
}

body.dark .correct {
  color: #38bdf8;
}

body.dark .incorrect {
  color: #f43f5e;
}

body.dark #userInput {
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark #userInput:focus {
  border-color: #38bdf8;
}

body.dark footer {
  color: #cbd5e1;
}

body.dark .time-tabs,
body.dark .leaderboard-content,
body.dark .position-card,
body.dark .profile-summary,
body.dark .stats-tabs,
body.dark .stats-content {
  background-color: rgba(15, 23, 42, 0.5);
}

body.dark .tab-btn,
body.dark .leaderboard-header h2,
body.dark .leaderboard-header p,
body.dark .leaderboard-table th,
body.dark .position-rank,
body.dark .position-name,
body.dark .position-stats span,
body.dark .your-position h3 {
  color: #f1f5f9;
}

body.dark .tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .tab-btn.active {
  background-color: rgba(255, 255, 255, 0.15);
}

body.dark .leaderboard-table th {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .leaderboard-table td {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .leaderboard-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.05);
}

body.dark .stats-card-header h3,
body.dark .profile-info h2,
body.dark .rank-name,
body.dark .stat-value,
body.dark .recent-performance h3,
body.dark .typing-patterns h3,
body.dark .pattern-card h4,
body.dark .rank-history h3,
body.dark .improvement-tips h3,
body.dark .tip-content h4,
body.dark .achievement-content h4,
body.dark .history-table th {
  color: #f1f5f9;
}

body.dark .stats-card,
body.dark .pattern-card,
body.dark .chart-container,
body.dark .rank-badge,
body.dark .tip-card,
body.dark .achievement-card,
body.dark .filter-select,
body.dark .pagination-btn {
  background-color: rgba(15, 23, 42, 0.5);
}

body.dark .filter-select {
  color: #f1f5f9;
}

body.dark .key {
  background-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

body.dark .key-speed {
  color: #f1f5f9;
}

body.dark .achievement-date,
body.dark .rank-date,
body.dark .rank-next,
body.dark .rank-title,
body.dark .stat-label,
body.dark .tip-content p {
  color: #cbd5e1;
}

body.dark .achievement-progress span,
body.dark .pagination-info {
  color: #f1f5f9;
}

body.dark .time-label {
  color: #f1f5f9;
}

body.dark .history-table td {
  color: #f1f5f9;
}

body.dark .profile-avatar i {
  color: #38bdf8;
}

body.dark .time-bar {
  background-color: #38bdf8;
}

body.dark .rank-progress-bar {
  background-color: #38bdf8;
}

body.dark .rank-milestone.achieved .rank-icon {
  background-color: #38bdf8;
}

body.dark .tip-icon {
  color: #38bdf8;
}

body.dark .achievement-card.achieved .achievement-icon {
  color: #38bdf8;
}

body.dark .progress-bar {
  background-color: #38bdf8;
}

body.dark .stat-row {
  border-color: rgba(255, 255, 255, 0.1);
}

