/* =================================
   ADMIN QUIZ EDITOR - x0ne Theme
   Ultra clean, minimal, classy
   ================================= */

/* Override main padding for quiz admin */
.main.quiz-admin-main,
.main:has(.quiz-admin-container) {
  padding-top: 70px;
  padding-bottom: 0.5rem;
}

/* Container principal */
.quiz-admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
}

/* =================================
   HEADER
   ================================= */

.quiz-admin-header {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quiz-back-link {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  font-size: 0.7rem;
  display: inline-block;
  margin-bottom: 0.5rem;
  transition: color 0.15s;
}

.quiz-back-link:hover {
  color: rgba(74, 144, 217, 0.8);
}

.quiz-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quiz-admin-title {
  font-size: 1.1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.quiz-badges {
  display: flex;
  gap: 0.5rem;
}

/* Editable Title & Description */
.quiz-admin-header .editable-title-field,
.quiz-admin-header .editable-description-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.quiz-admin-header .module-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  font-weight: 400;
  font-family: inherit;
  padding: 0.25rem 0;
  width: 100%;
  max-width: 400px;
  transition: border-color 0.15s;
}

.quiz-admin-header .module-name-input:hover {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.quiz-admin-header .module-name-input:focus {
  outline: none;
  border-bottom-color: rgba(74, 144, 217, 0.4);
}

.quiz-admin-header .module-description-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  font-family: inherit;
  padding: 0.2rem 0;
  width: 100%;
  max-width: 500px;
  margin-top: 0.25rem;
  transition: border-color 0.15s;
}

.quiz-admin-header .module-description-input:hover {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.quiz-admin-header .module-description-input:focus {
  outline: none;
  border-bottom-color: rgba(74, 144, 217, 0.4);
  color: rgba(255, 255, 255, 0.7);
}

.quiz-admin-header .module-description-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.quiz-admin-header .save-indicator {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: opacity 0.2s;
}

.quiz-admin-header .save-indicator.show {
  opacity: 1;
}

.quiz-admin-header .save-indicator.error {
  color: #e74c3c;
}

.quiz-description {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  margin: 0.75rem 0 0 0;
}

/* Badges */
.badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.badge-type-quiz {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}

.badge-status-draft {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.badge-status-published {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}

.badge-order {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
}

/* =================================
   TABS NAVIGATION
   ================================= */

.quiz-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quiz-tab {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.quiz-tab:hover {
  color: rgba(255, 255, 255, 0.7);
}

.quiz-tab.active {
  color: rgba(255, 255, 255, 0.8);
}

.tab-count {
  background: rgba(74, 144, 217, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

/* =================================
   TAB CONTENT
   ================================= */

.quiz-tab-content {
  display: none;
}

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

/* =================================
   TOOLBAR
   ================================= */

.quiz-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 0.25rem;
}

/* Counters */
.quiz-counters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.counter {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.counter-value {
  font-size: 1rem;
  font-weight: 500;
}

.counter.validated .counter-value { color: #4ade80; }
.counter.pending .counter-value { color: #fbbf24; }

.counter-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

.counter-sep {
  color: rgba(255, 255, 255, 0.2);
}

/* =================================
   INPUTS & BUTTONS
   ================================= */

.quiz-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.quiz-input:focus {
  outline: none;
  border-color: rgba(74, 144, 217, 0.4);
  background: rgba(74, 144, 217, 0.05);
}

.quiz-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.quiz-input-search {
  width: 140px;
}

.quiz-input-create {
  width: 280px;
  /* No border - cleaner look */
}

.quiz-input-create.loading {
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0.03) 25%, 
    rgba(74, 222, 128, 0.1) 50%, 
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.quiz-select {
  cursor: pointer;
}

.quiz-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
}

.quiz-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quiz-btn-ghost {
  padding: 0.5rem;
  font-size: 1rem;
  line-height: 1;
}

.quiz-btn-primary {
  background: rgba(74, 144, 217, 0.15);
  border-color: rgba(74, 144, 217, 0.4);
  color: #4a90d9;
}

.quiz-btn-primary:hover:not(:disabled) {
  background: rgba(74, 144, 217, 0.25);
  border-color: #4a90d9;
}

.quiz-btn-outline {
  border-color: rgba(74, 144, 217, 0.3);
  color: rgba(74, 144, 217, 0.8);
}

.quiz-btn-outline:hover:not(:disabled) {
  background: rgba(74, 144, 217, 0.1);
  border-color: rgba(74, 144, 217, 0.5);
}

/* =================================
   STATS BAR (compact, above questions)
   ================================= */

.quiz-stats-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.stat-mini {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.stat-mini-value {
  font-size: 0.85rem;
  font-weight: 500;
}

.stat-mini-value.validated { color: #4ade80; }
.stat-mini-value.pending { color: #fbbf24; }
.stat-mini-value.muted { color: rgba(255, 255, 255, 0.5); }

.stat-mini-label {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
}

.stat-sep {
  color: rgba(255, 255, 255, 0.15);
}

.difficulty-mini {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.diff-dot {
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  background: rgba(74, 144, 217, 0.15);
  color: rgba(74, 144, 217, 0.8);
  border-radius: 3px;
  cursor: help;
}

/* =================================
   QUICK FILTERS
   ================================= */

.quiz-quick-filters {
  display: flex;
  gap: 0.15rem;
}

.filter-btn {
  background: none;
  border: 1px solid transparent;
  padding: 0.3rem 0.5rem;
  color: rgba(255, 255, 255, 0.35);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s;
}

.filter-btn:hover {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.filter-btn.active {
  color: #4a90d9;
  border-color: rgba(74, 144, 217, 0.3);
  background: rgba(74, 144, 217, 0.1);
}

/* =================================
   QUESTIONS CONTAINER
   ================================= */

.questions-container {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 0.35rem;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.questions-container::-webkit-scrollbar {
  width: 4px;
}

.questions-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.questions-container::-webkit-scrollbar-thumb {
  background: rgba(74, 144, 217, 0.3);
  border-radius: 2px;
}

/* Empty state */
.quiz-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: rgba(255, 255, 255, 0.3);
}

.empty-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.empty-text {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.empty-hint {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* =================================
   BULK ACTIONS
   ================================= */

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

.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* =================================
   CONFIG TAB - Styled like Activity Config
   ================================= */

.quiz-config-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-section {
  background: rgba(74, 144, 217, 0.03);
  border: 1px solid rgba(74, 144, 217, 0.1);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.config-section:last-of-type {
  margin-bottom: 0;
}

.config-title {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 0.75rem 0;
}

.config-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.config-toggle-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #4a90d9;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.config-field label {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
}

.config-field.config-full {
  grid-column: 1 / -1;
}

.config-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: 0.7rem;
  border-radius: 3px;
  width: 100%;
}

.config-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.15);
}

.config-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.config-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #4a90d9;
}

.config-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.btn-save {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: #4ade80;
  padding: 0.5rem 1.5rem;
  font-family: inherit;
  font-size: 0.7rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-save:hover {
  background: rgba(74, 222, 128, 0.25);
}

.btn-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  padding: 0.5rem 1.5rem;
  font-family: inherit;
  font-size: 0.7rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-reset:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

/* =================================
   STATS TAB
   ================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 0.75rem;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.stat-success .stat-value { color: #4ade80; }
.stat-card.stat-warning .stat-value { color: #fbbf24; }

.stats-section {
  margin-bottom: 2rem;
}

.stats-section h3 {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 1rem 0;
}

.difficulty-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.difficulty-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  min-width: 60px;
}

.bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90d9, #6366f1);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.bar-value {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  min-width: 20px;
  text-align: right;
}

.stats-info {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.stats-info strong {
  color: #4a90d9;
}

/* =================================
   ANALYTICS TAB (Student Stats)
   ================================= */

.analytics-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.analytics-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.analytics-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.15rem;
}

.analytics-value.success { color: #4ade80; background: transparent; }
.analytics-value.warning { color: #fbbf24; background: transparent; }

.analytics-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analytics-section {
  margin-bottom: 0.75rem;
  background: rgba(74, 144, 217, 0.03);
  border: 1px solid rgba(74, 144, 217, 0.1);
  border-radius: 6px;
  padding: 0.75rem;
}

.analytics-section h3 {
  font-size: 0.7rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.analytics-section h3 .section-count {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 400;
}

/* Analytics Search */
.analytics-search {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  width: 150px;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.analytics-search:focus {
  outline: none;
  border-color: rgba(74, 144, 217, 0.4);
  background: rgba(74, 144, 217, 0.05);
}

.analytics-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* Two column layout */
.analytics-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}

.analytics-col-left,
.analytics-col-right {
  min-width: 0;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.75rem;
  font-size: 0.7rem;
}

.pagination .page-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  transition: all 0.15s;
}

.pagination .page-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.pagination .page-btn.active {
  background: rgba(74, 144, 217, 0.2);
  border-color: rgba(74, 144, 217, 0.4);
  color: #4a90d9;
}

.pagination .page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination .page-info {
  color: rgba(255, 255, 255, 0.3);
  padding: 0 0.5rem;
}

@media (max-width: 900px) {
  .analytics-columns {
    grid-template-columns: 1fr;
  }
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.analytics-table th {
  text-align: left;
  padding: 0.5rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
  font-size: 0.65rem;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sortable Headers */
.analytics-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.analytics-table th.sortable:hover {
  color: rgba(255, 255, 255, 0.7);
}

.analytics-table th.sortable::after {
  content: '';
  display: inline-block;
  margin-left: 0.4rem;
  opacity: 0.3;
  font-size: 0.55rem;
}

.analytics-table th.sortable.sort-asc::after {
  content: '▲';
  opacity: 0.8;
  color: rgba(74, 144, 217, 0.9);
}

.analytics-table th.sortable.sort-desc::after {
  content: '▼';
  opacity: 0.8;
  color: rgba(74, 144, 217, 0.9);
}

.analytics-table td {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.analytics-table .student-name {
  color: rgba(255, 255, 255, 0.8);
}

.analytics-table .class-name {
  color: rgba(74, 144, 217, 0.7);
}

.analytics-table .score {
  font-weight: 500;
}

.analytics-table .score-pass { color: #4ade80; }
.analytics-table .score-fail { color: #fbbf24; }

.analytics-table .progress-col {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

.analytics-table .rank {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.7rem;
  width: 30px;
  text-align: center;
}

.analytics-table .date {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
}

.analytics-empty {
  text-align: center;
  padding: 2rem;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
}

/* Class stats breakdown */
.class-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.class-stat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.class-stat-row .class-name {
  min-width: 120px;
  color: rgba(74, 144, 217, 0.8);
  font-size: 0.8rem;
}

.class-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.class-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90d9, #6366f1);
  border-radius: 3px;
}

.class-score {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  min-width: 40px;
  text-align: right;
}

.class-count {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
}

/* Smaller buttons */
.quiz-btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
}

/* =================================
   MODAL
   ================================= */

.quiz-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
  visibility: visible !important;
}

.quiz-modal.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: #0a1525;
  border: 1px solid rgba(74, 144, 217, 0.15);
  border-radius: 6px;
  padding: 1.25rem;
  width: 90%;
  max-width: 450px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1rem 0;
}

.form-field {
  margin-bottom: 0.75rem;
}

.form-field label {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-size: 0.8rem;
}

.form-field textarea {
  min-height: 80px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: rgba(74, 144, 217, 0.4);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* =================================
   QUESTION ROW OVERRIDES (in quiz context)
   ================================= */

.questions-container .question-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin: 0.25rem 0;
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
}

.questions-container .question-row.validated {
  /* Clean look - no border */
}

.questions-container .question-row.pending {
  /* Clean look - no border */
}

.questions-container .question-row:hover {
  background: rgba(74, 144, 217, 0.05);
}

.questions-container .question-row.filter-hidden {
  display: none !important;
}

/* Question Row Actions (toggle + expand) */
.question-row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Mini admin toggle for questions */
.admin-toggle-mini {
  padding: 2px 6px;
  margin-right: 0;
  font-size: 0.65rem;
}

.admin-toggle-mini .admin-toggle-dot {
  width: 5px;
  height: 5px;
}

.admin-toggle-mini .admin-toggle-status {
  font-size: 0.6rem;
}

/* Visual feedback when question is off/pending */
.question-row[data-status="pending"] {
  opacity: 0.6;
}

.question-row[data-status="pending"]:hover {
  opacity: 0.85;
}

.question-row[data-status="validated"] {
  opacity: 1;
}

/* =================================
   CODE SNIPPET EDITOR (in question details)
   ================================= */

.question-code-section {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 144, 217, 0.15);
  border-radius: 6px;
}

.code-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.code-section-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.code-lang-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.code-lang-select:hover {
  background: rgba(74, 144, 217, 0.1);
  border-color: rgba(74, 144, 217, 0.3);
}

.code-lang-select option {
  background: #1a1a1a;
  color: rgba(255, 255, 255, 0.8);
}

.code-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  resize: vertical;
  min-height: 80px;
  tab-size: 4;
}

.code-textarea:focus {
  outline: none;
  border-color: rgba(74, 144, 217, 0.4);
  background: rgba(0, 0, 0, 0.5);
}

.code-textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}

/* =================================
   RESPONSIVE
   ================================= */

@media (max-width: 768px) {
  .quiz-admin-container {
    padding: 0.75rem;
  }
  
  .quiz-stats-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  
  .difficulty-mini {
    margin-left: 0;
    margin-top: 0.35rem;
  }
  
  .quiz-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }
  
  .toolbar-left,
  .toolbar-right {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .quiz-input-search,
  .quiz-input-create {
    width: 90px;
  }
  
  .config-grid {
    grid-template-columns: 1fr;
  }
  
  .analytics-overview {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .class-stat-row .class-name {
    min-width: 70px;
  }
}

/* =================================
   Question Performance Grid
   ================================= */

.question-performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.question-perf-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 0.75rem;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s;
}

.question-perf-card:hover {
  border-color: rgba(74, 144, 217, 0.3);
}

.question-perf-card:hover .qp-answers-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.qp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.qp-number {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.qp-wrong {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
}

.qp-wrong.error-high {
  background: rgba(248, 113, 113, 0.15);
  color: rgba(248, 113, 113, 0.9);
}

.qp-wrong.error-medium {
  background: rgba(251, 191, 36, 0.15);
  color: rgba(251, 191, 36, 0.9);
}

.qp-wrong.error-low {
  background: rgba(74, 222, 128, 0.15);
  color: rgba(74, 222, 128, 0.9);
}

.qp-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.qp-answers-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(15, 15, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.75rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.2s;
  margin-top: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip-title {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.tooltip-answer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.tooltip-answer.correct {
  color: rgba(74, 222, 128, 0.9);
}

.tooltip-letter {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 500;
}

.tooltip-answer.correct .tooltip-letter {
  background: rgba(74, 222, 128, 0.15);
}

/* =================================
   QUESTION PERFORMANCE - ENHANCED
   ================================= */

.analytics-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.analytics-section-header h3 {
  margin: 0;
}

.question-sort-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: lowercase;
}

.sort-btn {
  font-size: 0.7rem;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--x0ne-font-mono);
  text-transform: lowercase;
}

.sort-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

.sort-btn.active {
  background: rgba(74, 144, 217, 0.15);
  border-color: rgba(74, 144, 217, 0.3);
  color: rgba(74, 144, 217, 0.9);
}

/* Enhanced Question Card */
.question-perf-card.is-trap {
  border: 1px solid rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.03);
}

.qp-index {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--x0ne-font-mono);
}

.qp-trap {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(248, 113, 113, 0.2);
  color: rgba(248, 113, 113, 1);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: pulse-trap 2s infinite;
}

@keyframes pulse-trap {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.qp-warning {
  font-size: 0.6rem;
  font-weight: 500;
  padding: 2px 6px;
  background: rgba(251, 191, 36, 0.15);
  color: rgba(251, 191, 36, 0.9);
  border-radius: 3px;
  text-transform: lowercase;
}

.qp-success {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: auto;
}

.qp-success.high {
  background: rgba(74, 222, 128, 0.15);
  color: rgba(74, 222, 128, 0.9);
}

.qp-success.mid {
  background: rgba(251, 191, 36, 0.15);
  color: rgba(251, 191, 36, 0.9);
}

.qp-success.low {
  background: rgba(248, 113, 113, 0.15);
  color: rgba(248, 113, 113, 0.9);
}

/* Answer Distribution Bars */
.qp-distribution {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qp-dist-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qp-dist-letter {
  font-size: 0.6rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  width: 14px;
  text-align: center;
  font-family: var(--x0ne-font-mono);
}

.qp-dist-letter.correct {
  color: rgba(74, 222, 128, 0.9);
}

.qp-dist-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.qp-dist-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.qp-dist-bar.correct {
  background: rgba(74, 222, 128, 0.6);
}

.qp-dist-bar.wrong {
  background: rgba(255, 255, 255, 0.15);
}

.qp-dist-bar.wrong-high {
  background: rgba(248, 113, 113, 0.4);
}

.qp-dist-pct {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  width: 28px;
  text-align: right;
  font-family: var(--x0ne-font-mono);
}

/* Answer text tooltip on hover */
.qp-dist-row {
  position: relative;
  cursor: pointer;
}

.qp-dist-row::after {
  content: attr(title);
  position: absolute;
  left: 0;
  bottom: 100%;
  background: rgba(10, 10, 15, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  line-height: 1.4;
  white-space: normal;
  max-width: 300px;
  min-width: 150px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.qp-dist-row:hover::after {
  opacity: 1;
  visibility: visible;
}

