/* Root Variables */
:root {
  --primary-color: #159895;
  --secondary-color: #8DBCC7;
  --sidebar-width: 200px;
  --hover-color: #8DBCC7;
  --text-color: #333;
  --text-muted: #666;
  --bg-color: #f1f1f1;
  --content-bg: #dddddd29;
  --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --white: #ffffff;
}

/* General Styles */
body {
  font-family: 'Work Sans', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  background-color: #f8f9fa;
  transition: all 0.25s ease-in-out;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Button Styles */
.btn-primary {
  color: #fff;
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--hover-color);
  border-color: var(--hover-color);
}

.btn-primary:disabled {
  background-color: #cccccc;
  color: #666666;
  cursor: not-allowed;
  opacity: 0.7;
  border: none;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar a {
  display: flex;
  align-items: center;
  color: var(--text-color);
  padding: 16px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar a i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.sidebar a.active {
  background-color: var(--primary-color);
  color: white;
}

.theme-toggle-link {
  margin-top: auto;
}

.sidebar a:hover:not(.active) {
  background-color: var(--hover-color);
  color: white;
}

.sidebar .logo {
  padding: 20px 16px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

/* Content Area */
.content {
  margin-left: var(--sidebar-width);
  padding: 0px;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  transition: all 0.3s ease;
}

.content > div {
  animation: fadeIn 0.4s ease-out;
}

/* Profile Content */
#profileContent {
  display: flex;
  width: 100%;
  min-height: 100%;
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 20px;
  width: 70%;
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--content-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.main input {
  text-align: center;
  border: none;
  background: transparent;
  width: 100%;
  padding: 8px;
  margin: 5px 0;
}

.main table {
  width: 100%;
  font-size: 16px;
  border-collapse: collapse;
}

.main h2 input {
  font-weight: 700;
  font-size: 1.5rem;
}

/* Dashboard Stats */
.dashboard-header {
  margin-bottom: 30px;
}

.user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 20px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.stat-card[role="button"] {
  cursor: pointer;
  user-select: none;
}

.stat-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.stat-card[role="button"]:active {
  transform: translateY(-2px);
}

.stat-card:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

.stat-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-right: 20px;
  width: 60px;
  height: 60px;
  background: #e8f7f7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-content h3 {
  margin: 0 0 5px 0;
  font-size: 1rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  margin: 0;
  color: #333;
}

/* Practice Options */
.practice-options {
  margin-bottom: 30px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.practice-btn {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 30px 20px;
  border-radius: var(--border-radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.practice-btn:hover {
  transform: translateY(-10px) scale(1.02);
  background: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.practice-btn:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

.practice-btn i {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.practice-btn h3 {
  margin: 0 0 10px 0;
}

.practice-btn p {
  margin: 0;
}

.quick-practice {
  border-top: 4px solid #4CAF50;
}

.customized-test {
  border-top: 4px solid #2196F3;
}

.unlimited-practice {
  border-top: 4px solid #FF9800;
}

/* Word of the Day */
.word-card {
  background: rgba(255, 255, 255, 0.6) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 30px;
  border-radius: 10px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.word-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  flex-direction: column;
}

#word-of-day,
#dictionaryWrd {
  font-size: 2.5rem;
  margin: 0 0 5px 0;
}

.pronunciation {
  font-size: 1.1rem;
  color: #666;
  margin: 0 0 5px 0;
}

.word-type {
  display: inline-block;
  background: #e8f7f7;
  color: var(--primary-color);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin: 0;
}

.word-definition {
  margin-bottom: 25px;
}

.word-definition p {
  font-size: 1.1rem;
  margin: 0 0 10px 0;
}

.example {
  font-style: italic;
  color: #666;
  padding-left: 15px;
  border-left: 3px solid #ddd;
}

.word-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.synonyms,
.antonyms {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 5px;
  overflow: auto;
}

.synonyms h4,
.antonyms h4 {
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
}

.synonyms p,
.antonyms p {
  margin: 0;
  color: #555;
}

.save-word-btn {
  background: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.save-word-btn.saved {
  background: var(--primary-color);
  color: white;
}

.save-word-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.saved-word-card {
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary-color);
}

.saved-word-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.empty-state-card {
  background: rgba(21, 152, 149, 0.05);
  border-radius: 15px;
  border: 2px dashed rgba(21, 152, 149, 0.2);
  padding: 3rem 1rem;
}

/* Leaderboard */
.leaderboard-container {
  max-width: 1000px;
  margin: 0 auto;
}

.leaderboard-title {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.leaderboard-title i {
  color: #FFD700;
}

.leaderboard-table {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.table-header {
  display: flex;
  background: var(--primary-color);
  color: white;
  font-weight: bold;
  padding: 15px 20px;
}

.table-header>div {
  flex: 1;
  padding: 5px;
}

.header-rank {
  flex: 0.5 !important;
  text-align: center;
}

.header-user {
  flex: 2 !important;
}

.header-streak {
  text-align: center;
}

.table-body {
  max-height: 500px;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  padding: 15px 20px;
  align-items: center;
  border-bottom: 1px solid #eee;
  transition: all 0.3s ease;
}

button.leaderboard-row {
  width: 100%;
  border-left: none;
  border-right: none;
  border-top: none;
  background-color: transparent;
  text-align: inherit;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.leaderboard-row:hover {
  background: #f9f9f9;
}

.leaderboard-row:focus-visible,
.saved-word-card:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: -2px;
  z-index: 2;
  position: relative;
}

.leaderboard-row.current-user {
  background: #e8f7f7;
}

.leaderboard-row>div {
  flex: 1;
  padding: 5px;
}

.rank {
  flex: 0.5 !important;
  text-align: center;
  font-weight: bold;
}

.rank-1 {
  color: #FFD700;
}

.rank-2 {
  color: #C0C0C0;
}

.rank-3 {
  color: #CD7F32;
}

.user {
  flex: 2 !important;
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.score,
.accuracy,
.streak {
  text-align: center;
}

.user-position {
  display: flex;
  background: white;
  border-radius: 10px;
  padding: 15px 20px;
  align-items: center;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.user-rank {
  flex: 0.5;
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
}

.rank-number {
  font-size: 1.3rem;
  display: block;
}

.rank-label {
  font-size: 0.8rem;
  display: block;
}

.user-info {
  flex: 2;
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-position .user-avatar {
  width: 50px;
  height: 50px;
  border: 2px solid var(--primary-color);
}

.user-name {
  font-weight: bold;
}

.user-score,
.user-accuracy,
.user-streak {
  flex: 1;
  text-align: center;
}

.user-score {
  font-weight: bold;
}

/* Quiz Styles */
#quizContainer {
  margin: 3vw;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.quiz-progress {
  flex: 1;
  margin-right: 20px;
}

.progress-bar {
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
}

.overall-progress-bar {
  height: 100%;
  background: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  background-color: #159895;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 10%;
  transition: width 0.3s ease;
}

.progress-text {
  display: block;
  text-align: center;
  margin-top: 5px;
  color: #666;
  font-size: 0.9rem;
}

.quiz-timer {
  background: #f8f8f8;
  padding: 8px 15px;
  border-radius: 20px;
  font-weight: bold;
  color: #e74c3c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-container {
  margin-bottom: 30px;
}

.question-type {
  display: inline-block;
  background: #e8f7f7;
  color: var(--primary-color);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.question-text {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.options-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-bottom: 30px;
}

.quiz-option {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.option-letter {
  display: inline-block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  background: #f0f0f0;
  border-radius: 50%;
  margin-right: 15px;
  font-weight: bold;
  color: #666;
}

.quiz-option.selected .option-letter,
.quiz-option.correct .option-letter {
  background: var(--primary-color);
  color: white;
}

.quiz-option.incorrect .option-letter {
  background: #e74c3c;
  color: white;
}

.option-text {
  flex: 1;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #eee;
  flex-direction: row;
}

.btn-quiz-nav {
  background: #f8f8f8;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-quiz-nav:hover {
  background: #e0e0e0;
}

.btn-quiz-nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-quiz-submit {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

.btn-quiz-submit:hover {
  background: #12827e;
}

.quiz-feedback {
  flex: 1;
  text-align: center;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.quiz-feedback span {
  font-weight: bold;
}

.quiz-feedback .correct {
  color: #2ecc71;
}

.quiz-feedback .incorrect {
  color: #e74c3c;
}

.btn-continue {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 5px;
  cursor: pointer;
}

/* Dictionary Styles */
.dictionary-container {
  background-color: #e8fafa;
  padding: 20px;
  border-radius: 12px;
  max-width: 800px;
  margin: 20px auto;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.dictionary-container h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.word-title {
  font-weight: bold;
  font-size: 18px;
  color: #0f5e5d;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestion-item.active {
  background-color: var(--primary-color) !important;
  color: white !important;
}

.suggestion-item.active .suggestion-bangla {
  color: rgba(255, 255, 255, 0.8) !important;
}

.word-details {
  margin-top: 12px;
  animation: fadeIn 0.3s ease;
}

#ai-explanation,
#ai-explanation-2 {
  background: #f9f9f9;
  padding: 18px;
  border-radius: 5px;
  overflow: auto;
}

.word-details p {
  margin: 6px 0;
}

.word-details span {
  font-weight: bold;
  color: var(--primary-color);
}

.pronounce-btn {
  background-color: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 16px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.pronounce-btn:hover {
  background-color: rgba(21, 152, 149, 0.1);
}

.pronounce-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.copy-word-btn {
  background-color: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 16px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.2s;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.copy-word-btn:hover {
  background-color: rgba(21, 152, 149, 0.1);
}

.copy-word-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.report-word-btn {
  background-color: transparent;
  border: none;
  color: #e74c3c;
  font-size: 16px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: all 0.2s;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.report-word-btn:hover {
  background-color: rgba(231, 76, 60, 0.1);
  transform: scale(1.1);
}

.report-word-btn:focus-visible {
  outline: 2px solid #e74c3c;
  outline-offset: 2px;
}

.copy-word-btn.copied {
  color: #27ae60;
}

.word-pronounce-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary-color);
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.word-pronounce-btn:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.word-pronounce-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* dictionary section */

#searchInput:focus,
.main input:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

#searchInput {
  background-position: 10px 12px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 40px 12px 45px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
  border-radius: 25px;
  box-shadow: var(--card-shadow);
  background-color: rgba(255, 255, 255, 0.8);
}

#dictionary-word-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
  position: absolute;
  width: 77vw;
}

#dictionary-word-list li a {
  border-left: 3px solid #ddd;
  margin-top: -1px;
  padding: 12px;
  text-decoration: none;
  font-size: 18px;
  color: black;
  display: block;
  margin: 3px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.summary-card {
  background-color: var(--white);
  box-shadow: var(--card-shadow);
  border-radius: var(--border-radius);
  text-align: center;
  padding: 30px 15px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.summary-card h3 {
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: 21px;
  font-weight: 500;
}

.summary-card p {
  font-size: 22px;
  font-weight: bold;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background-color: var(--primary-color);
}

.dictionary_details {
  margin: 15px 10px 1px 10px;
}

.subtitle {
  color: #ffff;
  font-weight: 500;
}

.dictionary-search {
  background-color: var(--hover-color);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  position: relative;
}

.dictionary-search h2 {
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 2.5rem;
}

.suggestion-item {
  padding: 15px 25px;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #e8dfd1;
  transition: background-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestion-item:hover,
.suggestion-item.active {
  background-color: rgba(21, 152, 149, 0.1);
  border-left: 4px solid var(--primary-color);
}

.match-highlight {
  color: var(--primary-color);
}

.suggestion-word {
  font-weight: bold;
}

#suggestions-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: #fefcf7;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--card-shadow);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  border: 1px solid #d4c8b5;
  border-top: none;
}

.word-details {
  max-width: 100%;
  margin: 32px auto 31px;
  padding: 35px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  display: none;
  position: relative;
  scroll-margin-top: 80px;
}

.word-header-dictionary h1 {
  margin-bottom: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--primary-color);
}

.word-header-dictionary h1 i {
  margin-left: 10px;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.word-details h2 {
  color: var(--primary-color);
  margin-bottom: 15px;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 10px;
}

.word-details h3 {
  color: var(--primary-color);
  margin-top: 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  font-size: 25px;
}

.word-details h3 i {
  margin-right: 10px;
  font-size: 19px;
}

.word-details p {
  margin-bottom: 10px;
}

.synonym-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.synonym {
  background-color: #ddd;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  display: inline-block;
}

.synonym:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.synonym:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  z-index: 1;
}

.search-history-badge {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-history-badge:hover {
  background-color: white;
  color: var(--primary-color);
  transform: translateY(-1px);
}

.clear-search-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  z-index: 10;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-search-btn:hover {
  color: var(--primary-color);
}

/* Button Resets for Semantic Elements */
button.suggestion-item,
button.search-history-badge {
  font-family: inherit;
  text-align: inherit;
}

button.suggestion-item {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid #e8dfd1;
}

button.search-history-badge {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.dictionary_img {
  align-items: center;
  display: flex;
  flex-direction: column;
  align-content: center;
  justify-content: flex-start;
  margin-top: 5px;
}

.dictionary_img img {
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 10px;
  width: 80%;
  transition: all 0.3s ease;
}

/* Lesson Styles */
.practice-with-lesson {
  border-top: 4px solid var(--primary-color);
}

.lesson-word-card {
  background: white;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary-color);
}

.lesson-word-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.lesson-word-en {
  font-weight: bold;
  font-size: 1.1rem;
}

.lesson-word-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: #fcfcfc;
}

.lesson-word-card.expanded .lesson-word-details {
  max-height: 500px;
}

.lesson-word-card.expanded .toggle-icon {
  transform: rotate(180deg);
}

.toggle-icon {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

/* Quick Search Styles */
.quick-search-container {
  max-width: 600px;
  margin: 0 auto;
}

#quickSearchInput {
  border: 1px solid rgba(21, 152, 149, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

#quickSearchInput:focus {
  background-color: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 8px 25px rgba(21, 152, 149, 0.15);
  transform: translateY(-2px);
}

#clearHistoryBtn:hover {
  opacity: 1 !important;
  color: #fff !important;
  text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

/* Back to Top Button */
.back-to-top-btn {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 99;
  border: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.back-to-top-btn.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top-btn:hover {
  background-color: var(--hover-color);
  transform: translateY(-5px) scale(1.1);
}

.back-to-top-btn:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 4px;
}

/* Global Loader */
#global-blocking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  cursor: wait;
}

#global-blocking-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 60px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  animation: overlayPop 0.3s ease-out;
}

@keyframes overlayPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Loader Animation Styles */
.loader-animation {
  perspective: 1000px;
  margin-bottom: 25px;
}

.cube-container {
  width: 60px;
  height: 60px;
  position: relative;
  transform-style: preserve-3d;
  animation: rotateCube 3s infinite ease-in-out;
}

.cube {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
}

.side {
  position: absolute;
  width: 60px;
  height: 60px;
  background: var(--primary-color);
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 28px;
  opacity: 0.95;
  box-shadow: inset 0 0 15px rgba(255,255,255,0.3);
}

.front  { transform: translateZ(30px); }
.back   { transform: rotateY(180deg) translateZ(30px); }
.right  { transform: rotateY(90deg) translateZ(30px); }
.left   { transform: rotateY(-90deg) translateZ(30px); }
.top    { transform: rotateX(90deg) translateZ(30px); }
.bottom { transform: rotateX(-90deg) translateZ(30px); }

@keyframes rotateCube {
  0% { transform: rotateX(0deg) rotateY(0deg); }
  25% { transform: rotateX(90deg) rotateY(0deg); }
  50% { transform: rotateX(90deg) rotateY(90deg); }
  75% { transform: rotateX(180deg) rotateY(90deg); }
  100% { transform: rotateX(180deg) rotateY(180deg); }
}

#loader-message {
  text-align: center;
  letter-spacing: 0.5px;
}

/* Progress Report Styles */
.progress-modal {
  max-width: 700px;
  margin: 50px auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  font-family: 'Segoe UI', sans-serif;
}
.progress-header {
  background: linear-gradient(135deg, #159895, #16a085);
  color: white;
  padding: 20px;
  text-align: center;
  border-radius: 14px 14px 0px 0px;
}
.progress-header h2 { margin-bottom: 15px; }
.progress-stats { display: flex; justify-content: space-around; flex-wrap: wrap; }
.stat-box { text-align: center; margin: 5px 0; }
.stat-value { font-size: 24px; font-weight: bold; display: block; }
.stat-label { font-size: 14px; opacity: 0.9; }
.progress-controls {
  display: flex;
  justify-content: space-between;
  padding: 15px 20px;
  background: #ecf0f1;
  border-bottom: 1px solid #bdc3c7;
  flex-wrap: wrap;
  gap: 10px;
}
.search-box { position: relative; flex: 1; min-width: 200px; }
#progressSearch { width: 100%; padding: 10px 15px 10px 35px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #7f8c8d; }
.sort-filter { display: flex; gap: 10px; }
#progressSort, #progressFilter { padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; background: white; }
.progress-container { padding: 10px; }
.progress-item {
  background: #fff;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.progress-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.progress-item.mastered { border-left: 5px solid #27ae60; }
.progress-item.getting-better { border-left: 5px solid #f39c12; }
.progress-item.needs-practice { border-left: 5px solid #e74c3c; }

.accuracy-text { font-size: 14px; color: #7f8c8d; }
.progress-bar-wrapper { height: 10px; background: #ecf0f1; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }

.progress-tooltip {
  position: absolute;
  right: 0;
  top: -5px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.progress-loading { text-align: center; padding: 40px; color: #7f8c8d; }
.spinner { border: 3px solid #f3f3f3; border-top: 3px solid #1abc9c; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 0 auto 15px; }
.no-progress-container { text-align: center; padding: 40px 20px; color: #7f8c8d; }
.no-progress-icon { font-size: 48px; margin-bottom: 15px; }
.no-progress-container h3 { margin: 0 0 10px 0; color: #34495e; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.progress-close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.struggling-words-section {
  padding: 15px;
  background: #fff5f5;
  border-radius: 8px;
  margin: 15px;
  border: 1px solid #fed7d7;
}
.struggling-word-badge {
  background: white;
  border: 1px solid #feb2b2;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.85rem;
  color: #9b2c2c;
  font-weight: 500;
}
.progress-controls-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  background: var(--bg-color);
  border-radius: 8px;
  margin-bottom: 20px;
}
.progress-search-wrapper {
  position: relative;
  width: 100%;
}
.progress-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.progress-search-input {
  width: 100%;
  padding: 10px 40px 10px 35px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: var(--content-bg);
}
.progress-item-content {
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--content-bg);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(21, 152, 149, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  border-right-color: var(--primary-color);
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading {
  text-align: center;
  padding: 10px;
  color: #33333387;
  flex-direction: row;
  align-content: center;
  justify-content: center;
  align-items: center;
}

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

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

@keyframes correct-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes incorrect-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.quiz-option.correct {
  animation: correct-pop 0.4s ease;
  border-color: #27ae60 !important;
  background-color: #27ae6011 !important;
}

.quiz-option.incorrect {
  animation: incorrect-shake 0.4s ease;
  border-color: #e74c3c !important;
  background-color: #e74c3c11 !important;
}

/* Accessibility */
.sidebar a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

.main input:focus {
  box-shadow: 0 0 0 2px var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-stats,
  .options-grid,
  .word-details {
    grid-template-columns: 1fr;
  }

  .leaderboard-row .user-avatar {
    display: none !important;
  }

  .leaderboard-row {
    flex-direction: row !important;
    align-items: center !important;
    padding: 10px 15px !important;
    gap: 0 !important;
    font-size: 0.85rem !important;
  }

  .leaderboard-row > div {
    display: block !important;
    text-align: center !important;
    padding: 2px !important;
  }

  .leaderboard-row > div::before {
    display: none !important;
  }

  .leaderboard-row .rank {
    flex: 0.4 !important;
  }

  .leaderboard-row .user {
    flex: 1.5 !important;
    justify-content: flex-start !important;
    text-align: left !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .leaderboard-row .score,
  .leaderboard-row .accuracy,
  .leaderboard-row .streak {
    flex: 0.8 !important;
  }

  .table-header {
    display: flex !important;
    padding: 10px 15px !important;
    font-size: 0.8rem !important;
  }

  .header-rank { flex: 0.4 !important; }
  .header-user { flex: 1.5 !important; text-align: left !important; }
  .header-score, .header-accuracy, .header-streak { flex: 0.8 !important; }

  .sidebar {
    width: 94%;
    height: 60px;
    position: fixed;
    bottom: 15px;
    left: 3%;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
    border-radius: 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    overflow: hidden;
  }

  .sidebar a {
    float: none;
    padding: 0;
    flex: 1;
    height: 100%;
    text-align: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar a span {
    display: none;
  }

  .sidebar a.logout-link {
    display: none;
  }

  .sidebar a i {
    margin-right: 0;
    font-size: 1.4rem;
  }

  .sidebar .logo {
    display: none;
  }

  .content {
    margin-left: 0;
    padding-bottom: 70px;
    width: 100%;
  }

  .main {
    width: 90%;
    left: 5%;
  }

  .question-text {
    font-size: 1.3rem;
  }

  .quiz-footer {
    flex-wrap: wrap;
    gap: 10px;
  }

  .btn-quiz-nav,
  .btn-quiz-submit {
    order: 1;
  }

  .quiz-feedback {
    order: 0;
    width: 100%;
    margin-bottom: 15px;
  }

  #dictionary-word-list {
    width: 80vw;
  }


  .user-position {
    flex-direction: row;
    gap: 15px;
    text-align: center;
  }

  .user-info {
    flex-direction: column;
    text-align: center;
  }

  .dictionary_img img {
    width: 100%;
  }
}

@media screen and (max-width: 480px) {
  .sidebar a {
    flex: none;
    width: 20%;
  }

  .main {
    width: 95%;
    padding: 15px;
  }

  .main table {
    font-size: 14px;
  }
}

/* --- DARK THEME OVERRIDES --- */
body[data-theme="dark"] {
  --primary-color: #1bcfcf;
  --secondary-color: #2d3a3a;
  --hover-color: #2d3a3a;
  --text-color: #e0e0e0;
  --text-muted: #aaa;
  --bg-color: #181a1b;
  --content-bg: #23272b;
  background-color: #181a1b;
  color: #e0e0e0;
}

body[data-theme="dark"] .sidebar {
  background-color: #23272b;
  border-right: 1px solid #333;
}

body[data-theme="dark"] .sidebar a {
  color: #e0e0e0;
}

body[data-theme="dark"] .sidebar a.active {
  background-color: #1bcfcf;
  color: #23272b;
}

body[data-theme="dark"] .sidebar a:hover:not(.active) {
  background-color: #2d3a3a;
  color: #1bcfcf;
}

body[data-theme="dark"] .content {
  background-color: #181a1b;
  color: #e0e0e0;
}

body[data-theme="dark"] .search-history-badge {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="dark"] .search-history-badge:hover {
  background-color: var(--primary-color);
  color: #181a1b;
}

body[data-theme="dark"] .stat-card,
body[data-theme="dark"] .practice-btn,
body[data-theme="dark"] .word-card,
body[data-theme="dark"] .leaderboard-table,
body[data-theme="dark"] .user-position,
body[data-theme="dark"] #quizContainer,
body[data-theme="dark"] .dictionary-container,
body[data-theme="dark"] .profile-header,
body[data-theme="dark"] .btn,
body[data-theme="dark"] .progress-modal,
body[data-theme="dark"] .progress-item,
body[data-theme="dark"] .summary-card,
body[data-theme="dark"] .word-details,
body[data-theme="dark"] .saved-word-card,
body[data-theme="dark"] .lesson-word-card,
body[data-theme="dark"] .progress-overview {
  background: #23272b !important;
  color: #e0e0e0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  border-color: #444 !important;
}

body[data-theme="dark"] .saved-word-card:hover {
  background: #2d3238 !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5) !important;
}

body[data-theme="dark"] .stat-value,
body[data-theme="dark"] .stat-label,
body[data-theme="dark"] .profile-name,
body[data-theme="dark"] .section-title,
body[data-theme="dark"] .leaderboard-title,
body[data-theme="dark"] h1, body[data-theme="dark"] h2, body[data-theme="dark"] h3 {
  color: #fff !important;
}

body[data-theme="dark"] .stat-icon {
  background: #181a1b !important;
  color: #1bcfcf !important;
}

body[data-theme="dark"] .progress,
body[data-theme="dark"] .progress-bar-wrapper {
  background: #333 !important;
}

body[data-theme="dark"] .progress-bar:not(.bg-success):not(.bg-info):not(.bg-warning):not(.bg-danger),
body[data-theme="dark"] .progress-fill,
body[data-theme="dark"] .overall-progress-bar {
  background: #1bcfcf !important;
}

body[data-theme="dark"] .quiz-option {
  background: #23272b !important;
  border: 2px solid #444 !important;
  color: #e0e0e0 !important;
}

body[data-theme="dark"] .quiz-option:hover {
  background: #2d3a3a !important;
  border-color: #1bcfcf !important;
  color: #fff !important;
}

body[data-theme="dark"] .quiz-option.correct {
  background: #1e2e1e !important;
  border-color: #2ecc71 !important;
}

body[data-theme="dark"] .quiz-option.incorrect {
  background: #2e1e1e !important;
  border-color: #e74c3c !important;
}

body[data-theme="dark"] .btn-primary {
  background-color: #1bcfcf !important;
  color: #23272b !important;
  border-color: #1bcfcf !important;
}

body[data-theme="dark"] .btn-primary:hover {
  background-color: #159895 !important;
  border-color: #159895 !important;
}

body[data-theme="dark"] .btn-secondary {
  background: transparent !important;
  color: #1bcfcf !important;
  border: 1px solid #1bcfcf !important;
}

body[data-theme="dark"] .btn-secondary:hover {
  background: #1bcfcf !important;
  color: #23272b !important;
}

body[data-theme="dark"] .word-type {
  background: #1bcfcf22 !important;
  color: #1bcfcf !important;
}

body[data-theme="dark"] .synonyms,
body[data-theme="dark"] .antonyms,
body[data-theme="dark"] .lesson-word-details,
body[data-theme="dark"] #ai-explanation,
body[data-theme="dark"] #ai-explanation-2 {
  background: #181a1b !important;
  color: #e0e0e0 !important;
}

body[data-theme="dark"] #searchInput,
body[data-theme="dark"] #progressSearch,
body[data-theme="dark"] #progressSort,
body[data-theme="dark"] #progressFilter {
  background-color: #23272b !important;
  color: #e0e0e0 !important;
  border: 1px solid #555 !important;
}

body[data-theme="dark"] #searchInput::placeholder {
  color: #888 !important;
}

body[data-theme="dark"] #suggestions-container {
  background-color: #23272b !important;
  border-color: #444 !important;
  color: #e0e0e0 !important;
}

body[data-theme="dark"] #global-blocking-overlay-inner {
  background: rgba(35, 39, 43, 0.95) !important;
  color: #e0e0e0 !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
}

body[data-theme="dark"] .suggestion-item {
  border-bottom-color: #333 !important;
}

body[data-theme="dark"] .suggestion-item:hover,
body[data-theme="dark"] .suggestion-item.active {
  background-color: #2d3a3a !important;
  border-left-color: var(--primary-color) !important;
}

body[data-theme="dark"] #dictionary-word-list li a {
  background-color: #23272b !important;
  color: #e0e0e0 !important;
  border-left: 3px solid #444 !important;
}

body[data-theme="dark"] #dictionary-word-list li a:hover:not(.header) {
  background-color: #2d3a3a !important;
  color: #fff !important;
}

body[data-theme="dark"] .leaderboard-row {
  border-bottom: 1px solid #333;
}

body[data-theme="dark"] .leaderboard-row:hover {
  background: #2d3a3a;
}

body[data-theme="dark"] .leaderboard-row.current-user {
  background: #1bcfcf22;
}

body[data-theme="dark"] .quiz-timer {
  background: #2d3a3a;
  color: #ff7675;
}

body[data-theme="dark"] .option-letter {
  background: #333;
  color: #aaa;
}

body[data-theme="dark"] .example {
  border-left-color: #555;
  color: #bbb;
}

body[data-theme="dark"] .pronunciation {
  color: #aaa;
}

body[data-theme="dark"] .table-header {
  background: #159895;
}
