/* Math Education Hub - Frontend Styles */

.meh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.meh-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.meh-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.10);
}
.meh-card h3 { margin: 8px 0; }
.meh-card h3 a { text-decoration: none; color: #1e293b; }
.meh-card-thumb img { width: 100%; border-radius: 8px; display:block; }

.meh-badge {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.meh-btn {
  display: inline-block;
  background: #4338ca;
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 14px;
}
.meh-btn:hover { background: #362f9e; }

/* Quiz styles */
.meh-quiz { max-width: 700px; margin: 24px 0; }
.meh-quiz-question {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.meh-quiz-option {
  display: block;
  padding: 6px 0;
  cursor: pointer;
}
.meh-quiz-question.meh-correct { border-color: #16a34a; background: #f0fdf4; }
.meh-quiz-question.meh-incorrect { border-color: #dc2626; background: #fef2f2; }
.meh-quiz-q-image {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  margin: 8px 0 12px;
}
.meh-quiz-explanation {
  margin-top: 10px;
  padding: 10px 14px;
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  color: #1e3a8a;
}
.meh-quiz-score { font-size: 18px; font-weight: 700; margin-top: 12px; }
.meh-quiz-warning { color: #b45309; font-weight: 600; }

/* Game styles */
.meh-game-wrap { margin: 20px 0; }
.meh-game-instructions {
  background: #fff7ed;
  border-left: 4px solid #f97316;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.meh-game-frame {
  width: 100%;
  min-height: 500px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

/* Fact card */
.meh-fact-card {
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 16px 0;
  position: relative;
}
.meh-fact-icon { font-size: 22px; }
.meh-fact-card h4 { margin: 6px 0; }

/* Fun Fact floating button + popup */
#meh-fact-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.4);
  z-index: 9998;
  transition: transform 0.2s ease;
}
#meh-fact-fab:hover { transform: scale(1.08) rotate(-6deg); }

#meh-fact-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 41, 66, 0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#meh-fact-modal-overlay.is-open { display: flex; }

#meh-fact-modal {
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 32px 28px;
  position: relative;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: meh-fact-pop 0.3s ease;
}
@keyframes meh-fact-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.meh-fact-modal-icon { font-size: 36px; display: block; margin-bottom: 8px; }
#meh-fact-modal-title { margin: 6px 0 12px; color: #92400e; font-size: 19px; }
#meh-fact-modal-body { color: #78350f; font-size: 15px; line-height: 1.6; margin-bottom: 18px; }
#meh-fact-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #92400e;
  line-height: 1;
}

/* Carousel */
.meh-carousel-wrap { margin: 24px 0; }
.meh-carousel-title { margin-bottom: 14px; }
.meh-carousel {
  display: flex;
  align-items: center;
  gap: 10px;
}
.meh-carousel-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.meh-carousel-track {
  display: flex;
  flex-wrap: nowrap;
  transition: transform 0.35s ease;
}
.meh-carousel-slide {
  flex: 0 0 calc(33.333% - 15px);
  margin-right: 22px;
  min-width: 0;
}
.meh-carousel-slide .meh-card { height: 100%; }
.meh-carousel-arrow {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  color: #4338ca;
  line-height: 1;
  z-index: 2;
}
.meh-carousel-arrow:hover { background: #eef2ff; }
.meh-carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.meh-carousel-dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: none; background: #e2e8f0; cursor: pointer; padding: 0;
}
.meh-carousel-dot.is-active { background: #4338ca; }

@media (max-width: 900px) {
  .meh-carousel-slide { flex: 0 0 calc(50% - 15px); }
}
@media (max-width: 640px) {
  .meh-carousel-slide { flex: 0 0 100%; margin-right: 16px; }
}
