/* Homework Dashboard Styles - Following LingoLugo Teacher Style Guide */

/* Font family */
.homework-dashboard,
.homework-dashboard * {
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.homework-dashboard {
  min-height: 100vh;
  background: var(--background-gradient);
  padding: 2rem 1rem;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(to bottom, #8ea5f6, #6564b6) border-box;
  border: 4px solid transparent;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.dashboard-container > h1 {
  padding: 2rem;
  margin: 0;
  color: rgb(97, 2, 121);
  font-size: 2rem;
  font-weight: 700;
  background: white;
  border-bottom: 2px solid #e0e0e0;
}

/* Navigation */
.dashboard-nav {
  padding: 1rem 2rem;
  border-bottom: 2px solid #e0e0e0;
  background: #f9f9f9;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid #e0e0e0;
  background: white;
  color: #6564b6;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background-color: #f5f5f5;
  border-color: #6564b6;
}

.nav-btn.active {
  background-color: #6564b6;
  color: white;
  border-color: #6564b6;
}

/* Two Panel Layout */
.two-panel-layout {
  display: flex;
  position: relative;
  min-height: 600px;
}

.student-panel,
.exercise-panel {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 250px);
}

.student-panel {
  flex-shrink: 0;
  background: #f9f9f9;
}

.exercise-panel {
  flex: 1;
  background: white;
}

/* Resize Handle */
.resize-handle {
  width: 8px;
  background: #e0e0e0;
  cursor: col-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  user-select: none;
}

.resize-handle:hover,
.resize-handle:active {
  background: #6564b6;
}

.resize-handle-line {
  width: 2px;
  height: 60px;
  background: white;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.resize-handle:hover .resize-handle-line,
.resize-handle:active .resize-handle-line {
  opacity: 1;
}

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

.panel-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
}

.deselect-all-btn {
  padding: 0.5rem 1rem;
  background: #6564b6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.deselect-all-btn:hover {
  background: #4f4e9b;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(101, 100, 182, 0.3);
}

.deselect-all-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(101, 100, 182, 0.3);
}

/* Filters */
.filters,
.exercise-filters,
.monitor-filters,
.analytics-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.monitor-filters {
  padding: 1rem 1rem 0 1rem;
}

.filters select,
.filters input,
.exercise-filters select,
.monitor-filters select,
.monitor-filters input,
.analytics-filters select {
  flex: 1;
  min-width: 150px;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.filters select:focus,
.filters input:focus,
.exercise-filters select:focus,
.monitor-filters select:focus,
.monitor-filters input:focus,
.analytics-filters select:focus {
  outline: none;
  border-color: #6564b6;
}

.filters input[type="search"],
.monitor-filters input[type="search"],
.exercise-filters input[type="search"] {
  background: white url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%236564b6" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 12px center;
  padding-left: 40px;
}

/* Exercise title search - wider than other selects */
.exercise-title-search {
  flex: 1.5 !important;
  min-width: 200px;
  padding: 0.75rem 0.75rem 0.75rem 40px;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.exercise-title-search:focus {
  outline: none;
  border-color: #6564b6;
}

/* Results Indicator */
.results-indicator {
  margin: 0.5rem 0 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: #666;
  background: transparent;
  border: 1px solid #ff9800;
  border-radius: 6px;
  text-align: center;
}

/* Student List */
.student-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.student-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.student-row:first-child {
  border-top: 1px solid #e0e0e0;
}

.student-row:hover {
  background: #f9f9f9;
}

.student-row:has(.student-checkbox:checked) {
  background: #f5f5ff;
  border-color: #6564b6;
}

.student-row.keyboard-focused {
  outline: 2px solid #6564b6;
  outline-offset: -2px;
  background: #f0f0ff;
  z-index: 1;
  position: relative;
}

.student-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #6564b6;
  flex-shrink: 0;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  justify-content: space-between;
}

.student-name {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ff9800;
  color: white;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: auto;
}

/* Status Dot */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  cursor: help;
  transition: transform 0.2s;
}

.status-dot:hover {
  transform: scale(1.3);
}

/* Status colors based on last active time */
.status-dot.active-2h {
  background-color: #81c784;
  box-shadow: 0 0 4px rgba(129, 199, 132, 0.5);
}

.status-dot.active-24h {
  background-color: #4caf50;
  box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
}

.status-dot.active-3d {
  background-color: #66bb6a;
}

.status-dot.active-1w {
  background-color: #81c784;
}

.status-dot.active-2w {
  background-color: #a5d6a7;
}

.status-dot.active-1m {
  background-color: #c8e6c9;
}

.status-dot.active-3m {
  background-color: #e0e0e0;
}

.status-dot.active-old {
  background-color: #bdbdbd;
}

.status-dot.never-active {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
}

.weakness-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tag.priority-high {
  background: #ffebee;
  color: #c62828;
}

.tag.priority-medium {
  background: #fff3e0;
  color: #f57c00;
}

.student-stats {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #666;
}

/* Exercise Browser */
.recommendations,
.exercise-browser {
  margin-bottom: 2rem;
}

.recommendations h3,
.exercise-browser h3 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.25rem;
  font-weight: 600;
}

.recommendation-cards,
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.exercise-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 1.25rem;
  transition: all 0.3s ease;
  position: relative;
}

/* Three-dot menu */
.exercise-menu {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
}

.menu-trigger {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: #666;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.menu-trigger:hover {
  background: #f0f0f0;
  color: #333;
}

.menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: white;
  text-align: left;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

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

.menu-item:hover {
  background: #f5f5f5;
}

.menu-item.delete-warning {
  color: #d32f2f;
}

.menu-item.delete-warning:hover {
  background: #ffebee;
}

.exercise-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #6564b6;
}

.exercise-card.recommended {
  border-color: #4caf50;
  background: #f1f8f4;
}

.recommendation-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  background: #4caf50;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.exercise-card h4 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

.exercise-card p {
  margin: 0 0 1rem 0;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.metadata {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #666;
  flex-wrap: wrap;
}

.metadata .level {
  background: #6564b6;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
}

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

/* Buttons - Following Teacher Style Guide */
.preview-btn,
.assign-btn,
.btn-small,
.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.preview-btn,
.btn-secondary {
  background-color: white;
  color: #6564b6;
  border: 2px solid #6564b6;
}

.preview-btn:hover,
.btn-secondary:hover {
  background-color: #f5f5f5;
}

.assign-btn,
.btn-primary {
  background-color: #6564b6;
  color: white;
  border: none;
}

.assign-btn:hover,
.btn-primary:hover {
  background-color: #534f9a;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  background-color: #6564b6;
  color: white;
}

.btn-small:hover {
  background-color: #534f9a;
}

/* Delete button styling */
.btn-delete {
  background-color: #e57373;
  margin-left: 0.5rem;
}

.btn-delete:hover {
  background-color: #ef5350;
}

/* Actions cell - inline buttons */
.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Modal Styles */
.modal,
.modal-overlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 15px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-header h3,
.modal-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
}

.exercise-title {
  margin: 0 0 1rem 0;
  color: rgb(97, 2, 121);
  font-size: 1.5rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  transition: color 0.3s;
}

.close-btn:hover {
  color: #6564b6;
}

.preview-content,
.assignment-form,
.modal-body {
  padding: 1.5rem;
}

.preview-content {
  position: relative;
  max-height: 70vh;
  overflow-y: auto;
}

.exercise-info {
  margin-bottom: 1.5rem;
}

.exercise-info p {
  margin: 0.5rem 0;
  color: #666;
}

.questions-preview {
  margin-top: 1.5rem;
}

.questions-preview h4 {
  margin: 0 0 1rem 0;
  color: #333;
  font-weight: 600;
}

.question-item {
  background: #f9f9f9;
  border-left: 4px solid #6564b6;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.question-item p {
  margin: 0.5rem 0;
}

/* Original text context (personalized writing exercises) */
.question-item .original-text-context {
  color: #666;
  font-size: 0.9em;
  font-style: italic;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f0f0f0;
  border-left: 3px solid #667eea;
  border-radius: 3px;
}

/* Bold correct answers in preview mode */
.question-item .correct-answer {
  font-weight: bold;
  color: #2e7d32;
}

/* Feedback and explanation styling in preview mode */
.option-feedback {
  color: #502f77;
  font-size: 14px;
  margin-left: 20px;
  margin-top: 4px;
  padding: 4px 8px;
  background-color: rgba(80, 47, 119, 0.05);
  border-left: 3px solid #502f77;
  border-radius: 0 4px 4px 0;
  font-style: italic;
}

.general-feedback {
  color: #502f77;
  font-size: 15px;
  margin-top: 15px;
  padding: 10px 15px;
  background-color: rgba(80, 47, 119, 0.03);
  border: 1px solid rgba(80, 47, 119, 0.2);
  border-radius: 8px;
  line-height: 1.5;
}

.general-feedback::before {
  content: "💡 Explanation: ";
  font-weight: 600;
  color: #502f77;
}

.modal-actions,
.modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 2px solid #e0e0e0;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #6564b6;
}

.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.3s;
}

.form-group textarea:focus {
  outline: none;
  border-color: #6564b6;
}

.form-group textarea::placeholder {
  color: #999;
  font-style: italic;
}

/* Assignments Table */
.assignment-grid {
  padding: 1.5rem;
  overflow-x: auto;
}

.assignments-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  background: white;
}

.assignments-table th,
.assignments-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.assignments-table th {
  background: #f9f9f9;
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

.assignments-table td {
  color: #666;
}

.assignments-table tr:hover {
  background: #f9f9f9;
}

.assignments-table tbody tr:has(.assignment-checkbox:checked) {
  background-color: #f5f5ff;
  border-left: 3px solid #6564b6;
}

.assignment-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.status-assigned {
  background: #e3f2fd;
  color: #1976d2;
}

.status-badge.status-in_progress {
  background: #fff3e0;
  color: #f57c00;
}

.status-badge.status-completed {
  background: #e8f5e9;
  color: #388e3c;
}

.status-badge.status-overdue {
  background: #ffebee;
  color: #c62828;
}

/* No Results & Empty States */
.no-results,
.no-selection,
.no-data {
  text-align: center;
  padding: 3rem 1rem;
  color: #999;
}

.no-results p,
.no-selection p,
.no-data p {
  margin: 0;
  font-size: 1.1rem;
}

/* Loading States */
.loading,
.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: #999;
}

.loading-spinner::before {
  content: '';
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 5px solid rgba(101, 100, 182, 0.3);
  border-radius: 50%;
  border-top-color: #6564b6;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Analytics Container */
.analytics-container {
  padding: 1.5rem;
}

.analytics-container h2 {
  color: rgb(97, 2, 121);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Alpine.js cloak */
[x-cloak] {
  display: none !important;
}

/* ========================================================================
   ANALYTICS STYLES
   ======================================================================== */

/* Summary Cards */
.analytics-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.summary-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #6564b6;
}

.summary-card .card-icon {
  font-size: 32px;
}

.summary-card .card-content h3 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #6564b6;
}

.summary-card .card-content p {
  margin: 4px 0 0 0;
  font-size: 14px;
  color: #666;
}

/* Analytics Sections */
.analytics-section {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  margin-bottom: 30px;
}

.analytics-section h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.section-description {
  color: #666;
  font-size: 14px;
  margin: 0 0 24px 0;
}

/* Analytics Accordions */
.accordion-section {
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.accordion-header:hover {
  background: #f9f9f9;
}

.accordion-title h3 {
  margin-bottom: 4px;
}

.accordion-title .section-description {
  margin-bottom: 0;
}

.accordion-icon {
  transition: transform 0.2s ease;
  font-size: 18px;
  color: #666;
}

.accordion-icon-open {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 24px 24px 24px;
}

.accordion-body .student-summaries-table,
.accordion-body .weaknesses-list,
.accordion-body .no-data,
.accordion-body .progress-by-part-graph {
  margin-top: 8px;
}

/* Weaknesses List */
.weaknesses-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.weakness-item {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  padding: 20px;
  transition: all 0.3s;
}

.weakness-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #6564b6;
}

.weakness-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.weakness-name {
  font-weight: 600;
  font-size: 16px;
  color: #333;
}

.weakness-badge {
  background: #6564b6;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.weakness-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
}

.weakness-stats .stat {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weakness-stats .stat-label {
  color: #666;
  font-size: 14px;
}

.weakness-stats .stat-value {
  font-weight: 600;
  font-size: 14px;
}

.weakness-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Confidence Score Colors */
.confidence-competent,
.confidence-confident {
  color: #4caf50;
  font-weight: 600;
}

.confidence-progressing {
  color: #81c784;
  font-weight: 600;
}

.confidence-struggling,
.confidence-flagged {
  color: #ff9800;
  font-weight: 600;
}

.confidence-not-competent {
  color: #d32f2f;
  font-weight: 600;
}

/* Student Summaries Table */
.student-summaries-table {
  overflow-x: auto;
}

.student-summaries-table table {
  width: 100%;
  border-collapse: collapse;
}

.student-summaries-table th,
.student-summaries-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.student-summaries-table th {
  background: #f9f9f9;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.student-summaries-table td {
  font-size: 14px;
  color: #666;
}

.student-summaries-table tr:hover {
  background: #f9f9f9;
}

.student-summaries-table .badge {
  background: #e0e0e0;
  color: #333;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.student-summaries-table .badge-warning {
  background: #ff9800;
  color: white;
}

/* Chart Section */
.analytics-chart-section {
  margin-bottom: 32px;
}

.analytics-chart-section h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.analytics-chart-section canvas {
  max-height: 300px;
}

/* Progress by Part Graph */
.progress-by-part-graph {
  position: relative;
  width: 100%;
  min-height: 260px;
}

/* Student Weaknesses Section */
.student-weaknesses-section {
  margin-bottom: 32px;
}

.student-weaknesses-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.weakness-detail-item {
  background: #f9f9f9;
  border-left: 4px solid #6564b6;
  padding: 16px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.weakness-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.weakness-info .tag-name {
  font-weight: 600;
  font-size: 15px;
  color: #333;
}

.weakness-info .confidence-score {
  font-weight: 700;
  font-size: 16px;
  padding: 4px 12px;
  border-radius: 12px;
  background: #e0e0e0;
}

.weakness-info .status-not_competent {
  background: #ffebee;
  color: #c62828;
}

.weakness-info .status-flagged {
  background: #fff3e0;
  color: #f57c00;
}

.weakness-info .status-struggling {
  background: #fffde7;
  color: #f9a825;
}

.weakness-info .status-progressing {
  background: #e8f5e9;
  color: #388e3c;
}

.weakness-info .status-confident {
  background: #c8e6c9;
  color: #2e7d32;
}

.weakness-info .status-competent {
  background: #a5d6a7;
  color: #1b5e20;
}

.weakness-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #666;
}

.weakness-meta .trend {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.weakness-meta .trend-improving {
  background: #e8f5e9;
  color: #388e3c;
}

.weakness-meta .trend-stable {
  background: #e3f2fd;
  color: #1976d2;
}

.weakness-meta .trend-declining {
  background: #ffebee;
  color: #c62828;
}

/* Recent Activity Section */
.recent-activity-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.activity-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.activity-stats .stat-item {
  background: #f9f9f9;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-stats .stat-label {
  font-size: 13px;
  color: #666;
}

.activity-stats .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #333;
}

.activity-stats .stat-value.success {
  color: #4caf50;
}

.activity-stats .stat-value.error {
  color: #d32f2f;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .two-panel-layout {
    grid-template-columns: 350px 1fr;
  }

  .recommendation-cards,
  .exercise-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .homework-dashboard {
    padding: 1rem 0.5rem;
  }

  .dashboard-container > h1 {
    padding: 1.5rem;
    font-size: 1.5rem;
  }

  .two-panel-layout {
    flex-direction: column;
  }

  .student-panel {
    width: 100% !important;
    max-height: 400px;
    border-bottom: 2px solid #e0e0e0;
  }

  .exercise-panel {
    width: 100% !important;
    max-height: none;
  }

  .resize-handle {
    display: none;
  }

  .view-toggle {
    flex-direction: column;
  }

  .nav-btn {
    width: 100%;
  }

  .recommendation-cards,
  .exercise-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .exercise-filters,
  .monitor-filters {
    flex-direction: column;
  }

  .filters select,
  .filters input,
  .exercise-filters select,
  .monitor-filters select {
    width: 100%;
  }

  .assignments-table {
    font-size: 0.85rem;
  }

  .assignments-table th,
  .assignments-table td {
    padding: 0.75rem 0.5rem;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .analytics-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .weakness-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .weakness-stats {
    flex-direction: column;
    gap: 8px;
  }

  .modal-content.modal-large {
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
  }

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

@media (max-width: 480px) {
  .dashboard-container > h1 {
    font-size: 1.25rem;
    padding: 1rem;
  }

  .metadata {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-actions {
    flex-direction: column;
  }

  .preview-btn,
  .assign-btn {
    width: 100%;
  }
}

/* ========== IMPORT SECTION ========== */

.import-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.import-container h2 {
  color: rgb(97, 2, 121);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.section-intro {
  color: #666;
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.required {
  color: #e57373;
  font-weight: bold;
}

/* GIFT Textarea */
.gift-textarea {
  width: 100%;
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.3s;
  background: #fafafa;
}

.gift-textarea:focus {
  border-color: #6564b6;
  outline: none;
  background: white;
}

/* Form Layout */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Searchable Tag Dropdown */
.searchable-tag-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.tag-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.tag-search-input:focus {
  border-color: #6564b6;
  outline: none;
}

.tag-dropdown-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 2px solid #6564b6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.tag-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.tag-option:last-child {
  border-bottom: none;
}

.tag-option:hover,
.tag-option.selected {
  background-color: #f5f3ff;
}

.tag-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
}

.tag-category-small {
  font-size: 0.85rem;
  color: #888;
}

/* Selected Tag Pill */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.tag-category-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
}

.tag-pill button {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  font-size: 1.2rem;
  font-weight: bold;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tag-pill button:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Tag Description */
.tag-description {
  margin-top: 0.75rem;
  padding: 1rem;
  background: #f9f9f9;
  border-left: 4px solid #6564b6;
  border-radius: 4px;
}

.tag-description strong {
  display: block;
  color: #6564b6;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.tag-description p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
  font-style: italic;
}

/* Import Button */
.btn-import {
  width: 100%;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: not-allowed;
  background: #e0e0e0;
  color: #999;
  transition: all 0.3s ease;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-import.btn-enabled {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(101, 100, 182, 0.3);
}

.btn-import.btn-enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(101, 100, 182, 0.4);
}

.btn-import.btn-enabled:active {
  transform: translateY(0);
}

.btn-import:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Notification Container */
#notification-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  min-width: 300px;
  max-width: 500px;
}

#notification-container .notification {
  padding: 1rem 1.5rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#notification-container .notification.success {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  color: #2e7d32;
}

#notification-container .notification.error {
  background: #ffebee;
  border-left: 4px solid #e57373;
  color: #c62828;
}

#notification-container .notification.fadeOut {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* Success Message */
.success-message {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  border-radius: 8px;
  color: #2e7d32;
}

.success-message h4 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  color: #2e7d32;
}

.success-message p {
  margin: 0.5rem 0;
}

.success-message .small-text {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  opacity: 0.8;
}

.success-message code {
  background: rgba(46, 125, 50, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

/* Error Messages */
.error-message {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #ffebee;
  border-left: 4px solid #e57373;
  border-radius: 8px;
  color: #c62828;
}

.error-message h4 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  color: #c62828;
}

.error-message ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.5rem;
}

.error-message li {
  margin: 0.75rem 0;
  line-height: 1.5;
}

.error-context {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 4px;
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  color: #e65100;
  overflow-x: auto;
}

/* Form Hints */
.form-hint {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Cyclical Mode Compatibility Warning */
.cyclical-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #856404;
}

.cyclical-warning .warning-icon {
  flex-shrink: 0;
}

.cyclical-warning strong {
  color: #664d03;
}

select.has-warning {
  border-color: #ffc107;
  background-color: #fffbf0;
}

.incompatible-hint {
  color: #856404;
  font-style: italic;
}

select option:disabled {
  color: #999;
}

/* ===== Assignment Modal Styling ===== */

/* Modal header with purple title */
#assignment-modal .modal-header h3 {
  color: rgb(97, 2, 121);
  font-weight: 700;
}

/* Assignment modal content - prevent scrollbar from affecting layout */
#assignment-modal .modal-content {
  overflow-y: overlay;
  scrollbar-gutter: stable;
}

/* Assignment form with generous side padding */
#assignment-modal .assignment-form {
  padding: 1.5rem 2.5rem !important;
  box-sizing: border-box;
}

/* Form group labels */
#assignment-modal .form-group label {
  color: rgb(97, 2, 121);
  font-size: 0.95rem;
}

/* Exercises list - clean styling */
#assignment-modal .exercises-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

#assignment-modal .exercises-list li {
  padding: 0.4rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#assignment-modal .exercises-list li:not(:last-child) {
  border-bottom: 1px solid #eee;
}

#assignment-modal .exercises-list li span:first-child {
  font-weight: 600;
  color: #333;
}

#assignment-modal .exercise-meta {
  font-size: 0.85rem;
  color: #888;
  font-weight: 400 !important;
}

/* Students summary - clean styling */
#assignment-modal .students-summary {
  margin: 0.25rem 0 0 0;
  padding: 0;
  color: #333;
  font-weight: 500;
  line-height: 1.5;
}

/* Full-width form groups (exercises, title, message) */
#assignment-modal .form-group-full {
  margin-bottom: 1.25rem;
}

/* Compact settings grid for smaller fields */
#assignment-modal .compact-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem 2rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

#assignment-modal .compact-settings-grid .form-group {
  margin-bottom: 0;
  min-width: 0;
}

#assignment-modal .compact-settings-grid input,
#assignment-modal .compact-settings-grid select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  box-sizing: border-box;
}

/* Select dropdown styling */
#assignment-modal select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

#assignment-modal select:focus {
  outline: none;
  border-color: #6564b6;
}

/* Assignment summary - subtle styling */
#assignment-modal .assignment-summary {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 3px solid #6564b6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#assignment-modal .assignment-summary::before {
  content: "⏱";
  font-size: 1rem;
}

#assignment-modal .summary-label {
  color: #666;
  font-weight: 500;
}

#assignment-modal .summary-value {
  color: #333;
  font-weight: 700;
}

/* Modal actions */
#assignment-modal .modal-actions {
  background: #fafafa;
}

#assignment-modal .btn-primary {
  background-color: #6564b6;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.2s;
}

#assignment-modal .btn-primary:hover {
  background-color: #534f9a;
  transform: translateY(-1px);
}

#assignment-modal .btn-secondary {
  background-color: white;
  color: #6564b6;
  border: 2px solid #6564b6;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: background-color 0.3s;
}

#assignment-modal .btn-secondary:hover {
  background-color: #f5f5f5;
}

/* ===== End Assignment Modal Styling ===== */

/* Utility Classes */
.text-muted {
  color: #999;
}

/* Transitions */
[x-cloak] {
  display: none !important;
}

.success-message,
.error-message {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Adjustments for Import */
@media (max-width: 768px) {
  .import-container {
    padding: 1rem;
  }

  .import-container h2 {
    font-size: 1.5rem;
  }

  .btn-import {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }

  .gift-textarea {
    font-size: 0.85rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================ */
/* ASSIGNMENT VIEW MODAL STYLES */
/* ============================================================ */

.assignment-view-content {
  padding: 1rem 0;
}

/* Assignment Info Bar */
.assignment-info-bar {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-label {
  font-weight: 600;
  color: #666;
  font-size: 0.9rem;
}

.info-value {
  color: #333;
  font-size: 0.95rem;
}

/* Exercise Navigation */
.exercise-navigation {
  margin-bottom: 1.5rem;
}

.exercise-navigation h4 {
  margin: 0 0 1rem 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

.exercise-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.exercise-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.exercise-tab:hover {
  border-color: #6564b6;
  background: #f5f5ff;
}

.exercise-tab.active {
  background: #6564b6;
  border-color: #6564b6;
  color: white;
}

.tab-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  background: rgba(101, 100, 182, 0.1);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.85rem;
}

.exercise-tab.active .tab-number {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.tab-title {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Current Exercise View */
.current-exercise-view {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.5rem;
}

.exercise-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.exercise-header h4 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.25rem;
  font-weight: 600;
}

.exercise-header p {
  margin: 0 0 0.75rem 0;
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
}

.exercise-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: #888;
}

.exercise-meta span {
  font-weight: 500;
}

/* Question Navigation */
.question-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.nav-arrow-btn {
  padding: 0.6rem 1.25rem;
  background: white;
  border: 2px solid #6564b6;
  color: #6564b6;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.nav-arrow-btn:hover:not(:disabled) {
  background: #6564b6;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(101, 100, 182, 0.3);
}

.nav-arrow-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #e0e0e0;
  color: #999;
}

.question-counter {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}

/* Difficulty Badge */
.difficulty-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
  position: relative;
}

/* Instant tooltip using data-tooltip attribute */
.difficulty-badge[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  padding: 6px 10px;
  background: #333;
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  z-index: 1000;
  pointer-events: none;
}

/* Tooltip arrow */
.difficulty-badge[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  border: 4px solid transparent;
  border-top-color: #333;
  z-index: 1000;
  pointer-events: none;
}

.difficulty-very-easy {
  background-color: #22c55e;
  color: white;
}

.difficulty-easy {
  background-color: #84cc16;
  color: white;
}

.difficulty-medium {
  background-color: #f59e0b;
  color: white;
}

.difficulty-difficult {
  background-color: #ef4444;
  color: white;
}

.difficulty-impossible {
  background-color: #1f2937;
  color: white;
}

.difficulty-insufficient-data {
  background-color: #9ca3af;
  color: white;
}

.difficulty-loading {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
}

/* ===================================================================
   ATTEMPT BARS VISUALIZATION
   =================================================================== */

/* Attempts column header */
.attempts-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: visible !important; /* Override table th overflow:hidden to show tooltip */
}

.attempts-header:hover .load-icon {
  color: var(--primary-color, #6564b6);
}

/* Instant hover tooltip for attempts header */
.attempts-header[data-hover-tooltip]:not([data-hover-tooltip=""]):hover::after {
  content: attr(data-hover-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  padding: 8px 14px;
  background: #333;
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.attempts-header[data-hover-tooltip]:not([data-hover-tooltip=""]):hover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  border: 6px solid transparent;
  border-bottom-color: #333;
  z-index: 1000;
  pointer-events: none;
}

.attempts-header .load-icon {
  margin-left: 4px;
  opacity: 0.6;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.attempts-header .load-icon .attempt-viz-icon {
  color: #888;
  transition: color 0.2s ease, transform 0.2s ease;
}

.attempts-header:hover .load-icon .attempt-viz-icon {
  color: #6564b6;
  transform: scale(1.1);
}

/* Loaded state icon */
.attempts-header .loaded-icon {
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  opacity: 0.7;
}

.attempts-header .loaded-icon .attempt-viz-icon.loaded {
  opacity: 0.6;
}

.attempts-header.loading {
  opacity: 0.7;
}

.attempts-header .loading-spinner {
  margin-left: 4px;
  opacity: 0.6;
}

/* Auto-appearing tooltip for attempts visualization hint */
.attempts-header .viz-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  padding: 8px 14px;
  background: #333;
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  opacity: 0;
  animation: vizTooltipFadeInOut 2.5s ease-in-out forwards;
}

.attempts-header .viz-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #333;
}

@keyframes vizTooltipFadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
}

/* Attempts cell content wrapper */
.attempts-cell-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 50px;
}

/* Attempt bars container */
.attempt-bars-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
  padding: 2px 0;
}

/* Ensure table cells don't clip tooltips */
.assignments-table td:has(.attempt-bars-container) {
  overflow: visible !important;
  position: relative;
}

/* Also ensure the row doesn't clip */
.assignments-table tr:has(.attempt-bars-container) {
  overflow: visible;
}

/* Individual attempt bar */
.attempt-bar {
  width: 6px;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  position: relative;
  cursor: default;
}

/* Instant tooltip for attempt bars */
.attempt-bar[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  padding: 6px 10px;
  background: #333;
  color: white;
  font-size: 0.75rem;
  white-space: nowrap;
  border-radius: 4px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Tooltip arrow */
.attempt-bar[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  border: 5px solid transparent;
  border-top-color: #333;
  z-index: 9999;
  pointer-events: none;
}

/* Bar colors based on score percentage */
.attempt-bar-red {
  background-color: #ef4444;
}

.attempt-bar-orange {
  background-color: #f97316;
}

.attempt-bar-yellow {
  background-color: #eab308;
}

.attempt-bar-lightgreen {
  background-color: #84cc16;
}

.attempt-bar-green {
  background-color: #22c55e;
}

/* Question Display */
.question-display {
  min-height: 200px;
}

.question-content {
  background: #fafafa;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  padding: 1.5rem;
}

.question-stem {
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  font-weight: 500;
}

.question-fallback {
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  margin: 0;
}

/* Choices List */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.choice-item.correct-choice {
  border-color: #4caf50;
  background: white; /* Changed from pale green to white per requirements */
}

.choice-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: #6564b6;
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.choice-item.correct-choice .choice-id {
  background: #4caf50;
}

.choice-text {
  flex: 1;
  color: #333;
  font-size: 0.95rem;
  line-height: 1.5;
}

.correct-indicator {
  color: #4caf50;
  font-size: 1.25rem;
  font-weight: bold;
  flex-shrink: 0;
}

/* ===== Attempt Visualization Styles ===== */

/* Wrong attempt styling for MCQ choices */
.choice-item.wrong-attempt {
  border-color: #ef5350;
  background: #ffebee;
}

.choice-item.wrong-attempt .choice-id {
  background: #ef5350;
}

/* Attempt label badge */
.attempt-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.attempt-label.wrong {
  background: #ef5350;
  color: white;
}

.attempt-x {
  font-size: 0.85rem;
  font-weight: bold;
}

/* Correct attempt styling for MCQ choices (student got it right after wrong attempts) */
.choice-item.correct-attempt {
  border-color: #4caf50;
  background: #e8f5e9;
}

.choice-item.correct-attempt .choice-id {
  background: #4caf50;
}

.attempt-label.correct {
  background: #4caf50;
  color: white;
}

.attempt-check {
  font-size: 0.85rem;
  font-weight: bold;
}

/* Text input attempts section */
.text-input-attempts {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.wrong-attempts-list {
  margin-bottom: 1rem;
}

.wrong-attempt-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #ffebee;
  border: 2px solid #ef5350;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.wrong-answer-text {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.95rem;
  color: #c62828;
}

/* Correct answer display for text input */
.correct-answer-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 2px solid #4caf50;
  border-radius: 6px;
  margin-top: 0.5rem;
}

.correct-answer-item .correct-indicator {
  font-size: 1.1rem;
}

.correct-answer-text {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.95rem;
  color: #2e7d32;
}

/* Multiple answers disclaimer note */
.multiple-answers-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #757575;
  font-style: italic;
}

/* Attempt history loading indicator */
.attempt-history-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  background: #f5f5f5;
  border-radius: 6px;
  color: #6564b6;
  font-size: 0.9rem;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: #6564b6;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6564b6;
  font-size: 1rem;
}

.loading-spinner p {
  margin: 0;
  font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .assignment-info-bar {
    flex-direction: column;
    gap: 0.75rem;
  }

  .exercise-tabs {
    flex-direction: column;
  }

  .exercise-tab {
    width: 100%;
  }

  .tab-title {
    max-width: none;
  }

  .question-navigation {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-arrow-btn {
    width: 100%;
  }
}

/* ===========================
   Pagination Controls
   =========================== */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  background: #f9f9f9;
  border-top: 2px solid #e0e0e0;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #6564b6, #8ea5f6);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.pagination-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(101, 100, 182, 0.3);
}

.pagination-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.page-indicator {
  font-weight: 700;
  font-size: 1rem;
  color: rgb(97, 2, 121);
}

.items-indicator {
  font-size: 0.875rem;
  color: #666;
}

.page-size-selector {
  padding: 0.5rem;
  border: 2px solid #6564b6;
  border-radius: 8px;
  background: white;
  color: rgb(97, 2, 121);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-size-selector:hover {
  border-color: #8ea5f6;
  box-shadow: 0 2px 8px rgba(101, 100, 182, 0.2);
}

/* ===========================
   Loading States
   =========================== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: rgba(255, 255, 255, 0.85);
  z-index: 10;
  border-radius: 12px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #6564b6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay p {
  color: rgb(97, 2, 121);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
}

/* Assignment Grid Loading State - keep fully interactive */
.assignment-grid.loading {
  /* No opacity change - keep table fully visible and interactive */
}

/* Floating loading spinner (centered over table) */
.floating-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e0e0ff;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #6564b6;
  box-shadow: 0 2px 12px rgba(101, 100, 182, 0.15);
  z-index: 10;
}

.floating-loading-spinner .mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0ff;
  border-top: 2px solid #6564b6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Table wrapper needs position relative for floating spinner */
.assignment-grid {
  position: relative;
  min-height: 200px;
}

/* Loading overlay for pagination */
.assignments-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 10;
  border-radius: 8px;
}

/* Wrapper is just for structure, no positioning needed */
.spinner-sticky-wrapper {
  /* Empty - wrapper kept for HTML structure */
}

/* Fixed positioning - always centered in viewport */
.spinner-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.98);
  padding: 1.5rem 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 11;
}

.spinner-content span {
  color: #4b5563;
  font-size: 0.9rem;
}

.pagination-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #6564b6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Skeleton Loading Rows */
.skeleton-row {
  animation: pulse 1.5s ease-in-out infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 20px;
}

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

.skeleton-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.skeleton-text {
  width: 100%;
  max-width: 150px;
}

.skeleton-text-short {
  width: 80px;
}

.skeleton-badge {
  width: 90px;
  height: 24px;
  border-radius: 12px;
}

.skeleton-actions {
  width: 120px;
}

/* Disabled State for Filters */
.monitor-filters select:disabled,
.monitor-filters input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

/* ===========================
   Sortable Table Headers
   =========================== */
.assignments-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  position: relative;
  padding-right: 24px;
}

.assignments-table th.sortable:hover {
  background-color: #f0f0f0;
  color: rgb(97, 2, 121);
}

.assignments-table th.sortable.sorted {
  background-color: #e8e0f0;
  color: rgb(97, 2, 121);
  font-weight: 700;
}

.assignments-table th.sortable span {
  margin-left: 4px;
  font-size: 0.9em;
  color: #6564b6;
}

/* ===========================
   Responsive Pagination
   =========================== */
@media (max-width: 768px) {
  .pagination-controls {
    flex-direction: column;
    gap: 1rem;
  }

  .pagination-btn {
    width: 100%;
    min-width: auto;
  }

  .pagination-info {
    order: -1;
  }

  .page-size-selector {
    width: 100%;
  }
}

/* ===========================
   Edit Mode Styles
   =========================== */
.btn-edit-toggle {
  padding: 0.5rem 1rem;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-edit-toggle:hover {
  background: #e0e0e0;
}

.btn-edit-toggle.active {
  background: linear-gradient(135deg, #6564b6, #8ea5f6);
  color: white;
  border-color: transparent;
}

.unsaved-indicator {
  color: #ff6b35;
  font-weight: 500;
  font-size: 0.875rem;
}

.questions-edit {
  padding: 1rem 0;
}

.questions-edit h4 {
  margin-bottom: 1rem;
  color: rgb(97, 2, 121);
}

.questions-edit h4 small {
  color: #666;
  font-weight: normal;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.question-edit-item {
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  overflow: visible; /* Ensure textareas can expand properly */
}

.question-edit-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.modified-badge {
  background: #ff6b35;
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.question-editor {
  margin-top: 0.5rem;
  width: 100%; /* Ensure full width */
}

.editor-label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: #666;
  font-size: 0.875rem;
}

.question-edit-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
  background: white;
  transition: border-color 0.2s ease;
  min-height: 120px; /* Minimum comfortable height */
  overflow: hidden; /* No scrolling - textarea auto-resizes */
  box-sizing: border-box; /* Include padding in width calculation */
}

.question-edit-textarea:focus {
  outline: none;
  border-color: #6564b6;
  box-shadow: 0 0 0 3px rgba(101, 100, 182, 0.1);
}

.saving-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 12px;
}

.saving-spinner {
  text-align: center;
}

.saving-spinner p {
  margin: 0;
  color: #6564b6;
  font-weight: 500;
  font-size: 1.125rem;
}

/* ===========================
   Status Multi-Select Dropdown
   =========================== */
.status-multiselect-wrapper {
  position: relative;
  flex: 1;
  min-width: 150px;
}

.status-multiselect-button {
  width: 100%;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.status-multiselect-button:hover:not(:disabled) {
  border-color: #6564b6;
}

.status-multiselect-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

.status-multiselect-button .dropdown-arrow {
  font-size: 0.7rem;
  color: #666;
  transition: transform 0.2s;
}

.status-multiselect-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d0d0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(101, 100, 182, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  z-index: 100;
  padding: 0.375rem 0;
  min-width: 200px;
  width: 100%;
  box-sizing: border-box;
}

.status-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  margin: 0;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.status-option:hover {
  background-color: #f8f7ff;
}

.status-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  cursor: pointer;
  accent-color: #6564b6;
  margin: 0;
  padding: 0;
  display: block;
  visibility: visible;
  opacity: 1;
  grid-column: 1;
  justify-self: start;
  flex-shrink: 0;
}

.status-option span {
  font-size: 0.9375rem;
  color: #333;
  font-weight: 400;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  min-width: 0;
  grid-column: 2;
  display: block;
}

.status-dropdown-divider {
  height: 1px;
  background: #e8e8f0;
  margin: 0.375rem 0;
}

.status-clear-button {
  width: 100%;
  padding: 0.625rem 1rem;
  background: transparent;
  border: none;
  color: #6564b6;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  letter-spacing: 0.02em;
}

.status-clear-button:hover {
  background-color: #f8f7ff;
  color: #534f9a;
}

/* ===== Format Detection Indicator ===== */
.format-indicator {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.format-badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
}

.format-badge.gift {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.format-badge.json {
  background-color: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.format-badge.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* Detected question types badges */
.detected-types {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: 0.75rem;
  font-size: 0.8125rem;
}

.question-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #f3e5f5;
  color: #7b1fa2;
  border-radius: 3px;
  font-size: 0.75rem;
  font-family: 'Consolas', 'Monaco', monospace;
}

.suggested-exercise-type {
  color: #666;
  font-style: italic;
}

.suggested-exercise-type span {
  font-weight: 600;
  color: #1565c0;
}

/* ===== JSON Templates Modal ===== */
.templates-content {
  padding: 1rem;
}

.templates-intro {
  color: #666;
  margin-bottom: 1rem;
}

.template-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e8e8f0;
  padding-bottom: 0.75rem;
}

.template-tabs button {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.template-tabs button:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

.template-tabs button.active {
  background: #6564b6;
  color: #fff;
  border-color: #6564b6;
}

.template-content {
  margin-top: 1rem;
}

.template-code {
  background: #1e1e1e;
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.template-code code {
  color: #d4d4d4;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre;
}

.btn-copy {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: #6564b6;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s ease;
}

.btn-copy:hover {
  background: #534f9a;
}

/* ===========================
   Writing Correction Preview Styles
   =========================== */
.wc-preview-container {
  background: #fafafa;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.wc-preview-legend {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #555;
  flex-wrap: wrap;
}

.wc-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wc-legend-swatch {
  display: inline-block;
  width: 20px;
  height: 16px;
  border-radius: 3px;
  vertical-align: middle;
}

.wc-legend-swatch.mistake {
  background-color: rgba(255, 180, 180, 0.6);
}

.wc-legend-swatch.tip {
  background-color: rgba(180, 255, 180, 0.5);
}

.wc-preview-text {
  font-size: 1rem;
  line-height: 1.8;
  color: #333;
  white-space: pre-wrap;
}

/* Mistake spans - red highlight with correction on hover */
.wc-preview-mistake {
  background-color: rgba(255, 180, 180, 0.6);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: help;
  position: relative;
  transition: background-color 0.2s ease;
}

.wc-preview-mistake:hover {
  background-color: rgba(255, 150, 150, 0.8);
}

/* Tip spans - green highlight with feedback on hover */
.wc-preview-tip {
  background-color: rgba(180, 255, 180, 0.5);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: help;
  position: relative;
  transition: background-color 0.2s ease;
}

.wc-preview-tip:hover {
  background-color: rgba(150, 255, 150, 0.7);
}

/* Rejected mistakes - orange highlight (filtered out, student won't see) */
.wc-preview-rejected {
  background-color: rgba(255, 200, 150, 0.6);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: help;
  position: relative;
  transition: background-color 0.2s ease;
}

.wc-preview-rejected:hover {
  background-color: rgba(255, 180, 120, 0.8);
}

.wc-legend-swatch.rejected {
  background-color: rgba(255, 200, 150, 0.6);
}

/* Tippy.js theme overrides for writing correction preview */
.tippy-box[data-theme~='dark'],
.tippy-box[data-theme~='success'],
.tippy-box[data-theme~='warning'] {
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Tippy.js theme for green (success) tooltips */
.tippy-box[data-theme~='success'] {
  background-color: #27ae60;
  color: #fff;
}

.tippy-box[data-theme~='success'] .tippy-arrow {
  color: #27ae60;
}

/* Tippy.js theme for orange (warning) tooltips */
.tippy-box[data-theme~='warning'] {
  background-color: #e67e22;
  color: #fff;
}

.tippy-box[data-theme~='warning'] .tippy-arrow {
  color: #e67e22;
}

/* Responsive adjustments for preview */
@media (max-width: 768px) {
  .wc-preview-legend {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ===================================================================
   COLUMN SETTINGS MODAL
   =================================================================== */

/* Settings Button (Cog Wheel) */
.settings-btn {
  padding: 0.6rem;
  background: #6564b6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}

.settings-btn:hover {
  background: #534f9a;
  transform: scale(1.05);
}

.settings-btn svg {
  display: block;
}

/* Settings Modal specific styles */
.settings-modal {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.column-settings-content {
  max-width: 400px;
}

.column-settings-content .modal-header h3 {
  color: #6564b6;
}

.settings-hint {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 1.5rem 0;
}

/* Column checkbox list */
.column-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.column-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f9f9f9;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.column-checkbox:hover {
  background: #f0f0f0;
}

.column-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6564b6;
  cursor: pointer;
}

.column-checkbox span {
  font-weight: 500;
  color: #333;
}

/* Drag handle for column reordering */
.column-checkbox .drag-handle {
  color: #999;
  cursor: grab;
  user-select: none;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.25rem;
  margin-left: auto;
}

.column-checkbox .drag-handle:active {
  cursor: grabbing;
}

/* Drag-and-drop states */
.column-checkbox.dragging {
  opacity: 0.5;
  background: #e0e0e0;
}

.column-checkbox.drag-over {
  border-top: 2px solid #6564b6;
  padding-top: calc(0.5rem - 2px);
}

/* Settings divider */
.settings-divider {
  border-top: 1px solid #e0e0e0;
  margin: 1rem 0;
}

.settings-section-label {
  color: #6564b6;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Exercise column wider by default */
.exercise-col {
  min-width: 200px;
}

/* Monitor filters - ensure settings button aligns properly */
.monitor-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* ===================================================================
   RESIZABLE COLUMNS
   =================================================================== */

/* Resizable column header */
.assignments-table th.resizable {
  position: relative;
}

/* Resize handle */
.assignments-table .resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  transition: background 0.2s;
  z-index: 1;
}

.assignments-table .resize-handle:hover,
.assignments-table .resize-handle:active {
  background: #6564b6;
}

/* Table needs fixed layout for resize to work properly */
.assignments-table {
  table-layout: auto;
}

/* Prevent text selection during resize */
body.column-resizing {
  cursor: col-resize !important;
  user-select: none;
}

body.column-resizing * {
  cursor: col-resize !important;
}

/* ===================================================================
   EXERCISE INFO POPOVER
   =================================================================== */

/* Clickable exercise title */
.exercise-clickable {
  cursor: pointer;
  color: #6564b6;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.exercise-clickable:hover {
  color: #534f9a;
  text-decoration-style: solid;
}

/* Popover container */
.exercise-popover {
  position: absolute;
  z-index: 1001;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
  min-width: 220px;
  max-width: 300px;
}

/* Popover header */
.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 10px 10px 0 0;
}

.popover-title {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.popover-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: 0.5rem;
}

.popover-close:hover {
  color: #6564b6;
}

/* Popover header link section */
.popover-header-link {
  background: #f9f9f9;
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

.see-all-link {
  color: #6564b6;
  text-decoration: underline;
  font-size: 0.85rem;
  cursor: pointer;
}

.see-all-link:hover {
  color: #534f9a;
}

/* Popover content */
.popover-content {
  padding: 0.75rem 1rem;
}

.popover-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.popover-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.popover-label {
  color: #666;
  font-size: 0.85rem;
}

.popover-value {
  color: #333;
  font-weight: 500;
  font-size: 0.9rem;
  text-align: right;
}

.popover-empty {
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
  margin: 0;
  text-align: center;
}

/* ===========================
   Column Context Menu (Right-Click)
   =========================== */
.column-context-menu {
  position: fixed;
  z-index: 1100;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
  min-width: 180px;
  padding: 0.5rem 0;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  text-align: left;
  transition: background-color 0.15s;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.context-menu-item:hover {
  background-color: #f5f5f5;
}

.context-menu-item svg {
  flex-shrink: 0;
  color: #666;
}

.context-menu-item:hover svg {
  color: #6564b6;
}

/* ===========================
   Date Filter with Custom Date Picker
   =========================== */
.date-filter-wrapper {
  position: relative;
  flex: 1;
  min-width: 150px;
}

.date-filter-wrapper select {
  width: 100%;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
  cursor: pointer;
}

.date-filter-wrapper select:focus {
  outline: none;
  border-color: #6564b6;
}

/* Date Filter Custom Dropdown Button */
.date-filter-button {
  width: 100%;
  padding: 0.75rem;
  background-color: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.date-filter-button:hover {
  border-color: #6564b6;
}

.date-filter-button .dropdown-arrow {
  font-size: 0.7rem;
  color: #666;
  transition: transform 0.2s;
}

/* Date Filter Dropdown Menu */
.date-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d0d0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(101, 100, 182, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
  z-index: 100;
  padding: 0.375rem 0;
  min-width: 160px;
  width: 100%;
  box-sizing: border-box;
}

.date-option {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  color: #333;
  transition: background-color 0.15s;
}

.date-option:hover {
  background-color: #f5f5fa;
}

.date-option.selected {
  background-color: #e8e8f8;
  color: #6564b6;
  font-weight: 500;
}

.date-dropdown-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0.375rem 0;
}

/* Date Picker Popover */
.date-picker-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1001;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e0e0e0;
  min-width: 280px;
  max-width: 320px;
}

.date-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

.date-popover-content {
  padding: 1rem;
}

.single-date-picker,
.date-range-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.single-date-picker label,
.date-range-picker label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #555;
  margin-bottom: 0.25rem;
}

.single-date-picker input[type="date"],
.date-range-picker input[type="date"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

.single-date-picker input[type="date"]:focus,
.date-range-picker input[type="date"]:focus {
  outline: none;
  border-color: #6564b6;
  box-shadow: 0 0 0 3px rgba(101, 100, 182, 0.1);
}

.date-range-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.date-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
  border-radius: 0 0 10px 10px;
}

.btn-clear-date {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #666;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.btn-clear-date:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
  color: #333;
}

.btn-apply-date {
  padding: 0.5rem 1rem;
  background: #6564b6;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: "Lexend Deca", "Noto Sans", Helvetica, sans-serif;
}

.btn-apply-date:hover {
  background: #5453a5;
}

/* ===========================
   Table Horizontal Scroll Buttons
   =========================== */

/* Wrapper positions the scroll buttons */
.assignment-grid-wrapper {
  position: relative;
}

.table-scroll-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  z-index: 20;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.table-scroll-btn:hover {
  opacity: 1;
}

.table-scroll-btn:active {
  opacity: 1;
}

.table-scroll-right {
  right: 0;
  background: linear-gradient(to left, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
}

.table-scroll-left {
  left: 0;
  background: linear-gradient(to right, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
}

.scroll-btn-arrow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  transition: transform 0.15s ease, top 0.05s ease;
  pointer-events: none;
}

.table-scroll-right .scroll-btn-arrow {
  border-width: 12px 0 12px 16px;
  border-color: transparent transparent transparent #6564b6;
}

.table-scroll-left .scroll-btn-arrow {
  border-width: 12px 16px 12px 0;
  border-color: transparent #6564b6 transparent transparent;
}

.table-scroll-btn:hover .scroll-btn-arrow {
  transform: translateX(-50%) scale(1.2);
}

.table-scroll-btn:active .scroll-btn-arrow {
  transform: translateX(-50%) scale(1.1);
}

/* Always show horizontal scrollbar for mouse users */
.assignment-grid {
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #f0f0f0;
}

.assignment-grid::-webkit-scrollbar {
  height: 12px;
}

.assignment-grid::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 6px;
}

.assignment-grid::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 6px;
  border: 2px solid #f0f0f0;
}

.assignment-grid::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ===========================
   Header Drag-to-Reorder
   =========================== */

/* Ghost element shown while dragging */
.header-drag-ghost {
  position: fixed;
  z-index: 1000;
  background: #6564b6;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(101, 100, 182, 0.4);
  pointer-events: none;
  opacity: 0.9;
  white-space: nowrap;
}

/* Body class during header drag */
body.header-dragging {
  cursor: grabbing !important;
  user-select: none;
}

body.header-dragging * {
  cursor: grabbing !important;
}

/* Source header being dragged */
.assignments-table th.header-drag-source {
  opacity: 0.4;
  background: #e0e0e0;
}

/* Drop target header */
.assignments-table th.header-drop-target {
  background: #e8e7f5;
  box-shadow: inset 0 0 0 2px #6564b6;
}

/* Make headers look draggable on hover */
.assignments-table th.sortable {
  cursor: grab;
}

.assignments-table th.sortable:active {
  cursor: grabbing;
}

