/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 80px 0 0 0; /* Account for fixed navbar */
  font-family: "Poppins", sans-serif;
  color: #333;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  overflow: hidden;
}

h1 {
  margin-bottom: 1rem;
  font-weight: 600;
  color: #2c3e50;
}

/* ========================================
   TOP NAVIGATION BAR
   ======================================== */

/* Navigation Buttons */
.game-nav-btn {
  position: static;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.game-nav-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.home-nav-btn {
  background: linear-gradient(
    135deg,
    rgba(142, 68, 173, 0.7),
    rgba(108, 52, 131, 0.7)
  );
}

.home-nav-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(142, 68, 173, 0.9),
    rgba(108, 52, 131, 0.9)
  );
}

.restart-nav-btn {
  background: linear-gradient(
    135deg,
    rgba(255, 179, 71, 0.85),
    rgba(255, 204, 51, 0.85)
  );
  color: #333;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.restart-nav-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 179, 71, 0.9),
    rgba(255, 204, 51, 0.9)
  );
}

.restart-nav-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.sound-nav-btn {
  background: linear-gradient(135deg, #4285f4, #34a853);
  border-radius: 50%;
}

.sound-nav-btn.muted {
  background: linear-gradient(135deg, #9e9e9e, #616161);
}

.sound-pulse {
  animation: sound-pulse 0.3s ease-in-out;
}

/* ========================================
   NOTIFICATION MODAL
   ======================================== */

.notification-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000; /* Higher than other modals */
  animation: fadeIn 0.2s ease-out;
}

.notification-content {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

.notification-icon {
  margin-bottom: 1rem;
}

.notification-emoji {
  font-size: 3rem;
  display: block;
}

.notification-text h3 {
  color: #1d76de;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.notification-text p {
  color: #4a5464;
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.notification-actions {
  display: flex;
  justify-content: center;
}

.notification-btn {
  background: linear-gradient(135deg, #1d76de, #0b1d39);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.notification-btn:hover {
  background: linear-gradient(135deg, #0b1d39, #1d76de);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(29, 118, 222, 0.3);
}

.notification-btn:active {
  transform: translateY(0);
}

/* Secondary Button Styling */
.notification-btn-secondary {
  background: linear-gradient(135deg, #9ea8b9, #6b7280) !important;
  color: white;
}

.notification-btn-secondary:hover {
  background: linear-gradient(135deg, #6b7280, #9ea8b9) !important;
  box-shadow: 0 5px 15px rgba(158, 168, 185, 0.3) !important;
}

/* ========================================
   QUIZ SELECTION MODALS
   ======================================== */

/* Modal overlay */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

/* Modal content container */
.modal-content {
  background: #1a2332;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 2rem;
  width: 90%;
  max-width: 82vw;
  height: 75vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Close button */
.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Modal header */
.modal-header h3 {
  font-family: "Poppins", sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Quiz Preview Modal Specific */
.preview-modal-content {
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
}

.preview-modal-body {
  padding: 1.5rem;
}

.quiz-preview-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-modal-image {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.quiz-preview-details {
  flex: 1;
}

.quiz-preview-details h4 {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.75rem;
}

.quiz-preview-details p {
  color: #d1d5db;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.quiz-preview-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #9ca3af;
}

.quiz-preview-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-preview-rating .stars {
  color: #f59e0b;
  font-weight: 500;
}

.quiz-preview-questions h5 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f3f4f6;
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Question preview styling */
.preview-question-full {
  background: #f2f5f7;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid #1d76de;
}

.preview-question-full h6 {
  color: #1d76de;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.preview-question-text {
  color: #4a5464;
  font-weight: 500;
  margin-bottom: 0.75rem;
  line-height: 1.5;
  font-size: 1rem;
}

.answer-choices {
  margin-top: 0.75rem;
}

.answer-choice {
  background: white;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #d8dee6;
  color: #4a5464;
}

.answer-choice.correct-answer {
  background: linear-gradient(135deg, #10b981, #34d399);
  border-color: #059669;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.correct-answer-text {
  background: linear-gradient(135deg, #10b981, #34d399);
  border-color: #059669;
  color: white;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  margin-top: 0.75rem;
}

.no-preview {
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Material Icons fallback for close button */
.close-btn .material-icons {
  font-size: 1.2rem;
}

/* If material icons aren't loaded, use × symbol */
.close-btn:before {
  content: "×";
  font-size: 1.5rem;
  line-height: 1;
}

.close-btn .material-icons:before {
  content: "";
}

/* ========================================
   QUIZ PREVIEW BUTTON
   ======================================== */

.quiz-preview-btn {
  width: 100%;
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.1),
    rgba(52, 211, 153, 0.1)
  );
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.quiz-preview-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2),
    rgba(52, 211, 153, 0.2)
  );
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.2);
}

/* ========================================
   QUIZ SELECTION CARDS
   ======================================== */

.quiz-cards-grid {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

.quiz-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  min-width: 280px;
  max-width: 280px;
  height: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.quiz-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  border-color: #1d76de;
}

.quiz-card.selected {
  border-color: #1ccdc7;
  box-shadow: 0 0 0 3px rgba(28, 205, 199, 0.2);
}

.quiz-card-image {
  position: relative;
  height: 150px;
  overflow: hidden;
}

.quiz-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.quiz-card:hover .quiz-card-image img {
  transform: scale(1.05);
}

.selected-overlay {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #1ccdc7;
  color: white;
  border-radius: 0.5rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.selected-overlay .material-icons {
  font-size: 1.2rem;
}

/* Fallback for selected overlay if Material Icons aren't loaded */
.selected-overlay:before {
  content: "✓";
  font-size: 1.2rem;
  font-weight: bold;
}

.selected-overlay .material-icons:before {
  content: "";
}

.quiz-card-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.quiz-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #12141d;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.quiz-card-meta {
  font-size: 0.875rem;
  color: #9ea8b9;
  margin-bottom: 0.5rem;
}

.quiz-card-description {
  font-size: 0.875rem;
  color: #4a5464;
  line-height: 1.4;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.quiz-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-card-rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.quiz-card-rating .stars {
  color: #f5a623;
  font-weight: 500;
}

.quiz-card-rating .rating-count {
  color: #9ea8b9;
}

.quiz-card-select-btn {
  background: #1d76de;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-card-select-btn:hover {
  background: #0b1d39;
  transform: translateY(-1px);
}

.quiz-card-select-btn.selected {
  background: #1ccdc7;
  pointer-events: none;
}

/* ========================================
   QUIZ PAGINATION
   ======================================== */

.quiz-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid #d8dee6;
  margin-top: 1rem;
}

.pagination-btn {
  background: white;
  border: 2px solid #d8dee6;
  color: #4a5464;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background: #1d76de;
  color: white;
  border-color: #1d76de;
  transform: translateY(-1px);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f2f5f7;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-number-btn {
  background: white;
  border: 2px solid #d8dee6;
  color: #4a5464;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  min-width: 40px;
  text-align: center;
}

.page-number-btn:hover {
  background: #1d76de;
  color: white;
  border-color: #1d76de;
  transform: translateY(-1px);
}

.page-number-btn.active {
  background: #1d76de;
  color: white;
  border-color: #1d76de;
}

.pagination-dots {
  color: #9ea8b9;
  padding: 0 0.5rem;
  font-weight: 500;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 2rem;
  color: #9ea8b9;
  font-style: italic;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  border-radius: 0.5rem;
  margin: 1rem;
}
