/* Quiz & Notes App - Professional Light Mode Design */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --text: #1e293b;
  --text-secondary: #64748b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.app-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Header */
header {
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 8px;
  background: var(--card-bg);
  padding: 6px;
  border-radius: 50px;
  box-shadow: var(--shadow);
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--primary-light);
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.card p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 8px;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input {
  resize: vertical;
  min-height: 60px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
  background: #a5b4fc;
  cursor: not-allowed;
}

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

.btn-secondary:hover {
  background: #e0e7ff;
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: #fecaca;
}

/* Quiz Styles */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#quiz-question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-weight: 500;
}

.option-btn.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
  color: var(--error);
  font-weight: 500;
}

.option-btn:disabled {
  cursor: default;
}

/* Feedback */
.feedback {
  margin-top: 20px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.feedback.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.feedback.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
}

#quiz-feedback-text {
  font-weight: 600;
  margin-bottom: 8px;
}

.explanation {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Results */
.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.result-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.result-stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.result-stat .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.review-item {
  padding: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  background: var(--bg);
}

.review-item.correct {
  border-left-color: var(--success);
}

.review-item.incorrect {
  border-left-color: var(--error);
}

.review-item .review-question {
  font-weight: 500;
  margin-bottom: 4px;
}

.review-item .review-answer {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Notes */
.notes-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.notes-controls .input {
  margin-bottom: 0;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.note-card:hover {
  box-shadow: var(--shadow-md);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  background: var(--bg);
}

.note-header:hover {
  background: var(--primary-light);
}

.note-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.note-category {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  font-weight: 500;
}

.note-content {
  display: none;
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text-secondary);
}

.note-content.expanded {
  display: block;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.stat-card {
  text-align: center;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.breakdown-item:last-child {
  border-bottom: none;
}

.breakdown-item .cat-name {
  font-weight: 500;
}

.breakdown-item .cat-count {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Utility */
.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
}

.status-msg {
  font-size: 0.85rem;
  margin-top: 8px;
}

.status-msg.success {
  color: var(--success);
}

.status-msg.error {
  color: var(--error);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
  .app-container {
    padding: 16px 12px;
  }

  .tab-nav {
    gap: 4px;
    padding: 4px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .card {
    padding: 18px;
  }

  .notes-controls {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .results-summary {
    grid-template-columns: 1fr 1fr;
  }
}
