/* ===== Global Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  color: #333;
}


h1, h2, h3 {
  text-align: center;
  margin-bottom: 1rem;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  margin: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* ===== Login/Register Screen ===== */
#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  z-index: 100;
}

.auth-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px 40px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-height: 90vh;
  overflow-y: auto;
  border: 5px solid;
  animation: fadeIn 0.8s ease-out, border-color-change 5s infinite;
}

@keyframes border-color-change {
  0% { border-color: #ff0000; box-shadow: 0 0 15px rgba(255, 0, 0, 0.3); }
  25% { border-color: #00ff00; box-shadow: 0 0 15px rgba(0, 255, 0, 0.3); }
  50% { border-color: #0000ff; box-shadow: 0 0 15px rgba(0, 0, 255, 0.3); }
  75% { border-color: #ffff00; box-shadow: 0 0 15px rgba(255, 255, 0, 0.3); }
  100% { border-color: #ff0000; box-shadow: 0 0 15px rgba(255, 0, 0, 0.3); }
}

.auth-container h1 {
  color: #667eea;
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.subtitle {
  text-align: center;
  color: #999;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form h2 {
  color: #333;
  margin-bottom: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a4a4a;
  margin-bottom: 8px;
  margin-left: 4px;
}

.auth-form input {
  padding: 12px 15px;
  background: #f4f6f8;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.auth-form input:focus {
  outline: none;
  background: #fff;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
  box-sizing: border-box;
}

.auth-form .password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  margin: 0 !important;
  padding: 0 !important;
  border: none;
  border-radius: 50%;
  background: transparent !important;
  color: #6b7280;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-form .password-toggle:hover {
  transform: translateY(-50%) !important;
  color: #374151;
  background: #eceff3 !important;
  box-shadow: none !important;
}

.password-toggle svg {
  width: 19px;
  height: 19px;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

.auth-form button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px;
  font-size: 1rem;
  font-weight: bold;
  margin: 20px 0 0 0;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.auth-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(118, 75, 162, 0.6);
}

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #888;
  font-size: 0.9rem;
  margin-top: -2px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e2e2;
}

.auth-form .google-auth-btn {
  width: 100%;
  margin: 0;
  padding: 11px 12px;
  background: #ffffff;
  color: #333;
  border: 2px solid #e6e6e6;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
}

.auth-form .google-auth-btn:hover {
  border-color: #d6d6d6;
  background: #fafafa;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.12);
}

.google-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(from 40deg, #4285f4 0deg 90deg, #34a853 90deg 180deg, #fbbc05 180deg 270deg, #ea4335 270deg 360deg);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.form-switch {
  text-align: center;
  margin-top: 15px;
  color: #666;
}

.form-switch a {
  color: #667eea;
  cursor: pointer;
  font-weight: bold;
  text-decoration: underline;
}

.form-switch a:hover {
  color: #5567d8;
}

.auth-message {
  padding: 12px 15px;
  border-radius: 8px;
  margin-top: 15px;
  text-align: center;
  font-weight: bold;
}

.auth-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.auth-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ===== Start Screen ===== */
#start-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 20px 0;
  text-align: center;
}

.start-container {
  position: relative;
  width: 100%;
}

.user-info {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.user-info p {
  margin: 0;
  font-size: 0.95rem;
}

.logout-btn {
  background: white;
  color: #764ba2;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logout-btn:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

#quiz-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
}

#quiz-buttons > button {
  background: white;
  color: #4a4a4a;
  height: 140px;
  width: 140px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#quiz-buttons > button:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  color: #667eea;
}

/* Icons for quiz categories */
#quiz-buttons > button:nth-child(1)::before { content: "🌍"; font-size: 2.5rem; }
#quiz-buttons > button:nth-child(2)::before { content: "📐"; font-size: 2.5rem; }
#quiz-buttons > button:nth-child(3)::before { content: "🏛️"; font-size: 2.5rem; }
#quiz-buttons > button:nth-child(4)::before { content: "🌿"; font-size: 2.5rem; }

/* ===== Quiz Container ===== */
#quiz-container {
  width: 650px;
  max-width: 95%;
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.1);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-height: 90vh;
  overflow-y: auto;
}

#quiz-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
  flex: 1;
}

/* ===== QUIZ HEADER (mute + title + timer row) ===== */
#quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* ===== Mute button styling ===== */
.mute-btn,
#mute-btn {
  background: #222;
  color: #00ffcc;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  width: 45px;
  height: 45px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: 0.3s;

  /* Center the icon */
  display: flex;
  align-items: center;
  justify-content: center;
}

.mute-btn:hover,
#mute-btn:hover {
  background: #00ffcc;
  color: #111;
}

/* ===== Timer styling ===== */
.quiz-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: 'Courier New', monospace;
  font-size: 1.6rem;
  font-weight: bold;
  color: #2d3436;
  background: #f8f9fa;
  padding: 8px 20px;
  border-radius: 50px;
  border: 3px solid #6c5ce7;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  text-align: center;
}

.quiz-timer::before {
  content: "⏰";
  font-size: 1.8rem;
}

.quiz-timer .timer-text {
  position: relative;
  top: 1px;   /* ✅ Push text a little lower */
}



/* Blinking warning in last 3 seconds */
.timer-warning {
  color: #ff4444 !important;
  border-color: #ff4444 !important;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.9) !important;
  animation: blink 1s step-start infinite, shake 0.5s infinite;
}

@keyframes shake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  50% { transform: rotate(0deg); }
  75% { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}

@keyframes blink {
  50% {
    opacity: 0.4;
  }
}

/* ===== Question Block ===== */
.question-card {
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  color: #333;
  box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
}

.gradient-1 { background: linear-gradient(135deg, #f6d365, #fda085); }
.gradient-2 { background: linear-gradient(135deg, #89f7fe, #66a6ff); }
.gradient-3 { background: linear-gradient(135deg, #a1c4fd, #c2e9fb); }
.gradient-4 { background: linear-gradient(135deg, #ff9a9e, #fad0c4); }
.gradient-5 { background: linear-gradient(135deg, #cfd9df, #e2ebf0); }
.gradient-6 { background: linear-gradient(135deg, #84fab0, #8fd3f4); }

#options-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

#options-list li {
  margin: 10px 0;
}

#options-list label {
  display: block;
  background: rgba(255, 255, 255, 0.8);
  padding: 12px;
  border-radius: 8px;
  transition: 0.3s;
  cursor: pointer;
}

#options-list input {
  margin-right: 10px;
}

/* ===== Navigation Buttons ===== */
.navigation {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

#prev-btn {
  background: #ff9800;
  color: white;
}
#prev-btn:hover { background: #e68900; }

#next-btn {
  background: #007bff;
  color: white;
}

#finish-btn {
  background: #28a745;
  color: white;
}

/* ===== Progress Bar ===== */
#progress-container {
  width: 100%;
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  margin: 15px 0 8px 0;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a90e2, #28a745);
  border-radius: 6px;
  transition: width 0.4s ease;
}

#progress-text {
  text-align: right;
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 10px;
}

/* ===== Result Screen ===== */
#result-screen {
  width: 650px;
  max-width: 95%;
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.1);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
}

#score-text {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.result-item {
  text-align: left;
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
}

.result-item.correct {
  background: #d4edda;
  border-left: 6px solid #28a745;
}

.result-item.wrong {
  background: #f8d7da;
  border-left: 6px solid #dc3545;
}

#result-screen button {
  background: #4a90e2;
  color: white;
}

.login-container {
  height: 100vh;              /* Full screen height */
  display: flex;
  justify-content: center;    /* Horizontal center */
  align-items: center;        /* Vertical center */
  background: linear-gradient(135deg, #6a6ff2, #7b5cc9);
}

.login-card {
  width: 380px;
  background: #ffffff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Leaderboard Styles ===== */
.leaderboard-list {
  margin: 20px 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 0 10px;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  background: #f8f9fa;
  margin-bottom: 8px;
  border-radius: 8px;
  font-weight: 600;
  border-left: 4px solid #f1c40f;
}

.leaderboard-item .score {
  color: #6c5ce7;
}

.filter-btn {
  padding: 5px 12px;
  font-size: 0.85rem;
  background: #eee;
  color: #333;
  border-radius: 15px;
  margin: 0;
}

.filter-btn.active {
  background: #6c5ce7;
  color: white;
}

.search-input {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
}

/* ===== Signed-in Footer ===== */
.social-footer {
  margin: 24px 10px 0;
  padding: 14px 16px;
  border-top: 1px solid #d9dde3;
  background: #eceff4;
  border-radius: 10px;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-copy,
.footer-dev {
  margin: 0;
  font-size: 0.9rem;
  color: #4d5a6a;
}

.footer-dev {
  white-space: nowrap;
}

.footer-dev-link {
  color: #0f8b8d;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.social-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #f7f8fc;
  border: 1px solid #e6e9f0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #2f3542;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.social-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(45, 52, 54, 0.15);
  background: #ffffff;
  color: #1d6fd1;
}

.social-link svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ===== Responsive Layout ===== */
@media (max-width: 1024px) {
  #quiz-container,
  #result-screen {
    width: min(92vw, 760px);
    padding: 20px;
  }
}

@media (max-width: 768px) {
  #login-screen {
    align-items: flex-start;
    padding: 12px 8px;
    overflow-y: auto;
  }

  .auth-container {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: min(100%, 520px);
    max-height: none;
    margin: 6px auto;
    padding: 20px 16px;
    border-width: 4px;
  }

  .auth-container h1 {
    font-size: 2rem;
  }

  .auth-form {
    gap: 14px;
  }

  #quiz-container,
  #result-screen {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: calc(100% - 12px);
    margin: 6px auto;
    max-height: none;
    padding: 16px;
  }

  #quiz-header {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  #quiz-title {
    order: 3;
    width: 100%;
    margin: 6px 0 2px;
    font-size: 1.15rem;
  }

  .quiz-timer {
    font-size: 1.15rem;
    padding: 6px 14px;
  }

  #navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }

  #navigation button {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
    margin: 0;
  }

  .search-container {
    flex-direction: column !important;
  }

  .filter-container {
    justify-content: flex-start !important;
  }

  .leaderboard-list {
    max-height: 48vh;
    padding: 0 4px;
  }

  .leaderboard-item {
    padding: 10px 12px;
  }

  .social-footer {
    margin: 20px 0 0;
    padding: 12px;
  }

  .footer-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .social-links {
    gap: 8px;
    margin-top: 10px;
  }

  .social-link {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 480px) {
  .auth-container {
    padding: 14px 12px;
    border-width: 3px;
    border-radius: 14px;
  }

  .auth-container h1 {
    font-size: 1.7rem;
  }

  .subtitle {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .input-group label {
    font-size: 0.85rem;
  }

  .auth-form input {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .auth-form button,
  .auth-form .google-auth-btn {
    font-size: 0.95rem;
    padding: 10px;
  }

  #quiz-container,
  #result-screen {
    padding: 12px;
    border-radius: 10px;
  }

  .question-card {
    padding: 14px;
  }

  #options-list label {
    padding: 10px;
    font-size: 0.92rem;
  }

  .quiz-timer {
    font-size: 1rem;
    padding: 6px 12px;
  }

  .quiz-timer::before {
    font-size: 1.3rem;
  }

  #navigation button {
    flex: 1 1 100%;
  }

  #score-text {
    font-size: 1.05rem;
  }

  .leaderboard-item .rank {
    font-size: 0.95rem;
  }

  .leaderboard-item .score {
    font-size: 1.05rem;
  }
}

@media (min-width: 1400px) {
  .auth-container {
    max-width: 460px;
  }

  #quiz-container,
  #result-screen {
    width: 760px;
  }

  .leaderboard-list {
    max-height: 420px;
  }
}

