/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #e1e5e9;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.header {
  text-align: center;
  margin-bottom: 30px;
  color: #ffffff;
  animation: slideInDown 0.8s ease-out;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  font-weight: 700;
  background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
}

.header p {
  font-size: 1.2rem;
  opacity: 0.9;
  color: #b8bcc8;
  animation: fadeInUp 1s ease-out 0.3s both;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navigation Styles */
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 255, 0.2);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.1);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
  animation: slideInUp 0.8s ease-out 0.2s both;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.unit-selector label {
  font-weight: 600;
  margin-right: 10px;
  color: #00ffff;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.unit-selector select {
  padding: 10px 15px;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(15, 15, 35, 0.8);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  max-width: 250px;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-selector select:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
  transform: scale(1.02);
}

.unit-selector select option {
  padding: 8px 12px;
  font-size: 0.95rem;
  background: #1a1a2e;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.section-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.section-btn {
  padding: 8px 16px;
  border: 2px solid transparent;
  background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff);
  background-size: 300% 300%;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  white-space: nowrap;
  min-width: 120px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: gradientShift 4s ease-in-out infinite;
}

.section-btn::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;
}

.section-btn:hover::before {
  left: 100%;
}

.section-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 0, 110, 0.4);
}

.section-btn.active {
  background: linear-gradient(45deg, #00ffff, #ff00ff);
  box-shadow: 0 4px 20px rgba(0, 255, 255, 0.5);
  transform: translateY(-2px);
}

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 0, 255, 0.2);
  padding: 15px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  animation: fadeIn 0.8s ease-out 0.4s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ffff, #ff00ff, #ffff00);
  background-size: 300% 100%;
  width: 0%;
  transition: width 0.5s ease;
  animation: gradientFlow 2s linear infinite;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

.progress-text {
  font-weight: 600;
  color: #00ffff;
  min-width: 60px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Main Content */
.main-content {
  flex: 1;
  position: relative;
}

.screen {
  display: none;
  animation: fadeInScale 0.5s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Welcome Screen */
.welcome-content {
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 255, 255, 0.2);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.1);
  text-align: center;
}

.welcome-content h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 2rem;
  text-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
}

.welcome-content > p {
  font-size: 1.1rem;
  color: #b8bcc8;
  margin-bottom: 40px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.feature {
  padding: 20px;
  border-radius: 10px;
  background: rgba(15, 15, 35, 0.8);
  border: 2px solid rgba(255, 0, 255, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(0, 255, 255, 0.1),
    transparent
  );
  transform: rotate(45deg);
  transition: all 0.5s;
  opacity: 0;
}

.feature:hover::before {
  opacity: 1;
  animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.feature:hover {
  transform: translateY(-10px) scale(1.02);
  border-color: #00ffff;
  box-shadow: 0 15px 35px rgba(0, 255, 255, 0.3);
}

.feature h3 {
  color: #ffffff;
  margin-bottom: 10px;
  font-size: 1.3rem;
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.feature p {
  color: #b8bcc8;
}

/* Flashcard Styles */
.flashcard-container {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.flashcard {
  width: 100%;
  max-width: 600px;
  height: 400px;
  position: relative;
  cursor: pointer;
  perspective: 1000px;
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  transition: transform 0.8s ease;
  border: 2px solid transparent;
}

.flashcard-front {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-image: linear-gradient(45deg, #00ffff, #ff00ff) 1;
  color: white;
}

.flashcard-back {
  background: linear-gradient(135deg, #8338ec, #3a86ff);
  border-image: linear-gradient(45deg, #ff00ff, #ffff00) 1;
  color: white;
  transform: rotateY(180deg);
}

.flashcard:hover .flashcard-front,
.flashcard:hover .flashcard-back {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 255, 255, 0.3);
}

.flashcard.flipped .flashcard-front {
  transform: rotateY(-180deg);
}

.flashcard.flipped .flashcard-back {
  transform: rotateY(0deg);
}

.card-content {
  font-size: 1.4rem;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.card-hint {
  font-size: 0.9rem;
  opacity: 0.8;
  font-style: italic;
  color: #b8bcc8;
}

.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* Quiz Styles */
.quiz-container {
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 255, 255, 0.2);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.1);
  max-width: 800px;
  margin: 0 auto;
}

.question-type {
  display: inline-block;
  background: linear-gradient(45deg, #ff006e, #8338ec);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(255, 0, 110, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.question-text {
  font-size: 1.3rem;
  color: #ffffff;
  margin-bottom: 30px;
  line-height: 1.6;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.question-options {
  margin-bottom: 30px;
}

.option {
  display: block;
  width: 100%;
  padding: 15px 20px;
  margin-bottom: 10px;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(15, 15, 35, 0.8);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
}

.option::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.option:hover::before {
  left: 100%;
}

.option:hover {
  border-color: #00ffff;
  background: rgba(0, 255, 255, 0.1);
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
}

.option.selected {
  border-color: #ff00ff;
  background: linear-gradient(
    45deg,
    rgba(255, 0, 255, 0.3),
    rgba(0, 255, 255, 0.3)
  );
  color: white;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
}

.option.correct {
  border-color: #00ff00;
  background: linear-gradient(
    45deg,
    rgba(0, 255, 0, 0.3),
    rgba(0, 255, 255, 0.3)
  );
  color: white;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

.option.incorrect {
  border-color: #ff0040;
  background: linear-gradient(
    45deg,
    rgba(255, 0, 64, 0.3),
    rgba(255, 0, 255, 0.3)
  );
  color: white;
  box-shadow: 0 0 20px rgba(255, 0, 64, 0.4);
}

.true-false-container {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.true-false-container .option {
  flex: 1;
  max-width: 200px;
  text-align: center;
}

.fill-blank-input {
  width: 100%;
  padding: 15px;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 1.1rem;
  background: rgba(15, 15, 35, 0.8);
  color: #ffffff;
  transition: all 0.3s ease;
}

.fill-blank-input:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
  background: rgba(0, 255, 255, 0.1);
}

.quiz-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.quiz-feedback {
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  display: none;
  border: 2px solid;
  animation: slideInUp 0.5s ease-out;
}

.quiz-feedback.correct {
  background: rgba(0, 255, 0, 0.2);
  color: #00ff00;
  border-color: #00ff00;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
  display: block;
}

.quiz-feedback.incorrect {
  background: rgba(255, 0, 64, 0.2);
  color: #ff0040;
  border-color: #ff0040;
  box-shadow: 0 0 20px rgba(255, 0, 64, 0.3);
  display: block;
}

/* Results Screen */
.results-container {
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 255, 255, 0.2);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 255, 0.1);
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.results-container h2 {
  color: #ffffff;
  margin-bottom: 30px;
  font-size: 2rem;
  text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff00, #00ffff);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 255, 0, 0.4);
  animation: rotateGlow 3s linear infinite;
  position: relative;
}

.score-circle::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: linear-gradient(45deg, #00ff00, #00ffff, #ff00ff, #ffff00);
  background-size: 300% 300%;
  animation: gradientShift 2s ease-in-out infinite;
  z-index: -1;
}

@keyframes rotateGlow {
  0% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 255, 0, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 255, 255, 0.4);
  }
  100% {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 255, 0, 0.4);
  }
}

.score-circle span {
  font-size: 2rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  z-index: 1;
}

.score-details {
  margin-bottom: 30px;
}

.score-details p {
  font-size: 1.1rem;
  color: #b8bcc8;
  margin-bottom: 10px;
}

.results-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Control Buttons */
.control-btn {
  padding: 12px 24px;
  border: 2px solid transparent;
  background: linear-gradient(45deg, #8338ec, #3a86ff);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  position: relative;
  overflow: hidden;
}

.control-btn::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;
}

.control-btn:hover::before {
  left: 100%;
}

.control-btn:hover {
  background: linear-gradient(45deg, #ff006e, #8338ec);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(131, 56, 236, 0.4);
}

.control-btn.primary {
  background: linear-gradient(45deg, #00ffff, #ff00ff);
  box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.control-btn.primary:hover {
  background: linear-gradient(45deg, #ff00ff, #ffff00);
  box-shadow: 0 8px 25px rgba(255, 0, 255, 0.4);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 30px;
  color: #b8bcc8;
  opacity: 0.8;
  animation: fadeIn 1s ease-out 0.8s both;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .unit-selector {
    width: 100%;
    text-align: center;
  }

  .section-selector {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }

  .section-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-width: 100px;
  }

  .flashcard {
    height: 300px;
  }

  .card-content {
    font-size: 1.2rem;
  }

  .quiz-container,
  .welcome-content {
    padding: 25px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .true-false-container {
    flex-direction: column;
  }

  .results-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.8rem;
  }

  .section-selector {
    gap: 4px;
  }

  .section-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
    min-width: 80px;
  }

  .flashcard {
    height: 250px;
  }

  .card-content {
    font-size: 1.1rem;
  }

  .flashcard-front,
  .flashcard-back {
    padding: 25px;
  }

  .control-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .features {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .feature {
    padding: 15px;
  }
}
