/* Cyberpunk Theme Variables */
:root {
  --bg: #0d1117;
  --text: #e6e6e6;
  --score-text: #e6e6e6;
  --card-bg: #161b22;
  --nav-bg: linear-gradient(270deg, #8A2BE2, #00BFFF, #00FFD1);
  --glow-color: rgba(138, 43, 226, 0.7);
  --stats-bg: #2b3036;
  --stats-border: #30363d;
  --correct-bg: #1f3b20;
  --correct-border: #2c592d;
  --wrong-bg: #4a2123;
  --wrong-border: #6d2c2f;
  --user-correct-bg: #1f3b20;
  --user-correct-border: #2c592d;
  --user-wrong-bg: #4a2123;
  --user-wrong-border: #6d2c2f;
  --google-btn-bg: #4285f4;
  --google-btn-hover: #357ae8;
  --accent-primary: #bb86fc;
  --accent-secondary: #03dac6;
  --danger: #cf6679;
  --success: #4caf50;
  --warning: #ff9800;
}

body.dark {
  --bg: #f8f8f8;
  --text: #222;
  --score-text: #222;
  --card-bg: #fff;
  --nav-bg: linear-gradient(270deg, #00f6ff, #00ff99, #ff00ff);
  --glow-color: rgba(0, 246, 255, 0.7);
  --stats-bg: #e9ecef;
  --stats-border: #adb5bd;
  --correct-bg: #d4edda;
  --correct-border: #c3e6cb;
  --wrong-bg: #f8d7da;
  --wrong-border: #f5c6cb;
  --user-correct-bg: #d4edda;
  --user-correct-border: #c3e6cb;
  --user-wrong-bg: #f8d7da;
  --user-wrong-border: #f5c6cb;
  --google-btn-bg: #4285f4;
  --google-btn-hover: #357ae8;
}

/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

/* Utility Classes */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.mr-2 {
  margin-right: 0.5rem;
}

.mx-2 {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-secondary);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--stats-border);
}

.divider::before {
  margin-right: 1rem;
}

.divider::after {
  margin-left: 1rem;
}

.w-full {
  width: 100%;
}

.text-accent-primary {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.text-accent-primary:hover {
  text-decoration: underline;
}

.my-4 {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.text-center {
  text-align: center;
}

.text-xl {
  font-size: 1.25rem;
}

.font-bold {
  font-weight: 700;
}

/* Cyberpunk Button Styles */
.btn {
  position: relative;
  display: inline-block;
  padding: 10px 20px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
  overflow: hidden;
  cursor: pointer;
}

.btn:hover {
  color: #0ff;
  border-color: #0ff;
  box-shadow: 0 0 6px #0ff, 0 0 10px #0ff inset;
  transform: scale(1.05);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(0,255,255,0.5), transparent);
  transition: 0.5s;
  z-index: -1;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(45deg, #00BFFF, #8A2BE2);
  color: white;
  border: none;
  border-radius: 9999px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  font-weight: bold;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
}

.btn-secondary {
  background: var(--stats-bg);
  color: var(--text);
  border: 1px solid var(--stats-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
  box-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 9999px;
}

.btn-danger:hover {
  background: #e57373;
  transform: scale(1.05);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Cyberpunk Navbar */
header {
  background: var(--nav-bg);
  background-size: 300% 300%;
  animation: navAnim 8s linear infinite;
  color: #fff;
  box-shadow: 0 4px 15px var(--glow-color);
  z-index: 10;
}

@keyframes navAnim {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.logo {
  font-size: 1.4rem;
  font-weight: bold;
  text-shadow: 0 0 5px #fff, 0 0 10px var(--glow-color);
}

.nav-links {
  display: flex;
  gap: 15px;
  list-style: none;
}

/* Nav Link Buttons */
.nav-links a {
  display: block;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 9999px;
  /* Fully rounded */
  transition: all 0.3s ease;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
  text-shadow: none;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
  box-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color);
}

#theme-toggle {
  background: none;
  border: 2px solid var(--text);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 0 5px var(--text);
  transition: box-shadow 0.3s, transform 0.3s;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle:hover {
  box-shadow: 0 0 10px var(--text), 0 0 20px var(--glow-color);
  transform: scale(1.1);
}

/* Main Content */
main {
  min-height: calc(100vh - 120px);
  padding: 2rem 0;
}

/* Navigation Links */
.nav-link-requires-auth {
  opacity: 1;
  transition: opacity 0.3s;
}

.nav-link-requires-auth.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Cyberpunk Cards */
.card {
  background: var(--card-bg);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border: 1px solid var(--stats-border);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--accent-primary);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
}

.form-input-inline {
  width: auto;
  display: inline-block;
  min-width: 120px;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-input-inline:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-primary);
}

.form-input-inline:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-primary);
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-primary);
}

/* Floating Timer */
.timer {
  position: fixed;
  font-size: 1.2rem;
  margin-bottom: 20px;
  top: 60px;
  right: 20px;
  border-radius: 0.375rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: right;
  font-weight: bold;
  color: var(--text);
  z-index: 1000;
  background: var(--stats-bg);
  padding: 10px 15px;
  border: 1px solid var(--stats-border);
}

.timer.warning {
  background-color: var(--warning);
  color: #000;
}



/* Question Container */
.question-container {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border: 1px solid var(--stats-border);
}

.question-number {
  font-weight: bold;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.option {
  padding: 1rem;
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.02);
  box-shadow: 0 0 5px var(--glow-color);
}

.option.selected {
  background: linear-gradient(270deg, #00f6ff, #00ff99, #ff00ff);
  color: #fff;
  border-color: #0ff;
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

/* Results */
.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-card {
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.result-value {
  font-size: 2rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

.result-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.correct {
  color: var(--success);
}

.incorrect {
  color: var(--danger);
}

.skipped {
  color: var(--text-secondary);
}

/* Answer Review Boxes */
.correct-answer-box {
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
  font-weight: 500;
  background: var(--correct-bg);
  border: 1px solid var(--correct-border);
}

.user-answer-box {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Sortable Table Headers */
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
  transition: all 0.3s ease;
}

.sortable-header:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-primary);
}

.sort-indicator {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
}

.sort-indicator.asc::after {
  content: '▲';
}

.sort-indicator.desc::after {
  content: '▼';
}

.sort-indicator.none::after {
  content: '↕';
  opacity: 0.5;
}

.user-answer-box.correct {
  background: var(--user-correct-bg);
  border: 1px solid var(--user-correct-border);
}

.user-answer-box.wrong {
  background: var(--user-wrong-bg);
  border: 1px solid var(--user-wrong-border);
}

.user-answer-box.skipped {
  background: var(--stats-bg);
  border: 1px solid var(--stats-border);
}

/* Score Box */
.score-box {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  margin: 2rem auto;
  border: 2px solid var(--glow-color);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(0, 191, 255, 0.1), rgba(138, 43, 226, 0.1));
  box-shadow: 0 0 15px var(--glow-color), 0 0 30px var(--glow-color);
  animation: pulse-glow 2s infinite alternate;
}

@keyframes pulse-glow {
  from { box-shadow: 0 0 15px var(--glow-color), 0 0 30px var(--glow-color); }
  to { box-shadow: 0 0 20px var(--glow-color), 0 0 40px var(--glow-color), 0 0 60px var(--glow-color); }
}

/* Progress Bar */
.progress-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 20px;
  justify-content: center;
}

.progress-item {
  min-width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.progress-item.unanswered {
  background: var(--stats-bg);
  color: var(--text);
  border-color: var(--stats-border);
}

.progress-item.answered {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 5px var(--accent-primary);
}

.progress-item.visited {
  background: var(--accent-secondary);
  color: white;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 5px var(--accent-secondary);
}

.progress-item.active {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 10px #fff, 0 0 20px var(--glow-color);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .navbar {
    flex-wrap: wrap;
    justify-content: space-between;
    position: relative;
  }
  
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 1rem 0;
    transform: translateY(-100%) scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease-out;
    z-index: 5;
  }
  
  .nav-links.active {
    transform: translateY(0) scaleY(1);
  }
  
  .nav-links li {
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
  }
  
  .nav-links a {
    border: none;
    width: 80%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
  }
  
  .nav-toggle {
    display: block;
    font-size: 2rem;
    cursor: pointer;
    z-index: 20;
  }
  
  .result-summary {
    grid-template-columns: 1fr;
  }
  
  .progress-item {
    min-width: 25px;
    height: 25px;
    font-size: 0.7rem;
  }
  
  .progress-bar {
    gap: 3px;
  }
}

@media (max-width: 480px) {
  .progress-item {
    min-width: 20px;
    height: 20px;
    font-size: 0.6rem;
  }
  
  .progress-bar {
    gap: 2px;
  }
}

.nav-toggle {
  display: none;
  font-size: 2rem;
  cursor: pointer;
  z-index: 20;
}