/* public/dashboard.css */
:root {
  --primary-color: #4a90e2;
  --secondary-color: #50e3c2;
  --background-color: #f4f7f6;
  --text-color: #333;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  background: var(--background-color);
  color: var(--text-color);
}

header {
  background: var(--header-bg);
  color: var(--text-color);
  padding: 1rem 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header nav a {
  color: var(--primary-color);
  text-decoration: none;
  margin: 0 15px;
  font-weight: 500;
}

main {
  padding: 20px;
  max-width: 1200px;
  margin: 20px auto;
}

section {
  background: var(--card-bg);
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

h2,
h3 {
  color: var(--primary-color);
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 10px;
  margin-top: 0;
}

#progress-chart-container {
  height: 400px;
  padding: 10px;
}

#kanji-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

#kanji-lists > div {
  width: 100%;
}

ul {
  list-style: none;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

ul li {
  background: #f9f9f9;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 5px;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s;
}

ul li:hover {
  transform: scale(1.02);
}

.button {
  display: inline-block;
  background: var(--primary-color);
  color: #fff;
  padding: 12px 25px;
  text-decoration: none;
  border-radius: 5px;
  margin-right: 10px;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
}

.button:hover {
  background: #357abd;
}

/* SRS Overview Section */
#srs-overview {
  margin-bottom: 30px;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f0fe 100%);
  border: 2px solid #e3f2fd;
  border-radius: 15px;
  position: relative;
  overflow: hidden;
}

#srs-overview::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), #ff6b6b, #4ecdc4);
  background-size: 200% 100%;
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.srs-description {
  font-size: 1rem;
  color: #555;
  margin-bottom: 25px;
  padding: 0 5px;
  text-align: center;
  font-weight: 500;
}

.srs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.srs-stat-card {
  background: white;
  color: #333;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.srs-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transition: all 0.3s ease;
}

.srs-stat-card.due-cards::before {
  background: linear-gradient(90deg, #ff5722, #f44336);
}

.srs-stat-card.learned-cards::before {
  background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.srs-stat-card.streak-cards::before {
  background: linear-gradient(90deg, #ff9800, #ffc107);
}

.srs-stat-card.next-review-card::before {
  background: linear-gradient(90deg, #2196f3, #03a9f4);
}

.srs-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

.srs-stat-card .stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 8px;
  display: block;
  color: #2c3e50;
}

.srs-stat-card .stat-label {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #34495e;
  margin-bottom: 4px;
}

.srs-stat-card .stat-subtitle {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-weight: normal;
}

/* Enhanced Lesson Button */
.lesson-button-container {
  margin-bottom: 25px;
}

.lesson-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 35px;
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border-radius: 15px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  transition: all 0.3s ease;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 90px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.lesson-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.lesson-button:hover::before {
  left: 100%;
}

.lesson-button:hover {
  background: linear-gradient(135deg, #45a049, #388e3c);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.lesson-button .button-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.lesson-button .button-text {
  font-size: 1.3rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.lesson-button .button-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  font-weight: normal;
  line-height: 1.3;
}

/* SRS Explanation */
.srs-explanation {
  background: #f8f9fa;
  border-left: 4px solid var(--primary-color);
  padding: 20px;
  margin: 20px 0;
  border-radius: 8px;
}

.srs-explanation h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.srs-explanation ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.srs-explanation li {
  padding: 8px 0;
  font-size: 0.95rem;
  color: #555;
  display: flex;
  align-items: flex-start;
}

.srs-explanation li strong {
  color: var(--primary-color);
  margin-right: 8px;
}

/* Urgent Review Animation */
.lesson-button.urgent-review {
  animation: urgentPulse 2s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%,
  100% {
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
  }
  50% {
    box-shadow: 0 8px 25px rgba(255, 87, 34, 0.6);
    transform: translateY(-2px);
  }
}

.other-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.secondary-action {
  padding: 15px 20px;
  text-align: center;
  font-size: 1rem;
}

/* Progress Indicators */
.progress-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 8px;
  animation: pulse 2s infinite;
}

.progress-indicator.due {
  background-color: #ff5722;
}

.progress-indicator.ready {
  background-color: #4caf50;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Insights Section */
#srs-insights {
  margin-top: 30px;
}

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

.insight-card {
  background: white;
  border: 2px solid #f0f0f0;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: var(--card-shadow);
}

.insight-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.insight-card h4 {
  margin: 0 0 10px 0;
  color: var(--primary-color);
  font-size: 1.1rem;
  border: none;
  padding: 0;
}

.insight-card p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}

/* Loading states */
.stat-loading {
  opacity: 0.6;
  position: relative;
}

.stat-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Loading and Error States */
.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 50px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-message {
  color: #d8000c;
  background-color: #ffbaba;
  border: 1px solid;
  margin: 10px 0px;
  padding: 15px 10px 15px 50px;
  background-repeat: no-repeat;
  background-position: 10px center;
  border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
    flex-direction: column;
  }

  header h1 {
    margin-bottom: 10px;
  }

  #kanji-lists {
    grid-template-columns: 1fr;
  }

  .srs-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .srs-stat-card {
    padding: 20px 15px;
  }

  .srs-stat-card .stat-number {
    font-size: 2rem;
  }

  .other-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .lesson-button {
    padding: 15px 20px;
    min-height: 70px;
  }

  .lesson-button .button-text {
    font-size: 1.1rem;
  }

  .insights-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  header nav a {
    display: block;
    margin: 5px 0;
  }

  .button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
  }

  .srs-stats {
    grid-template-columns: 1fr;
  }

  .lesson-button .button-text {
    font-size: 1rem;
  }

  .lesson-button .button-subtitle {
    font-size: 0.8rem;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 1000px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px;
  background: var(--primary-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: white;
  border: none;
  padding: 0;
}

.close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  opacity: 0.7;
}

.modal-body {
  padding: 20px;
  max-height: calc(80vh - 80px);
  overflow-y: auto;
}

/* Filter Buttons */
.kanji-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.filter-btn {
  padding: 10px 20px;
  border: 2px solid var(--primary-color);
  background: white;
  color: var(--primary-color);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary-color);
  color: white;
}

/* Kanji Grid */
.kanji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 20px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.kanji-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border: 2px solid #d2d1d1;
  border-radius: 8px;
  background: white;
  transition: all 0.3s;
  cursor: pointer;
  min-height: 100px;
  justify-content: center;
  font-family: inherit;
}

.kanji-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kanji-character {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
  font-family: inherit;
}

.kanji-status {
  font-size: 0.91rem;
  font-weight: 600;
  color: #333;
  font-family: inherit;
  background: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  min-height: 1.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kanji-item.learned {
  border-color: #a5d6a7;
}

.kanji-item.learned .kanji-status {
  background: #4caf50;
}

.kanji-item.not-learned {
  border-color: #d2d1d1;
}

.kanji-item.not-learned .kanji-status {
  background: #f44336;
}

.kanji-item.progress-1 {
  border-color: #ffeca9;
}

.kanji-item.progress-1 .kanji-status {
  background: #ff9800;
}

.kanji-item.progress-2 {
  border-color: #ffc586;
}

.kanji-item.progress-2 .kanji-status {
  background: #fbc02d;
  color: #333;
}

.kanji-item.progress-3 {
  border-color: #a5d6a7;
}

.kanji-item.progress-3 .kanji-status {
  background: #4caf50;
}

/* Loading state for kanji grid */
.kanji-grid-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  font-size: 1.2rem;
  color: var(--primary-color);
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 2% auto;
    max-height: 95vh;
  }

  .kanji-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
  }

  .kanji-character {
    font-size: 1.5rem;
  }

  .kanji-filters {
    flex-direction: column;
    align-items: center;
  }

  .filter-btn {
    width: 200px;
  }
}
