
/* Modern CSS Reset and Variables */
:root {
  --primary-color: #1e40af;
  --primary-hover: #1e3a8a;
  --secondary-color: #475569;
  --accent-color: #d97706;
  --success-color: #059669;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Enhanced Navigation */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  margin: 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar a {
  display: inline-block;
  color: var(--text-primary);
  text-decoration: none;
  padding: 1rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
}

.navbar a:hover {
  background: var(--background);
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Modern Container Styling */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin: 1rem auto;
  max-width: 600px;
  border: 1px solid var(--border-color);
}

/* Enhanced Typography */
h1 {
  color: white;
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
  color: var(--text-primary);
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

h3 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Modern Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  min-width: 120px;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

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

.btn-success {
  background: var(--success-color);
  color: white;
}

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

.btn-danger {
  background: var(--danger-color);
  color: white;
}

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

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Quiz Grid Layout */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.quiz-button {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.quiz-button:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.quiz-button img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.quiz-button p {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-primary);
  margin: 0;
}

/* Set Grid Layout */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.set-item {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.set-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.set-button {
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.set-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background: var(--surface);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Live Quiz Styling */
.join-container {
  max-width: 500px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.join-button {
  width: 100%;
  padding: 1rem;
  background: var(--success-color);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.join-button:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* Live Quiz Host/Participant */
.host-container,
.participant-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.room-code {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.question-display,
.question-container {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.answers-grid,
.options-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.option-button {
  padding: 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.option-button:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.option-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.option-a { background: #dc2626; color: white; }
.option-b { background: #1e40af; color: white; }
.option-c { background: #d97706; color: white; }
.option-d { background: #059669; color: white; }

/* Flash Messages */
.flash-messages {
  margin-bottom: 2rem;
}

.flash-messages li {
  list-style: none;
  padding: 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--danger-color);
  color: white;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--background);
  font-weight: 600;
  color: var(--text-primary);
}

/* Status and Debug Panels */
#status-display {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1000;
}

#debug-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 350px;
  max-height: 300px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container, .host-container, .participant-container {
    padding: 1rem;
  }
  
  .quiz-grid, .set-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }
  
  .room-code {
    font-size: 2rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .answers-grid, .options-container {
    grid-template-columns: 1fr;
  }
  
  .set-actions {
    justify-content: center;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.d-flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Statistics and Charts */
.statistics-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.stats-panel {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  height: 300px;
}

.leaderboard {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.feedback {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
  font-size: 1.125rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.feedback.correct {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #a7f3d0;
}

.feedback.incorrect {
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}
