/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

/* Modern Glassmorphism Effect */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Header Styles */
header {  
  display: flex;
  backdrop-filter: blur(10px);
  justify-content: space-between;
  align-items: center;
  padding: 15px 40px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  transition: 0.3s;
  background: rgba(13, 13, 13, 0.8);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 50%;
}

.logo {
  width: 70px;
}

.logo-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.logo-text {
  font-size: 22px;
  color: white;
  font-weight: 900;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-back-btn {
  display: inline-block;
  padding: 4px 12px;
  margin-left: 15px;
  background-color: #FFCC00;
  color: #222;
  text-decoration: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  transition: all 0.3s ease;
}

.header-back-btn:hover {
  background-color: #e6b800;
  transform: translateY(-2px);
}

/* Body styling */
body {
  background-color: #0d0d0d;
  color: #fff;
  font-family: 'Poppins', sans-serif;
}

/* Modern Progress Bar */
#progressBarContainer {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin: 20px 0;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  background: linear-gradient(90deg, #00aaff, #0077cc);
  width: 0%;
  border-radius: 10px;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

#progressBar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Modern Timer Display */
#globalTimer {
  font-size: 24px;
  margin: 20px 0;
  padding: 10px 20px;
  background: rgba(0, 170, 255, 0.1);
  border-radius: 10px;
  display: inline-block;
  transition: all 0.3s ease;
}

#globalTimer.low-time {
  background: rgba(255, 0, 0, 0.1);
  color: #ff4444;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Question Area Styling */
#questionArea {
  text-align: left;
  margin: 30px auto;
  width: 95%;
  padding: 30px;
  background: rgba(0, 29, 61, 0.5);
  border-radius: 15px;
  transition: all 0.3s ease;
}

#questionText {
  background: rgba(0, 29, 61, 0.8);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  font-size: 16px;
  line-height: 1.6;
}

/* Modern Input Field */
#answerInput {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid rgba(0, 170, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

#answerInput:focus {
  outline: none;
  border-color: #00aaff;
  box-shadow: 0 0 15px rgba(0, 170, 255, 0.3);
}

/* Modern Buttons */
.btn, #submitButton, #hintButton {
  padding: 12px 25px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #0077cc, #0055aa);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover, #submitButton:hover:not(:disabled), #hintButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 170, 255, 0.3);
}

/* Difficulty Buttons */
.difficulty-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 30px;
}

.difficulty-buttons .btn {
  min-width: 150px;
  background: linear-gradient(135deg, #0077cc, #0055aa);
}

.difficulty-buttons .btn:hover {
  transform: translateY(-3px);
}

/* Result Section */
#resultSection {
  text-align: center;
  padding: 40px;
  background: rgba(0, 29, 61, 0.5);
  border-radius: 20px;
  margin-top: 30px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .quiz-container {
    margin: 80px 20px;
    padding: 20px;
  }

  .difficulty-buttons {
    flex-direction: column;
    align-items: center;
  }

  .difficulty-buttons .btn {
    width: 100%;
    max-width: 300px;
  }

  #questionArea {
    padding: 20px;
  }

  #questionText {
    font-size: 14px;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Feedback Animations */
.feedback-correct {
  animation: correctFlash 0.5s ease;
  background: rgba(76, 175, 80, 0.2);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
}

.feedback-incorrect {
  animation: incorrectShake 0.5s ease;
  background: rgba(244, 67, 54, 0.2);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
}

.feedback-hint {
  background: rgba(255, 204, 0, 0.2);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  border-left: 4px solid #FFCC00;
}

/* Difficulty Indicator */
.difficulty-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 15px;
  background: rgba(0, 119, 204, 0.1);
  border-radius: 12px;
  flex-wrap: wrap;
}

.difficulty-label {
  color: #00aaff;
  font-weight: 600;
  font-size: 18px;
}

.difficulty-value {
  color: white;
  font-size: 18px;
  padding: 5px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.change-difficulty-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.change-difficulty-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 68, 68, 0.3);
}

/* Quiz Container */
.quiz-container {
  max-width: 900px;
  margin: 100px auto;
  padding: 40px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: fadeIn 0.5s ease-out;
}

/* Feedback styling */
#feedback {
  margin-top: 10px;
  font-size: 18px;
  transition: color 0.3s ease;
}

/* Result Section Styles */
#resultSection h2 {
    color: #00aaff;
    margin-bottom: 2rem;
    font-size: 2rem;
}

#resultSection p {
    margin: 1rem 0;
    transition: all 0.3s ease;
}

#resultSection button {
    margin: 1rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #0077cc, #0055aa);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#resultSection button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 170, 255, 0.3);
}

#resultSection a {
    display: inline-block;
    margin: 1rem;
    padding: 1rem 2rem;
    background: rgba(0, 170, 255, 0.2);
    border: 1px solid #00aaff;
    border-radius: 8px;
    color: #00aaff;
    text-decoration: none;
    transition: all 0.3s ease;
}

#resultSection a:hover {
    background: rgba(0, 170, 255, 0.3);
}

/* Global timer accent */
#timeLeft {
  font-weight: bold;
  color: #00aaff;
}

/* Mobile responsiveness */
@media (max-width: 736px) {
  .quiz-container {
    margin: 50px 20px;
    padding: 20px;
  }
  #questionText {
    font-size: 14px;
  }
  #answerInput, #submitButton, #globalTimer {
    font-size: 14px;
  }
}

@keyframes correctFlash {
  0% { background-color: #4CAF50; }
  50% { background-color: #0d0d0d; }
  100% { background-color: #4CAF50; }
}

@keyframes incorrectShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
  75% { transform: translateX(-10px); }
  100% { transform: translateX(0); }
}

/* Back to Top Button */
.back-to-top,
.back-to-top.visible,
.back-to-top:hover,
.back-to-top i {
    display: none;
}

/* Quiz Section */
#quizSection {
    background-color: #001d3d;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.5s ease-out;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    margin-top: 20px;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    z-index: 3;
    display: none;
}

#quizSection.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Welcome Section */
.welcome-section {
  padding: 2rem;
  animation: fadeIn 0.5s ease-out;
}

.welcome-text {
  font-size: 1.2rem;
  color: #00aaff;
  margin: 1rem 0 2rem;
  line-height: 1.6;
}

/* Difficulty Info Cards */
.difficulty-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
  padding: 1rem;
}

.difficulty-card {
  background: rgba(0, 29, 61, 0.5);
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

.difficulty-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.difficulty-card:hover::before {
  opacity: 1;
}

.difficulty-card i {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.difficulty-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #00aaff;
}

.difficulty-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.difficulty-card li {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.difficulty-card li::before {
  content: '•';
  color: #00aaff;
  position: absolute;
  left: 0;
}

/* Easy Card */
.difficulty-card:nth-child(1) {
  border-color: #4CAF50;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.2);
}

.difficulty-card:nth-child(1) i {
  color: #4CAF50;
}

.difficulty-card:nth-child(1):hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 25px rgba(76, 175, 80, 0.3);
}

/* Medium Card */
.difficulty-card:nth-child(2) {
  border-color: #FF9800;
  box-shadow: 0 0 20px rgba(255, 152, 0, 0.2);
}

.difficulty-card:nth-child(2) i {
  color: #FF9800;
}

.difficulty-card:nth-child(2):hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 25px rgba(255, 152, 0, 0.3);
}

/* Hard Card */
.difficulty-card:nth-child(3) {
  border-color: #f44336;
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.2);
}

.difficulty-card:nth-child(3) i {
  color: #f44336;
}

.difficulty-card:nth-child(3):hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 25px rgba(244, 67, 54, 0.3);
}

/* Difficulty Selection Text */
.select-text {
  font-size: 1.5rem;
  color: #00aaff;
  margin: 2rem 0 1rem;
  font-weight: 600;
}

/* Difficulty Buttons */
.difficulty-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.difficulty-buttons .btn {
  min-width: 180px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

/* Easy Button */
.difficulty-buttons .btn:nth-child(1) {
  background: linear-gradient(135deg, #4CAF50, #45a049);
}

.difficulty-buttons .btn:nth-child(1):hover {
  background: linear-gradient(135deg, #45a049, #4CAF50);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

/* Medium Button */
.difficulty-buttons .btn:nth-child(2) {
  background: linear-gradient(135deg, #FF9800, #F57C00);
}

.difficulty-buttons .btn:nth-child(2):hover {
  background: linear-gradient(135deg, #F57C00, #FF9800);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

/* Hard Button */
.difficulty-buttons .btn:nth-child(3) {
  background: linear-gradient(135deg, #f44336, #d32f2f);
}

.difficulty-buttons .btn:nth-child(3):hover {
  background: linear-gradient(135deg, #d32f2f, #f44336);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(244, 67, 54, 0.3);
}

/* Difficulty Card Additional Styles */
.difficulty-description {
  color: #fff;
  font-size: 1rem;
  margin: 1rem 0;
  line-height: 1.5;
  opacity: 0.9;
}

.difficulty-tips {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.difficulty-tips p {
  color: #00aaff;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.difficulty-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.difficulty-tips li {
  margin: 0.3rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: rgba(255, 255, 255, 0.8);
}

.difficulty-tips li::before {
  content: '→';
  color: #00aaff;
  position: absolute;
  left: 0;
}

/* Enhanced Card Hover Effects */
.difficulty-card {
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.difficulty-card:hover {
  transform: translateY(-5px);
}

.difficulty-card:nth-child(1):hover {
  border-color: #4CAF50;
  box-shadow: 0 5px 25px rgba(76, 175, 80, 0.3);
}

.difficulty-card:nth-child(2):hover {
  border-color: #FF9800;
  box-shadow: 0 5px 25px rgba(255, 152, 0, 0.3);
}

.difficulty-card:nth-child(3):hover {
  border-color: #f44336;
  box-shadow: 0 5px 25px rgba(244, 67, 54, 0.3);
}

/* Button Hover Effects */
.difficulty-buttons .btn {
  position: relative;
  overflow: hidden;
}

.difficulty-buttons .btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.difficulty-buttons .btn:hover::after {
  transform: translateX(100%);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .difficulty-description {
    font-size: 0.9rem;
  }

  .difficulty-tips {
    margin-top: 1rem;
  }

  .difficulty-tips li {
    font-size: 0.9rem;
  }
}

/* Input Group Styling */
.input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.input-group input {
  flex: 1;
  margin-bottom: 0;
}

/* Hint Button Styling */
#hintButton {
  background: linear-gradient(135deg, #FFCC00, #FFA000);
  color: #222;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  min-width: 120px;
  justify-content: center;
}

#hintButton i {
  font-size: 1.2rem;
}

#hintButton:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 204, 0, 0.3);
}

#hintButton:disabled {
  background: linear-gradient(135deg, #666, #444);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Feedback Hint Styling */
.feedback-hint {
  background: rgba(255, 204, 0, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  border-left: 4px solid #FFCC00;
  animation: hintAppear 0.3s ease-out;
}

@keyframes hintAppear {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Input Group */
@media (max-width: 768px) {
  .input-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .input-group input,
  .input-group button {
    width: 100%;
  }

  #hintButton {
    min-width: 100%;
  }
}

/* Quiz Controls */
.quiz-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(0, 29, 61, 0.5);
  border-radius: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, #0077cc, #0055aa);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 170, 255, 0.3);
}

.control-btn i {
  font-size: 1.2rem;
}

/* Timer Display */
.timer-display {
  font-size: 1.2rem;
  font-weight: 600;
  color: #00aaff;
  padding: 0.5rem 1rem;
  background: rgba(0, 170, 255, 0.1);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.timer-display.low-time {
  color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
  animation: pulse 1s infinite;
}

/* Stats Display */
.stats-display {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.stats-display .stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 1rem;
  color: white;
}

.stats-display .stat-item i {
  font-size: 1.2rem;
  color: #00aaff;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .quiz-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-btn {
    width: 100%;
    justify-content: center;
  }

  .timer-display {
    text-align: center;
  }

  .stats-display {
    justify-content: center;
  }
}