:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --page: #f8fafc;
  --card-bg: #ffffff;
  --radius: 16px;
  --radius-lg: 24px;
  --transition: 0.25s ease;
  --success: #10b981;
  --success-light: #34d399;
  --success-dark: #059669;
  --text-dark: #1e293b;
  --text-medium: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* Reset & base */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-y: scroll;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-medium);
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-light);
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error {
  color: #dc2626;
}

.success {
  color: #16a34a;
}

/* ---------- Logout button ---------- */
.logout-icon {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--text-medium);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 1000;
}

.logout-icon i {
  font-size: 16px;
  line-height: 1;
}

.logout-icon:hover {
  background: var(--primary);
  color: white;
}

.logout-icon:active {
  transform: translateY(1px);
}

/* ========================================
   MAIN APP STYLES
   ======================================== */

#mainApp {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
}

.app-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 30px;
  animation: fade-in 0.45s ease both;
}

.app-header {
  text-align: center;
  margin-bottom: 30px;
}

.app-header h1 {
  font-size: 2rem;
  color: var(--text-dark);
  margin: 0;
  font-weight: 700;
}

.app-header h1 i {
  margin-right: 10px;
  color: var(--primary);
}

/* ---------- Input Section ---------- */
.input-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

.input-wrapper {
  margin-bottom: 16px;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition);
}

.input-wrapper input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.textarea-wrapper {
  margin-bottom: 20px;
}

.textarea-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.textarea-label i {
  color: var(--primary);
  font-size: 1.1rem;
}

.textarea-wrapper textarea {
  width: 100%;
  min-height: 300px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
  font-size: 1rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.7;
  outline: none;
  resize: vertical;
  transition: all var(--transition);
}

.textarea-wrapper textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.textarea-wrapper textarea::placeholder {
  color: var(--text-light);
}

/* ---------- Send Wrapper ---------- */
.send-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
}

/* ---------- Option Badges (Shared Styles) ---------- */
.option-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

/* ---------- Time Badge ---------- */
.time-badge {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #b45309;
}

.time-badge i {
  font-size: 0.9rem;
  color: #f59e0b;
}

.time-badge input {
  width: 36px;
  border: none;
  outline: none;
  background: white;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.time-badge input:focus {
  border-color: #f59e0b;
}

.time-badge input::-webkit-outer-spin-button,
.time-badge input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.time-badge input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.badge-unit {
  font-size: 0.8rem;
  font-weight: 500;
}

/* ---------- Visibility Badge ---------- */
.visibility-badge {
  background: #fef2f2;
  border: 1.5px solid #f87171;
  color: #dc2626;
}

.visibility-badge i {
  font-size: 0.85rem;
}

.visibility-badge.is-public {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #16a34a;
}

/* ---------- Mini Toggle Switch ---------- */
.mini-toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  cursor: pointer;
  margin-left: 2px;
}

.mini-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mini-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fca5a5;
  border-radius: 18px;
  transition: all 0.3s ease;
}

.mini-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mini-toggle input:checked+.mini-slider {
  background: #4ade80;
}

.mini-toggle input:checked+.mini-slider:before {
  transform: translateX(16px);
}

/* ---------- Send Button ---------- */
.send-btn {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.send-btn:hover {
  background: linear-gradient(135deg, var(--success-dark) 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.send-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.send-btn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Cancel Edit Button ---------- */
.cancel-edit-btn {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #dc2626;
  background: #fee2e2;
  border: 2px solid #fecaca;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.cancel-edit-btn:hover {
  background: #fecaca;
  border-color: #f87171;
}

.cancel-edit-btn:active {
  transform: translateY(1px);
}

/* ---------- Edit Mode Indicator ---------- */
.input-section.edit-mode {
  border: 2px solid #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

.edit-mode-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.edit-mode-banner i {
  font-size: 1.1rem;
}

.edit-mode-banner .edit-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.send-btn i {
  font-size: 0.8rem;
}

/* Responsive for send wrapper */
@media (max-width: 600px) {
  .send-wrapper {
    justify-content: center;
  }

  .option-badge {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .send-btn {
    padding: 10px 18px;
  }
}

/* ---------- Links Section ---------- */
.links-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  animation: fade-in 0.45s ease both;
  border: 1px solid var(--border);
}

.links-section h2 {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.links-section h2 i {
  color: var(--primary);
}

/* ---------- Link Item ---------- */
.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  position: relative;
}

.link-item:hover {
  border-color: var(--primary-light);
  background: #fff;
}

.link-item:last-child {
  margin-bottom: 0;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.link-preview {
  font-size: 0.85rem;
  color: var(--text-medium);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.link-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}


.meta-badge.time {
  background: #fef3c7;
  color: #b45309;
}

.meta-badge.public {
  background: #dcfce7;
  color: #16a34a;
}

.meta-badge.private {
  background: #fee2e2;
  color: #dc2626;
}

.meta-badge.date {
  background: #f1f5f9;
  color: #475569;
}

.meta-badge i {
  font-size: 0.65rem;
}

.link-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.link-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.link-btn.view {
  background: var(--primary);
  color: #fff;
}

.link-btn.view:hover {
  background: var(--primary-dark);
}

.link-btn.copy {
  background: var(--border);
  color: var(--text-dark);
}

.link-btn.copy:hover {
  background: #d1d5db;
}

.item-actions-top {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: all var(--transition);
}

.link-item:hover .item-actions-top {
  opacity: 1;
}

.link-btn.trash,
.link-btn.edit {
  background: transparent;
  color: var(--text-light);
  padding: 6px 10px;
}

.link-btn.trash:hover {
  background: #fee2e2;
  color: #ef4444;
}

.link-btn.edit:hover {
  background: #e0e7ff;
  color: var(--primary);
}

/* ========================================
   VIEW WRITING PAGE STYLES
   ======================================== */

#viewWritingPage {
  width: 100%;
  min-height: 100vh;
  padding: 40px 20px;
  background: linear-gradient(180deg, #f1f5f9 0%, var(--page) 100%);
}

.writing-container {
  max-width: 95%;
  margin: 0 auto;
  padding: 0 30px;
  animation: fade-in 0.45s ease both;
}


.topic-card {
  background: white;
  border-radius: 20px;
  box-shadow:
    0 4px 6px rgba(102, 126, 234, 0.08),
    0 10px 40px rgba(102, 126, 234, 0.15);
  margin-bottom: 20px;
  overflow: hidden;
  border: none;
}

.topic-card-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 40%, #9f7aea 100%);
  padding: 12px 20px 14px;
  position: relative;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
}

.topic-card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

.topic-header-decoration {
  position: absolute;
  top: -30%;
  right: -5%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

.topic-header-decoration::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -200px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  border-radius: 50%;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-10px) scale(1.02);
  }
}

.topic-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.95);
  color: #667eea;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.topic-label i {
  font-size: 0.75rem;
}
.topic-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin: 0;
  line-height: 1.4;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  max-width: 100%;
}

.topic-card-body {
  padding: 0;
  background: white;
}

.requirements-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
}

.requirements-label i {
  color: #667eea;
  font-size: 1rem;
}

#writingContentDisplay {
  padding: 20px 28px;
  background: white;
}

.topic-card-body p,
#writingContentDisplay p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #374151;
  margin: 0 0 0.3em 0;
}

.topic-card-body p:empty,
#writingContentDisplay p:empty {
  display: none;
}

.topic-card-body p br:only-child,
#writingContentDisplay p br:only-child {
  display: none;
}

.topic-card-body p:last-child,
#writingContentDisplay p:last-child {
  margin-bottom: 0;
}

.topic-card-body ul,
#writingContentDisplay ul {
  margin: 0.8em 0;
  padding-left: 16px;
  list-style: none;
}

.topic-card-body li,
#writingContentDisplay li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 4px;
  font-size: 1.02rem;
  line-height: 1.7;
  color: #374151;
}

.topic-card-body li::before,
#writingContentDisplay li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
}

.topic-card-body strong,
#writingContentDisplay strong {
  color: #1e293b;
  font-weight: 600;
}

.topic-card .writing-meta {
  padding: 14px 36px 18px;
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0;
  background: #fafbfc;
  border-top: 1px solid #f0f0f0;
}


/* Keep old classes for backward compatibility */
.writing-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid var(--border);
}

.writing-header h1 {
  font-size: 2.2rem;
  color: var(--text-dark);
  margin: 0 0 16px 0;
  font-weight: 800;
  line-height: 1.3;
}

.writing-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04);
  padding: 48px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.writing-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border-radius: 20px 20px 0 0;
}

.writing-content p {
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--text-dark);
  margin: 0 0 1.5em 0;
}

.writing-content p:last-child {
  margin-bottom: 0;
}

.empty-content {
  color: var(--text-light);
  font-style: italic;
  text-align: center;
}

.writing-footer {
  margin-top: 30px;
  text-align: center;
}

.back-btn {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-medium);
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

/* ---------- Loading Spinner ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-medium);
  font-size: 1rem;
  gap: 10px;
}

.loading i {
  font-size: 1.5rem;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-medium);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  font-size: 1.1rem;
}

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 20px;
  background: var(--text-dark);
  color: #fff;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.3s ease;
  z-index: 9999;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: #ef4444;
}

/* ========================================
   404 ERROR PAGE STYLES
   ======================================== */

#error404Page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
}

.error-404-container {
  text-align: center;
  padding: 40px;
  animation: fade-in 0.45s ease both;
}

.error-404-icon {
  font-size: 5rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.error-404-title {
  font-size: 6rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0;
  line-height: 1;
}

.error-404-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-medium);
  margin: 16px 0 8px;
}

.error-404-subtext {
  font-size: 1rem;
  color: var(--text-light);
  margin: 0;
}

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

@media (max-width: 600px) {
  .app-header h1 {
    font-size: 1.4rem;
  }

  .input-section {
    padding: 20px;
  }

  .textarea-wrapper textarea {
    min-height: 250px;
    padding: 16px;
  }

  .send-btn {
    width: 100%;
    justify-content: center;
  }

  .link-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .link-actions {
    width: 100%;
    margin-left: 0;
  }

  .link-btn {
    flex: 1;
    justify-content: center;
  }

  .writing-header h1 {
    font-size: 1.6rem;
  }

  .writing-content {
    padding: 24px;
  }

  .writing-content p {
    font-size: 1rem;
  }
}

/* ========================================
   LEVEL SELECTION STYLES
   ======================================== */

.level-selection-section {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fafbfc;
}

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

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 700;
  height: 20px;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.select-all-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}

.select-all-wrapper:hover {
  color: var(--primary-dark);
}

.checkbox-container-scroll {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.checkbox-container-scroll::-webkit-scrollbar {
  width: 6px;
}

.checkbox-container-scroll::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

#classOptionsContainer {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-content: start;
  grid-auto-flow: dense;
}

.group-wrapper {
  display: flex;
  align-items: stretch;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s;
  height: 100%;
}

.group-wrapper:hover {
  border-color: #d1d5db;
}

.group-wrapper.span-3 {
  grid-column: span 3;
}

.group-wrapper.span-4 {
  grid-column: span 4;
}

.group-wrapper.span-6 {
  grid-column: span 6;
}

.group-wrapper.span-12 {
  grid-column: span 12;
}

.group-title {
  flex: 0 0 75px;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  border-right: 1px solid #e5e7eb;
  text-transform: uppercase;
  line-height: 1.1;
  word-break: break-word;
  cursor: pointer;
  transition: all 0.2s ease;
}

.group-title.has-selection {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff !important;
  border-right-color: #6366f1;
}

.group-items {
  flex: 1;
  padding: 6px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 34px;
}

.chip-label {
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4b5563;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.chip-label:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.group-items input[type="checkbox"] {
  display: none;
}

.group-items input[type="checkbox"]:checked+.chip-label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

/* ========================================
   RICH TEXT EDITOR STYLES
   ======================================== */

.rich-editor-container {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background: #fff;
  margin-bottom: 20px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.rich-editor-container:focus-within {
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 12px 12px 0 0;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
}

.toolbar::-webkit-scrollbar {
  height: 4px;
}

.toolbar::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

.toolbar button,
.toolbar select {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  color: #4b5563;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.toolbar button:hover {
  background: #e5e7eb;
  color: #111827;
}

.separator {
  width: 1px;
  height: 20px;
  background: #d1d5db;
  margin: 0 4px;
  flex-shrink: 0;
}

.color-btn {
  font-weight: 900;
  font-family: serif;
}

.color-btn.purple {
  color: #6366f1;
}

.color-btn.magenta {
  color: #d63384;
}

.color-btn.red {
  color: #dc3545;
}

.editor-content {
  min-height: 300px;
  padding: 20px;
  overflow-y: auto;
  outline: none;
  font-size: 1rem;
  line-height: 1.7;
  color: #1f2937;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  text-align: justify;
}

.editor-content p {
  margin-top: 0;
  margin-bottom: 0.3em;
}

.editor-content div {
  margin: 0;
}

.editor-content p:empty {
  display: none;
}

.editor-content p br:only-child {
  display: none;
}

.editor-content a {
  color: var(--primary);
  text-decoration: underline;
}

.editor-content:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
  display: block;
}

/* Responsive for level selection */
@media (max-width: 900px) {
  #classOptionsContainer {
    grid-template-columns: repeat(6, 1fr);
  }

  .group-wrapper.span-3 {
    grid-column: span 3;
  }

  .group-wrapper.span-4,
  .group-wrapper.span-6,
  .group-wrapper.span-12 {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  #classOptionsContainer {
    grid-template-columns: 1fr;
  }

  .group-wrapper.span-3,
  .group-wrapper.span-4,
  .group-wrapper.span-6,
  .group-wrapper.span-12 {
    grid-column: span 1;
  }
}


/* ========================================
   EDIT MODAL STYLES
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fade-in 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slide-up 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i {
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-dark);
}

.modal-body {
  padding: 24px;
}

.modal-field {
  margin-bottom: 20px;
}

.modal-field:last-child {
  margin-bottom: 0;
}

.modal-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.modal-field input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.modal-field input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.modal-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 2px solid var(--border);
}

.modal-toggle-wrapper span {
  font-weight: 600;
  color: var(--text-medium);
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #f9fafb;
  border-radius: 0 0 16px 16px;
}

.modal-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn.cancel {
  background: white;
  color: var(--text-medium);
  border: 2px solid var(--border);
}

.modal-btn.cancel:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
}

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

.modal-btn.save:hover {
  background: var(--primary-dark);
}

.modal-btn.save:disabled {
  background: var(--text-light);
  cursor: not-allowed;
}

/* ========================================
   CONFIRMATION POPUP STYLES
   ======================================== */
.confirm-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fade-in 0.2s ease;
}

.confirm-popup {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slide-up 0.3s ease;
  overflow: hidden;
}

.confirm-popup-header {
  padding: 24px 24px 0;
  text-align: center;
}

.confirm-popup-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.5rem;
}

.confirm-popup-icon.warning {
  background: #fef3c7;
  color: #f59e0b;
}

.confirm-popup-icon.danger {
  background: #fee2e2;
  color: #ef4444;
}

.confirm-popup-icon.info {
  background: #e0e7ff;
  color: #6366f1;
}

.confirm-popup-icon.success {
  background: #d1fae5;
  color: #10b981;
}

.confirm-popup-header h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--text-dark);
  font-weight: 700;
}

.confirm-popup-body {
  padding: 8px 24px 24px;
  text-align: center;
}

.confirm-popup-body p {
  margin: 0;
  color: var(--text-medium);
  font-size: 0.95rem;
  line-height: 1.5;
}

.confirm-popup-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: #f9fafb;
  border-top: 1px solid var(--border);
}

.confirm-popup-btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-popup-btn.cancel {
  background: white;
  color: var(--text-medium);
  border: 2px solid var(--border);
}

.confirm-popup-btn.cancel:hover {
  background: #f1f5f9;
  border-color: #d1d5db;
}

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

.confirm-popup-btn.confirm:hover {
  background: var(--primary-dark);
}

.confirm-popup-btn.confirm.danger {
  background: #ef4444;
}

.confirm-popup-btn.confirm.danger:hover {
  background: #dc2626;
}

.confirm-popup-btn.confirm.warning {
  background: #f59e0b;
}

.confirm-popup-btn.confirm.warning:hover {
  background: #d97706;
}

/* ========================================
   LARGE EDIT MODAL STYLES
   ======================================== */

.modal-content-large {
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content-large .modal-body {
  padding: 20px 24px;
}

.modal-field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.modal-field input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.edit-level-selection {
  margin-top: 8px;
}

.edit-level-selection .checkbox-container-scroll {
  max-height: 150px;
}

.edit-rich-editor-container {
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.edit-rich-editor-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.edit-toolbar {
  padding: 6px 10px;
}

.edit-rich-editor-container .editor-content {
  min-height: 150px;
  padding: 14px;
}

.modal-options-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-field-inline label {
  margin-bottom: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}

.modal-field-inline label i {
  color: var(--primary);
  margin-right: 4px;
}

.modal-field-inline input[type="number"] {
  width: 60px;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
}

.modal-field-inline .unit {
  font-size: 0.85rem;
  color: var(--text-medium);
}


.level-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e7ff;
  color: #4338ca;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
}

.level-tag.more {
  background: #f3f4f6;
  color: #6b7280;
}

@media (max-width: 600px) {
  .modal-content-large {
    max-width: 95%;
  }

  .modal-options-row {
    flex-direction: column;
    gap: 12px;
  }
}


/* ========== STUDENT SUBMISSION SECTION ========== */
.student-submission-section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 2px dashed var(--border);
}

.submission-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.submission-header h2 i {
  color: var(--primary);
}

.submission-form {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.student-name-field {
  margin-bottom: 16px;
}

.student-name-field input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #f9fafb;
  transition: all var(--transition);
}

.student-name-field input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.student-editor-container {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.student-editor-container .toolbar {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

.student-editor-wrapper {
  position: relative;
}

.student-editor {
  min-height: 250px;
  max-height: 400px;
  overflow-y: auto;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  text-align: justify;
}

/* Countdown Timer */
.countdown-timer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  min-width: 120px;
  justify-content: center;
}

.countdown-timer i {
  font-size: 1.2rem;
}

.countdown-timer i {
  font-size: 1rem;
}

.countdown-timer.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  animation: pulse 1s ease-in-out infinite;
}

.countdown-timer.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.submission-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.submit-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Time's up overlay */
.times-up-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.times-up-modal {
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  max-width: 400px;
  animation: fade-in 0.3s ease;
}

.times-up-modal i {
  font-size: 4rem;
  color: #ef4444;
  margin-bottom: 20px;
}

.times-up-modal h3 {
  font-size: 1.5rem;
  color: var(--text-dark);
  margin: 0 0 10px 0;
}

.times-up-modal p {
  color: var(--text-medium);
  margin: 0;
}



/* ========== Admin Controls Inline (Super Admin) ========== */
.admin-controls-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#adminVisibilityBadge {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
}

#adminVisibilityBadge.is-public {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-color: #22c55e;
}

#adminVisibilityBadge #adminVisibilityIcon {
  color: #92400e;
}

#adminVisibilityBadge.is-public #adminVisibilityIcon {
  color: #16a34a;
}

#adminVisibilityBadge #adminVisibilityText {
  color: #78350f;
  font-weight: 500;
}

#adminVisibilityBadge.is-public #adminVisibilityText {
  color: #166534;
}

.time-adjust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 20px;
}

.time-adjust-badge i {
  color: #f59e0b;
  font-size: 0.9rem;
}

.adjust-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  background: white;
  color: #f59e0b;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adjust-btn:hover {
  background: #f59e0b;
  color: white;
}

.adjust-btn:active {
  transform: scale(0.95);
}

#adminMinuteInput {
  width: 40px;
  text-align: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 2px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
  background: white;
}

.time-adjust-badge .badge-unit {
  color: #6b7280;
  font-weight: 500;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .submission-actions {
    flex-direction: column;
    gap: 12px;
  }

  .admin-controls-inline {
    width: 100%;
    justify-content: center;
  }
}

/* ---------------- Student Name Popup Styles ---------------- */
.name-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.name-popup-modal {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.name-popup-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.name-popup-icon i {
  font-size: 2rem;
  color: white;
}

.name-popup-modal h3 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: #1f2937;
}

.name-popup-modal p {
  margin: 0 0 24px 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.name-popup-input-wrapper {
  margin-bottom: 20px;
}

.name-popup-input-wrapper input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.name-popup-input-wrapper input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.name-popup-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.name-popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.name-popup-btn:active {
  transform: translateY(0);
}


/* Student Name Input Styles */
.student-name-input-wrapper {
  margin-bottom: 16px;
}

.student-name-input-wrapper label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.student-name-input-wrapper label i {
  margin-right: 6px;
  color: var(--primary);
}

.student-name-input-wrapper input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--surface);
}

.student-name-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Name Reminder Popup */
.name-reminder-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.name-reminder-modal {
  background: white;
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.name-reminder-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.name-reminder-icon i {
  font-size: 2.5rem;
  color: #f59e0b;
}

.name-reminder-modal h3 {
  margin: 0 0 12px 0;
  color: #1f2937;
  font-size: 1.4rem;
}

.name-reminder-modal p {
  margin: 0 0 24px 0;
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.5;
}

.name-reminder-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.name-reminder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}


/* ========== Submission Result Styles (IMPROVED) ========== */
.submission-result-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 0 10px 0;
  animation: fadeInUp 0.6s ease;
  position: relative;
}


@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.submission-result-header {
  text-align: center;
  margin-bottom: 16px;
}

.submission-result-header.compact {
  display: flex;
  align-items: center;
  text-align: left;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid #a7f3d0;
  gap: 14px;
}

.submission-result-header.compact .header-text {
  flex: 1;
}

.submission-result-header.compact h2 {
  font-size: 1.1rem;
  margin: 0 0 2px 0;
}

.submission-result-header.compact p {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #065f46;
  flex-wrap: wrap;
}

.submission-result-header.compact .header-divider {
  margin: 0 4px;
  color: #10b981;
}

.submission-result-header.compact p i {
  font-size: 0.75rem;
}

.success-icon-wrapper {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

@keyframes successPop {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }

  50% {
    transform: scale(1.2) rotate(10deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.success-icon-wrapper i {
  font-size: 1.2rem;
  color: white;
}

.submission-result-header h2 {
  margin: 0 0 6px 0;
  font-size: 1.4rem;
  color: #10b981;
  font-weight: 700;
}

.submission-result-header p {
  margin: 0;
  color: #9ca3af;
  font-size: 0.9rem;
}

.submission-result-card {
  background: white;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
  animation: slideInCard 0.5s ease backwards;
}

.submission-result-card.name-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: none;
}

.submission-result-card.name-card .result-label {
  margin-bottom: 0;
}

.submission-result-card.name-card .result-value {
  font-size: 1rem;
  color: #374151;
  font-weight: 500;
}

.submission-result-card:nth-child(2) {
  animation-delay: 0.1s;
}

.submission-result-card:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes slideInCard {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.submission-result-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 8px 15px rgba(0, 0, 0, 0.08),
    0 20px 40px rgba(0, 0, 0, 0.1);
  background-image: linear-gradient(white, white), linear-gradient(135deg, #818cf8, #6366f1);
}

.result-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-label i {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9rem;
}

.result-value {
  font-size: 1.15rem;
  color: #1f2937;
  font-weight: 600;
}

.result-value.name-value {
  font-size: 1rem;
  color: #4b5563;
  font-weight: 500;
}

.result-content {
  color: #374151;
  line-height: 1.8;
  font-size: 1rem;
  padding: 18px 20px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: justify;
}

.result-content::-webkit-scrollbar {
  width: 6px;
}

.result-content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.result-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.submission-result-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 28px;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-radius: 16px;
  color: #065f46;
  font-weight: 600;
  margin-top: 28px;
  border: 2px solid #a7f3d0;
  animation: slideInCard 0.5s ease backwards;
  animation-delay: 0.3s;
}

.submission-result-footer i {
  color: #10b981;
  font-size: 1.1rem;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .submission-result-container {
    padding: 40px 20px;
  }


  .success-icon-wrapper {
    width: 80px;
    height: 80px;
  }

  .success-icon-wrapper i {
    font-size: 2.5rem;
  }

  .submission-result-header h2 {
    font-size: 1.6rem;
  }
}


/* Resubmit Button */
.resubmit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.submission-result-header .resubmit-btn {
  margin: 0;
  margin-left: auto;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.resubmit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.resubmit-btn i {
  font-size: 0.9rem;
}

/* Multiple submissions styling */
.submission-result-card.newest {
  border-left: 4px solid #10b981;
}

.submission-result-card .submission-time {
  margin-left: 0;
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.submission-result-card .submission-time i {
  width: auto;
  height: auto;
  background: none;
  color: #6b7280;
  font-size: 0.8rem;
}

.submission-result-card .result-label {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

/* Resubmit Confirmation Popup */
.resubmit-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.resubmit-confirm-modal {
  background: white;
  padding: 32px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.resubmit-confirm-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.resubmit-confirm-icon i {
  font-size: 2rem;
  color: white;
}

.resubmit-confirm-modal h3 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  color: #1f2937;
}

.resubmit-confirm-modal>p {
  margin: 0 0 15px;
  color: #6b7280;
  font-size: 1rem;
}

.resubmit-confirm-modal .time-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 12px 16px;
  border-radius: 10px;
  color: #92400e;
  font-size: 0.95rem;
  margin-bottom: 20px;
  border: 1px solid #f59e0b;
}

.resubmit-confirm-modal .time-warning i {
  margin-right: 8px;
}

.resubmit-confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.resubmit-cancel-btn,
.resubmit-ok-btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: none;
}

.resubmit-cancel-btn {
  background: #f3f4f6;
  color: #4b5563;
}

.resubmit-cancel-btn:hover {
  background: #e5e7eb;
}

.resubmit-ok-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.resubmit-ok-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}


/* Line Spacing Dropdown */
.line-spacing-dropdown {
  position: relative;
  display: inline-block;
}

.line-spacing-btn {
  background: transparent;
  border: none;
  color: #4b5563;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.line-spacing-btn:hover {
  background: #e5e7eb;
  color: #6366f1;
}

.line-spacing-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  min-width: 60px;
  padding: 4px 0;
}

.line-spacing-dropdown:hover .line-spacing-menu,
.line-spacing-dropdown:focus-within .line-spacing-menu {
  display: block;
}

.line-spacing-menu button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: background 0.2s;
}

.line-spacing-menu button:hover {
  background: #f3f4f6;
  color: #6366f1;
}

/* ========== Grading Float Button ========== */
.grading-float-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  transition: all 0.3s ease;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

#viewWritingPage:hover .grading-float-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.grading-float-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.grading-float-btn i {
  font-size: 0.9rem;
}

/* ========== Floating Prompt Button ========== */
.prompt-float-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  z-index: 1000;
}

.prompt-float-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.prompt-float-btn:active {
  transform: translateY(-1px);
}

.prompt-float-btn i {
  font-size: 1.1rem;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* Hide on mobile if needed - optional */
@media (max-width: 480px) {
  .prompt-float-btn {
    padding: 12px 18px;
    font-size: 0.9rem;
    bottom: 16px;
    left: 16px;
  }

  .prompt-float-btn span {
    display: none;
  }

  .prompt-float-btn {
    border-radius: 50%;
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
  }
}

/* ========== Prompt Popup ========== */
.prompt-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.prompt-popup-modal {
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.prompt-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.prompt-popup-header h3 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-popup-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.prompt-popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.prompt-popup-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.prompt-editor-container {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.prompt-editor-container .toolbar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.prompt-editor-container .toolbar button {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
}

.prompt-editor-container .toolbar button:hover {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.prompt-editor-container .toolbar select {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  background: white;
}

.prompt-editor-container .toolbar .separator {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 6px;
}

.prompt-editor-container .toolbar .color-btn {
  font-weight: 700;
  font-size: 0.9rem;
}

.prompt-editor-container .toolbar .color-btn.purple {
  color: #6366f1;
}

.prompt-editor-container .toolbar .color-btn.magenta {
  color: #d63384;
}

.prompt-editor-container .toolbar .color-btn.red {
  color: #dc3545;
}

#promptRichTextEditor {
  min-height: 250px;
  max-height: 350px;
  overflow-y: auto;
  padding: 16px;
  font-size: 1rem;
  line-height: 1.6;
  outline: none;
}

#promptRichTextEditor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.prompt-popup-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.prompt-cancel-btn {
  padding: 12px 24px;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-cancel-btn:hover {
  background: #e2e8f0;
}

.prompt-save-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ========== Card Grading Button (inside each card) ========== */
/* ========== Card Grading Button (inside each card) ========== */
.card-grading-btn-wrapper {
  display: flex;
  justify-content: flex-start;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.submission-result-card:hover .card-grading-btn-wrapper {
  opacity: 1;
}

.card-grading-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  transition: all 0.3s ease;
}

.card-grading-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.card-grading-btn i {
  font-size: 0.8rem;
}

/* ========== Grading Popup Styles ========== */
.grading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.grading-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.grading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.grading-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #1f2937;
}

.grading-header h3 i {
  color: #f59e0b;
  margin-right: 8px;
}

.grading-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.grading-close-btn:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.grading-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.grading-loading {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.grading-loading i {
  font-size: 2rem;
  color: #6366f1;
  margin-bottom: 12px;
}

.grading-result {
  line-height: 1.7;
  color: #374151;
}

.grading-error {
  text-align: center;
  padding: 40px 20px;
  color: #dc2626;
}

.grading-error i {
  font-size: 2rem;
  margin-bottom: 12px;
}


/* ========== FULLSCREEN GRADING MODAL ========== */
.grading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.grading-modal-fullscreen {
  width: 95vw;
  max-width: 1200px;
  height: 90vh;
  max-height: 900px;
  background: #fff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.grading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.grading-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.grading-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.grading-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.grading-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Loading State */
.grading-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.grading-loading-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.grading-loading-icon i {
  font-size: 48px;
  color: white;
}

.grading-loading h4 {
  font-size: 24px;
  color: #1f2937;
  margin: 0 0 12px 0;
}

.grading-time-hint {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 24px 0;
}

.grading-progress {
  width: 300px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.grading-progress-bar {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #6366f1);
  background-size: 200% 100%;
  border-radius: 3px;
  animation: gradingProgress 1.5s ease-in-out infinite;
}

@keyframes gradingProgress {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(400%);
  }
}

/* Result State */
.grading-result-html {
  font-size: 16px;
  line-height: 1.8;
  color: #374151;
}

.grading-result-html h1,
.grading-result-html h2,
.grading-result-html h3,
.grading-result-html h4 {
  color: #1f2937;
  margin-top: 24px;
  margin-bottom: 12px;
}

.grading-result-html h3 {
  font-size: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #6366f1;
}

.grading-result-html p {
  margin-bottom: 16px;
}

.grading-result-html ul,
.grading-result-html ol {
  margin: 16px 0;
  padding-left: 24px;
}

.grading-result-html li {
  margin-bottom: 8px;
}

.grading-result-html strong {
  color: #6366f1;
  font-weight: 600;
}

.grading-result-html em {
  color: #8b5cf6;
}

/* Error State */
.grading-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.grading-error i {
  font-size: 64px;
  color: #ef4444;
  margin-bottom: 20px;
}

.grading-error h4 {
  font-size: 20px;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.grading-error p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .grading-overlay {
    padding: 10px;
  }

  .grading-modal-fullscreen {
    width: 100%;
    height: 95vh;
    border-radius: 12px;
  }

  .grading-header {
    padding: 16px;
  }

  .grading-body {
    padding: 16px;
  }

  .grading-loading h4 {
    font-size: 18px;
  }

  .grading-result-html {
    font-size: 14px;
  }
}


/* ========== INLINE GRADING RESULT SECTION ========== */
.inline-grading-section {
  margin-top: 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  overflow: hidden;
  animation: slideInCard 0.5s ease;
}

.inline-grading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.inline-grading-header h4 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-grading-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.inline-grading-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.inline-grading-body {
  padding: 20px 24px;
  background: white;
}

.inline-grading-section.existing .inline-grading-body {
  border: 2px solid #f59e0b;
  border-top: none;
  border-radius: 0 0 16px 16px;
}

.inline-grading-loading {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.inline-grading-loading i {
  font-size: 2rem;
  color: #f59e0b;
  margin-bottom: 12px;
}

.inline-grading-loading h4 {
  margin: 0 0 8px 0;
  color: #1f2937;
}

.inline-grading-loading p {
  margin: 0;
  font-size: 0.9rem;
}

.inline-grading-progress {
  margin-top: 16px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.inline-grading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  animation: progressPulse 2s ease-in-out infinite;
  width: 60%;
}

.inline-grading-result {
  font-size: 16px;
  line-height: 1.8;
  color: #374151;
}

/* Main Title */
.inline-grading-result h1 {
  font-size: 24px;
  color: #1e40af;
  margin-top: 0;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 3px solid #3b82f6;
}

/* Section Headers (PHẦN 1, PHẦN 2, PHẦN 3) */
.inline-grading-result h2 {
  font-size: 18px;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 28px;
  margin-bottom: 16px;
}

.inline-grading-result h2:first-child {
  margin-top: 0;
}

/* Sub Headers (Câu 1, Câu 2, etc.) */
.inline-grading-result h3 {
  font-size: 16px;
  color: #7c3aed;
  margin-top: 20px;
  margin-bottom: 10px;
  padding-left: 12px;
  border-left: 4px solid #8b5cf6;
}

.inline-grading-result h4 {
  font-size: 15px;
  color: #059669;
  margin-top: 16px;
  margin-bottom: 8px;
}

.inline-grading-result p {
  margin: 10px 0;
}

.inline-grading-result ul,
.inline-grading-result ol {
  padding-left: 24px;
  margin: 12px 0;
}

.inline-grading-result li {
  margin-bottom: 8px;
  padding-left: 4px;
}

/* Bold text - Purple color */
.inline-grading-result strong {
  color: #6366f1;
  font-weight: 600;
}

/* Italic text */
.inline-grading-result em {
  color: #8b5cf6;
  font-style: italic;
}

/* Special styling for labels like "Câu gốc:", "Lỗi:", "Sửa lại:" */
.inline-grading-result li strong:first-child {
  color: #dc2626;
}

/* Score styling */
.inline-grading-result p strong:contains("/10") {
  color: #059669;
  font-size: 18px;
}

/* Highlight boxes for important content */
.inline-grading-result blockquote {
  background: #f0f9ff;
  border-left: 4px solid #3b82f6;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
}

/* Code/example text */
.inline-grading-result code {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
}

.inline-grading-error {
  text-align: center;
  padding: 30px 20px;
  color: #dc2626;
}

.inline-grading-error i {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* Existing Grading Container */
.existing-grading-container {
  margin-top: 0;
}

.inline-grading-section.existing {
  margin-top: 15px;
  border-top: none;
  padding-top: 0;
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
  border: none;
}

.inline-grading-section.existing .inline-grading-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  margin-top: 0;
  border-radius: 16px 16px 0 0;
  border: 2px solid #f59e0b;
  border-bottom: none;
}

.inline-grading-section.existing .inline-grading-header h4 {
  margin: 0;
  color: #ffffff;
  font-size: 14px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.inline-grading-section.existing .grading-time {
  font-size: 12px;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ========== ERROR CARDS GRID - 5 COLUMNS ========== */
.inline-grading-result .errors-grid,
.inline-grading-result [class*="errors"],
.inline-grading-result [class*="grid"] {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 12px !important;
}

/* Responsive: fewer columns on smaller screens */
@media (max-width: 1200px) {

  .inline-grading-result .errors-grid,
  .inline-grading-result [class*="errors"],
  .inline-grading-result [class*="grid"] {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (max-width: 992px) {

  .inline-grading-result .errors-grid,
  .inline-grading-result [class*="errors"],
  .inline-grading-result [class*="grid"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {

  .inline-grading-result .errors-grid,
  .inline-grading-result [class*="errors"],
  .inline-grading-result [class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

.send-message-btn {
  margin-left: auto;
  padding: 5px 12px;
  background: transparent;
  color: #6366f1;
  border: 1.5px solid #6366f1;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  text-transform: none;
  letter-spacing: 0;
}

.send-message-btn:hover {
  background: #6366f1;
  color: white;
}

.send-message-btn i {
  font-size: 0.7rem;
}


.send-message-btn.zalo-sent-disabled {
  background: #9ca3af !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

.send-message-btn.zalo-sent-disabled:hover {
  background: #9ca3af !important;
  transform: none !important;
}


/* Fix for html2canvas snapshot - more aggressive overrides */
.submission-result-card,
.submission-result-card * {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.submission-result-card .result-content,
.submission-result-card .existing-grading-container,
.submission-result-card .inline-grading-section,
.submission-result-card .inline-grading-result {
  overflow: visible !important;
  max-height: none !important;
}


/* Copy URL Button */
.copy-url-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
  margin-right: 8px;
}

.copy-url-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.copy-url-btn i {
  font-size: 0.75rem;
}

/* Result label buttons container */
.result-label-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}


/* ========================================
   SUBMISSIONS PAGE STYLES
   ======================================== */

.submissions-page-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 30px 50px;
  min-height: 100vh;
}

#submissionsPage {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.submissions-page-header {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.submissions-page-header h1 {
  font-size: 1.8rem;
  color: #1f2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.submissions-page-header h1 i {
  color: #6366f1;
}

.back-to-main-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  color: #374151;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  width: fit-content;
  text-decoration: none;
}

.back-to-main-btn:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.submissions-stats {
  display: flex;
  gap: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  color: #6b7280;
}

.stat-item i {
  color: #6366f1;
}

.submissions-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 15px;
  flex: 1;
  min-width: 250px;
}

.search-box i {
  color: #9ca3af;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  width: 100%;
  color: #374151;
}

.filter-buttons {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #6366f1;
  color: #6366f1;
}

.filter-btn.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
}

.submissions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.submissions-list .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.submissions-list .empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: #d1d5db;
}

.submissions-list .loading {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.submissions-list .loading i {
  font-size: 2rem;
  color: #6366f1;
}

.submission-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.2s;
}

.submission-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

/* Trash button on card */
.submission-card {
  position: relative;
}

.submission-delete-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.submission-card:hover .submission-delete-btn {
  opacity: 1;
}

.submission-delete-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.submission-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 15px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 10px;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.student-info>i {
  font-size: 1.5rem;
  color: #6366f1;
}

.student-name {
  font-weight: 600;
  color: #1f2937;
  font-size: 1.05rem;
}

.grading-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

.grading-status.graded {
  background: #dcfce7;
  color: #166534;
}

.grading-status.ungraded {
  background: #fef3c7;
  color: #92400e;
}

.submission-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.send-zalo-top-btn {
  padding: 8px 14px !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
  background: #0068ff !important;
  color: white !important;
}

.send-zalo-top-btn:hover {
  background: #0052cc !important;
}

.submission-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.send-zalo-top-btn {
  padding: 8px 14px !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
  background: #0068ff !important;
  color: white !important;
}

.send-zalo-top-btn:hover {
  background: #0052cc !important;
}

.submission-time {
  font-size: 0.85rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 5px;
}

.time-spent {
  margin-left: 5px;
}

/* ===== Chủ đề viết Section ===== */
.submission-topic {
  padding: 16px 20px;
  margin: 16px 20px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-radius: 12px;
  border-left: 4px solid #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.topic-label {
  font-size: 0.75rem;
  color: #6366f1;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.topic-label i {
  font-size: 0.85rem;
  color: #818cf8;
}

.topic-text {
  color: #1e293b;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
}

/* ===== Nội dung bài viết Section ===== */
.submission-preview {
  padding: 16px 20px;
  margin: 0 20px 16px 20px;
}

.preview-label {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preview-label i {
  font-size: 0.85rem;
  color: #10b981;
}

.preview-content {
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.8;
  padding: 18px 20px;
  padding-bottom: 45px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  position: relative;
  max-height: 80px;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.preview-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, #f1f5f9);
  border-radius: 0 0 12px 12px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.preview-content.expanded {
  max-height: 2000px;
}

.preview-content.expanded::after {
  opacity: 0;
}

/* Expand Button - Animated Arrow Inside Box */
.expand-content-btn {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(99, 102, 241, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 5;
}

.expand-content-btn:hover {
  background: #4f46e5;
  transform: scale(1.1);
}

.expand-content-btn i {
  font-size: 0.9rem;
  animation: bounceDown 1.5s ease-in-out infinite;
}

.expand-content-btn.expanded i {
  animation: none;
  transform: rotate(180deg);
}

.expand-content-btn.expanded {
  background: rgba(100, 116, 139, 0.9);
}

.expand-content-btn.expanded:hover {
  background: #475569;
}

@keyframes bounceDown {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(3px);
  }

  60% {
    transform: translateY(2px);
  }
}

.submission-card-footer {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}

.view-detail-btn,
.grade-submission-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.view-detail-btn {
  background: #f3f4f6;
  color: #374151;
}

.view-detail-btn:hover {
  background: #e5e7eb;
}

.grade-submission-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
}

.grade-submission-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.submission-grading-container {
  padding: 0;
}

.submission-grading-container .inline-grading-section {
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid #e5e7eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .submissions-page-container {
    padding: 15px;
  }

  .submissions-page-header h1 {
    font-size: 1.4rem;
  }

  .submissions-filters {
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .filter-buttons {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .submission-card-header {
    flex-direction: column;
  }

  .submission-card-footer {
    flex-direction: column;
  }

  .view-detail-btn,
  .grade-submission-btn {
    width: 100%;
    justify-content: center;
  }
}


/* Submissions Float Button/Link */
.submissions-float-btn {
  position: fixed;
  bottom: 100px;
  left: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: all 0.3s;
  z-index: 100;
  text-decoration: none;
}

.submissions-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  color: white;
}

.submissions-float-btn i {
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .submissions-float-btn {
    bottom: 80px;
    left: 15px;
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}


/* Source Topic Styling */
.submission-source {
  margin: 12px 0;
  padding: 12px;
  background: #f0f7ff;
  border-radius: 8px;
  border-left: 4px solid #3b82f6;
}

.source-label {
  font-size: 0.85rem;
  color: #3b82f6;
  font-weight: 600;
  margin-bottom: 6px;
}

.source-text {
  color: #1e40af;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Full Student Content */
.preview-content.full-content {
  max-height: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.7;
  padding: 16px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}


/* ===== Rendered HTML Content ===== */
.rendered-html {
  line-height: 1.7;
}

.rendered-html p {
  margin-bottom: 12px;
}

.rendered-html strong {
  font-weight: 600;
}

.preview-content.rendered-html {
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.preview-content.rendered-html.expanded {
  max-height: none;
  overflow: visible;
}

/* ===== View Grading Button ===== */
.view-grading-btn {
  background: #10b981;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.view-grading-btn:hover {
  background: #059669;
}

/* ===== Grading Preview Container ===== */
.grading-preview-container {
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
  animation: slideDown 0.3s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grading-preview-content {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 20px;
}

.grading-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #bbf7d0;
  flex-wrap: wrap;
  gap: 10px;
}

.grading-preview-header h4 {
  margin: 0;
  color: #166534;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grading-date {
  color: #15803d;
  font-size: 0.85rem;
}

.grading-preview-body {
  color: #1f2937;
  max-height: none;
  overflow-y: visible;
  font-size: 1rem;
  line-height: 1.8;
}

.grading-preview-body h1,
.grading-preview-body h2,
.grading-preview-body h3 {
  color: #166534;
  margin-top: 16px;
  margin-bottom: 8px;
}

.grading-preview-body h1 {
  font-size: 1.3rem;
}

.grading-preview-body h2 {
  font-size: 1.15rem;
}

.grading-preview-body h3 {
  font-size: 1rem;
}

.grading-preview-loading {
  text-align: center;
  padding: 30px;
  color: #6b7280;
}

.grading-preview-error {
  text-align: center;
  padding: 20px;
  color: #dc2626;
  background: #fef2f2;
  border-radius: 8px;
}

/* ===== IMPROVED SUBMISSIONS PAGE DESIGN ===== */

/* Better submission cards */
.submission-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.3s ease;
}

.submission-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Better card header */
.submission-card-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e5e7eb;
}

/* Better grading status badges */
.grading-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.grading-status.graded {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}

.grading-status.ungraded {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
}

.submission-topic-unified {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 24px 16px 24px;
  margin: 0;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  width: fit-content;
}

.topic-tag i {
  font-size: 0.85rem;
}

.topic-content {
  flex: 1;
  display: block;
  color: var(--text-dark);
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 500;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 16px 20px;
  border-radius: 0 10px 10px 10px;
  border: 2px solid #3b82f6;
  border-top: none;
}

/* Better preview content */
.submission-preview {
  padding: 20px 24px;
  margin: 0;
}

/* Better footer buttons */
.submission-card-footer {
  display: flex;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
}

.view-detail-btn,
.grade-submission-btn,
.view-grading-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
}

.view-detail-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.view-detail-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.grade-submission-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.grade-submission-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.view-grading-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.view-grading-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Better grading preview */
.grading-preview-container {
  margin: 0;
  padding: 20px 24px;
  border-top: none;
  background: #fafbfc;
}

.grading-preview-content {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.grading-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #86efac;
}

.grading-preview-header h4 {
  margin: 0;
  color: #166534;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.grading-preview-header h4 i {
  color: #f59e0b;
}

.grading-date {
  color: #15803d;
  font-size: 0.85rem;
  background: #dcfce7;
  padding: 6px 12px;
  border-radius: 20px;
}

/* Grading result improvements */
.inline-grading-result {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e5e7eb;
}

.inline-grading-result h1,
.inline-grading-result h2,
.inline-grading-result h3,
.inline-grading-result h4 {
  color: #166534;
  margin-top: 20px;
  margin-bottom: 12px;
}

.inline-grading-result h1:first-child,
.inline-grading-result h2:first-child,
.inline-grading-result h3:first-child {
  margin-top: 0;
}

.inline-grading-result p {
  margin-bottom: 14px;
  line-height: 1.8;
}

.inline-grading-result ul,
.inline-grading-result ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.inline-grading-result li {
  margin-bottom: 10px;
  line-height: 1.7;
}

.inline-grading-result strong {
  color: #15803d;
}

/* Better filters */
.submissions-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  padding: 16px 20px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
}

.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 0;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  background: transparent;
}

.search-box input:focus {
  outline: none;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.filter-btn {
  padding: 10px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: white;
  color: var(--text-medium);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

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

/* Stats badges */
.submissions-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-medium);
}

.stat-item i {
  color: var(--primary);
}

/* Back button */
.back-to-main-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  color: var(--text-medium);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.25s ease;
  margin-bottom: 16px;
}

.back-to-main-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}

/* Better page header */
.submissions-page-header h1 {
  font-size: 2rem;
  color: var(--text-dark);
  margin: 12px 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.submissions-page-header h1 i {
  color: var(--primary);
}

/* Graded by me today button */
.filter-btn.graded-today-btn {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  font-weight: 600;
}

.filter-btn.graded-today-btn:hover {
  background: #eef2ff;
  border-color: var(--primary-dark);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.filter-btn.graded-today-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.filter-btn.graded-today-btn i {
  margin-right: 6px;
}

/* Grading Header Right Section */
.grading-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grading-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.grading-action-btn.copy-url-btn {
  background: #f3f4f6;
  color: #374151;
}

.grading-action-btn.copy-url-btn:hover {
  background: #e5e7eb;
}

.grading-action-btn.send-zalo-btn {
  background: #0068ff;
  color: white;
}

.grading-action-btn.send-zalo-btn:hover {
  background: #0052cc;
}

.grading-action-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Writing Content (Đề bài) Section */
.submission-writing-content {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 24px 16px 24px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.writing-content-label {
  font-weight: 600;
  color: #92400e;
  margin-bottom: 10px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.writing-content-label i {
  color: #d97706;
}

.writing-content-body {
  background: white;
  border-radius: 8px;
  padding: 12px 15px;
  color: #1f2937;
  line-height: 1.6;
}

.writing-content-body p {
  margin: 0 0 10px 0;
}

.writing-content-body p:last-child {
  margin-bottom: 0;
}

.writing-content-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #92400e;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px dashed #f59e0b;
}


/* ========== Homework Type Popup Styles ========== */
.homework-type-popup {
  max-width: 500px;
}

.homework-type-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.homework-type-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.homework-type-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.homework-type-option:has(input:checked) {
  background: #eff6ff;
  border-color: #3b82f6;
}

.homework-type-option input[type="radio"] {
  display: none;
}

.homework-type-radio {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
}

.homework-type-option:has(input:checked) .homework-type-radio {
  border-color: #3b82f6;
}

.homework-type-option:has(input:checked) .homework-type-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: #3b82f6;
  border-radius: 50%;
}

.homework-type-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #334155;
  line-height: 1.4;
}

.homework-type-label i {
  font-size: 16px;
  color: #64748b;
  width: 20px;
  text-align: center;
}

.homework-type-option:has(input:checked) .homework-type-label {
  color: #1e40af;
  font-weight: 500;
}

.homework-type-option:has(input:checked) .homework-type-label i {
  color: #3b82f6;
}

.homework-type-guide {
  margin-top: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
  border-radius: 10px;
  border-left: 4px solid #eab308;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.homework-type-guide i {
  color: #ca8a04;
  font-size: 18px;
  margin-top: 2px;
}

.homework-type-guide p {
  margin: 0;
  font-size: 13px;
  color: #713f12;
  line-height: 1.5;
}


/* Homework Badge Section on Submission Cards */
.homework-badge-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  padding: 4px 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  max-width: 450px;
}

.homework-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #f59e0b;
  color: white;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.homework-badge-text {
  font-size: 12px;
  color: #92400e;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Homework URL Badge */
.homework-url-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #3b82f6;
  color: white;
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.homework-url-badge:hover {
  background: #2563eb;
  transform: scale(1.1);
}

/* Homework Action Buttons */
.homework-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.homework-action-btn.accept {
  background: #10b981;
  color: white;
}

.homework-action-btn.accept:hover {
  background: #059669;
  transform: scale(1.1);
}

.homework-action-btn.reject {
  background: #ef4444;
  color: white;
}

.homework-action-btn.reject:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Homework Status Badges */
.homework-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.homework-status-badge.accepted {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.homework-status-badge.rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Homework Badge Section Variants */
.homework-badge-section.homework-accepted {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.homework-badge-section.homework-rejected {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #ef4444;
}

.homework-badge-section.homework-pending {
  gap: 6px;
}

/* Homework Pending Filter Button */
.filter-btn.homework-pending-btn {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #f59e0b;
}

.filter-btn.homework-pending-btn:hover {
  background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
}

.filter-btn.homework-pending-btn.active {
  background: #f59e0b;
  color: white;
  border-color: #d97706;
}

/* ========== Homework Section Styles ========== */
.homework-section {
  margin-top: 24px;
}

.homework-card {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

.homework-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.homework-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.homework-icon i {
  font-size: 24px;
  color: white;
}

.homework-title h3 {
  margin: 0 0 4px 0;
  font-size: 1.25rem;
  color: #92400e;
  font-weight: 700;
}

.homework-title p {
  margin: 0;
  color: #b45309;
  font-size: 0.95rem;
}

/* ===== NEW 3-SECTION HOMEWORK UPLOAD ===== */
.homework-upload-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.homework-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: #fff;
  border: 2px dashed #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 120px;
}

.homework-option-card:hover {
  border-color: #f59e0b;
  background: #fffbeb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.homework-option-card:active {
  transform: translateY(0);
}

.homework-option-card .option-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.homework-option-card .option-icon.camera {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.homework-option-card .option-icon.clipboard {
  background: linear-gradient(135deg, #10b981, #059669);
}

.homework-option-card .option-icon i {
  font-size: 20px;
  color: #fff;
}

.homework-option-card .option-text h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 4px 0;
}

.homework-option-card .option-text p {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

/* ===== Camera Modal for Webcam ===== */
.homework-camera-modal {
  background: #1f2937;
  border-radius: 12px;
  margin: 16px;
  overflow: hidden;
}

.camera-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #111827;
  color: #fff;
}

.camera-modal-header span {
  font-size: 14px;
  font-weight: 600;
}

.camera-modal-header span i {
  margin-right: 8px;
  color: #ef4444;
}

.camera-close-btn {
  background: #374151;
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.camera-close-btn:hover {
  background: #4b5563;
}

.camera-video-container {
  position: relative;
  background: #000;
  aspect-ratio: 16/9;
  max-height: 400px;
}

.camera-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-modal-actions {
  padding: 16px;
  display: flex;
  justify-content: center;
  background: #111827;
}

.camera-capture-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.camera-capture-btn:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: scale(1.05);
}

.camera-capture-btn:active {
  transform: scale(0.98);
}

.camera-capture-btn i {
  font-size: 18px;
}

/* Mobile responsive for camera modal */
@media (max-width: 600px) {
  .homework-camera-modal {
    margin: 10px;
  }

  .camera-video-container {
    aspect-ratio: 4/3;
    max-height: 300px;
  }

  .camera-capture-btn {
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* Preview Area */
.homework-preview-area {
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  margin: 0 16px 16px 16px;
}

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

.homework-preview-area .preview-header span {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.homework-preview-area .preview-header span i {
  margin-right: 6px;
  color: #f59e0b;
}

.homework-preview-area .remove-preview-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.homework-preview-area .remove-preview-btn:hover {
  background: #fecaca;
}

.preview-image-container {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
}

.preview-image-container img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.preview-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.homework-cancel-btn {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.homework-cancel-btn:hover:not(:disabled) {
  background: #e5e7eb;
}

.homework-cancel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .homework-upload-options {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .homework-option-card {
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px;
    min-height: auto;
    gap: 14px;
  }

  .homework-option-card .option-icon {
    margin-bottom: 0;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .homework-option-card .option-text {
    text-align: left;
  }

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

  .preview-actions button {
    width: 100%;
    justify-content: center;
  }
}

.homework-upload-area {
  background: white;
  border: 3px dashed #f59e0b;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.homework-upload-area:hover {
  border-color: #d97706;
  background: #fffbeb;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-placeholder i {
  font-size: 48px;
  color: #f59e0b;
}

.upload-placeholder p {
  margin: 0;
  font-size: 1.1rem;
  color: #92400e;
  font-weight: 600;
}

.upload-hint {
  font-size: 0.85rem;
  color: #b45309;
}

.upload-preview {
  position: relative;
  display: flex;
  justify-content: center;
}

.upload-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.remove-preview-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  background: #ef4444;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
}

.remove-preview-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.homework-actions {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.homework-submit-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.homework-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.homework-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.homework-submitted {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.homework-submitted-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  color: #059669;
  font-size: 1.15rem;
  font-weight: 700;
}

.homework-submitted-header i {
  font-size: 24px;
}

.homework-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.homework-preview img:hover {
  transform: scale(1.02);
}

/* Mobile responsive */
@media (max-width: 600px) {
  .homework-card {
    padding: 16px;
  }

  .homework-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .homework-icon {
    width: 48px;
    height: 48px;
  }

  .homework-icon i {
    font-size: 20px;
  }
}


/* Homework Rejected Notice */
.homework-rejected-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
  border: 1px solid #fc8181;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.homework-rejected-notice .rejected-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.homework-rejected-notice .rejected-icon i {
  color: white;
  font-size: 20px;
}

.homework-rejected-notice .rejected-text strong {
  display: block;
  color: #c53030;
  font-size: 15px;
  margin-bottom: 4px;
}

.homework-rejected-notice .rejected-text p {
  color: #742a2a;
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

/* Rejection Note Popup */
.rejection-note-popup {
  max-width: 450px;
}

.rejection-note-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.rejection-note-input:focus {
  outline: none;
  border-color: #f44336;
}

/* Teacher Note Display for Students */
.teacher-note {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 12px 16px;
  margin-top: 12px;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.teacher-note i {
  color: #ff9800;
  margin-top: 2px;
}

.teacher-note span {
  color: #5d4037;
  font-size: 14px;
  line-height: 1.5;
}


/* ========== Homework Writing Editor Styles (Type 2) ========== */
.homework-writing-card .homework-icon.writing {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.homework-writing-editor-container {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 16px;
}

.homework-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.homework-toolbar select,
.homework-toolbar button {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.homework-toolbar select:hover,
.homework-toolbar button:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.homework-toolbar .separator {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 4px;
}

.homework-toolbar .color-btn {
  font-weight: bold;
  width: 32px;
}

.homework-toolbar .color-btn.purple {
  color: #6366f1;
}

.homework-toolbar .color-btn.magenta {
  color: #d63384;
}

.homework-toolbar .color-btn.red {
  color: #dc3545;
}

.homework-editor-wrapper {
  padding: 16px;
}

.homework-editor {
  min-height: 250px;
  max-height: 500px;
  overflow-y: auto;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  color: #1e293b;
}

.homework-editor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.homework-writing-actions {
  display: flex;
  justify-content: flex-end;
  padding: 16px;
  border-top: 1px solid #f1f5f9;
}

.homework-writing-content {
  background: #f8fafc;
  border-radius: 8px;
  padding: 20px;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.7;
  color: #1e293b;
}

/* Mobile responsive for homework editor */
@media (max-width: 768px) {
  .homework-toolbar {
    padding: 6px 8px;
  }

  .homework-toolbar select,
  .homework-toolbar button {
    padding: 5px 8px;
    font-size: 12px;
  }

  .homework-editor {
    min-height: 200px;
    font-size: 14px;
  }
}

/* ========== Homework Content Preview Popup ========== */
.homework-content-popup {
  max-width: 700px;
  width: 95%;
}

.homework-content-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  color: #1e293b;
}

.homework-review-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.homework-review-footer .reject-btn {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.homework-review-footer .reject-btn:hover {
  background: #fecaca;
}

/* Homework URL badge as button */
button.homework-url-badge {
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #e0f2fe;
  color: #0284c7;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

button.homework-url-badge:hover {
  background: #bae6fd;
}

/* ========== Homework View Button (Type 2) ========== */
.homework-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}

.homework-view-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.homework-view-btn i {
  font-size: 11px;
}

/* Small version for accepted/rejected states */
.homework-view-btn.small {
  padding: 4px 10px;
  font-size: 11px;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.3);
}

.homework-view-btn.small:hover {
  background: linear-gradient(135deg, #0284c7, #0891b2);
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.4);
}

/* ========== Homework Video Link Styles (Type 3) ========== */
.homework-video-card .homework-icon.video {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
}

.homework-video-input-container {
  padding: 20px;
}

.homework-video-instructions {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.instruction-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.instruction-step:not(:last-child) {
  border-bottom: 1px dashed #fcd34d;
}

.step-number {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
}

.step-text strong {
  color: #92400e;
}

.homework-video-record-section {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.homework-record-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.homework-record-btn:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.homework-record-btn i {
  font-size: 18px;
  animation: pulse-record 1.5s infinite;
}

@keyframes pulse-record {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.homework-video-link-input {
  margin-bottom: 16px;
}

.homework-video-link-input label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.homework-video-link-input label i {
  color: #6366f1;
  margin-right: 6px;
}

.homework-video-link-input input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.homework-video-link-input input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.homework-video-link-input input::placeholder {
  color: #9ca3af;
}

.homework-video-actions {
  display: flex;
  justify-content: flex-end;
}

.homework-video-link {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.homework-video-link i {
  color: #16a34a;
}

.homework-video-link a {
  color: #15803d;
  word-break: break-all;
  text-decoration: none;
}

.homework-video-link a:hover {
  text-decoration: underline;
}

/* Video Popup Styles */
.homework-video-popup {
  max-width: 800px;
  width: 95%;
}

.homework-video-container {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/9;
}

.homework-video-player {
  width: 100%;
  height: 100%;
  border: none;
}

.video-link-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: #fff;
}

.video-link-fallback i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.video-link-fallback p {
  margin-bottom: 20px;
  opacity: 0.8;
}

.video-external-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.video-external-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Video view button style */
.homework-view-btn.video {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.3);
}

.homework-view-btn.video:hover {
  background: linear-gradient(135deg, #e11d48, #db2777);
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

.homework-view-btn.video.small {
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  box-shadow: 0 2px 4px rgba(244, 63, 94, 0.3);
}

.homework-view-btn.video.small:hover {
  background: linear-gradient(135deg, #e11d48, #db2777);
  box-shadow: 0 3px 8px rgba(244, 63, 94, 0.4);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .homework-video-instructions {
    padding: 12px 16px;
  }

  .instruction-step {
    gap: 10px;
    padding: 6px 0;
  }

  .step-number {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .step-text {
    font-size: 13px;
  }

  .homework-record-btn {
    padding: 12px 24px;
    font-size: 15px;
  }

  .homework-video-popup {
    max-width: 95%;
  }
}


/* ========== Video Player in Popup ========== */
video.homework-video-player {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 8px;
}

.video-fallback-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.video-fallback-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

.video-fallback-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  padding: 40px 20px 20px;
  border-radius: 0 0 8px 8px;
}

.video-fallback-overlay .video-link-fallback {
  background: transparent;
  padding: 0;
}

.video-fallback-overlay .video-link-fallback i {
  font-size: 24px;
  margin-bottom: 8px;
}

.video-fallback-overlay .video-link-fallback p {
  font-size: 13px;
  margin-bottom: 12px;
}


/* ========================================
   COMPACT SUBMISSIONS HEADER - NEW DESIGN
   ======================================== */

.submissions-page-header-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.header-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s;
}

.back-btn-compact:hover {
  background: #e5e7eb;
  color: #374151;
}

.page-title-compact {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title-compact i {
  color: #6366f1;
  font-size: 1.1rem;
}

.header-spacer {
  flex: 1;
}

.filters-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 160px;
  max-width: 200px;
}

.search-box-compact i {
  color: #9ca3af;
  font-size: 0.85rem;
}

.search-box-compact input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
  color: #374151;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 16px;
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-chip i {
  font-size: 0.75rem;
}

.filter-chip:hover {
  border-color: #6366f1;
  color: #6366f1;
}

.filter-chip.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
}

.filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.chip-label {
  font-weight: 500;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #f3f4f6;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
}

/* Specific chip colors */
.filter-chip.graded-today {
  border-color: #fbbf24;
  color: #b45309;
}

.filter-chip.graded-today:hover {
  background: #fef3c7;
}

.filter-chip.graded-today.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: white;
}

.filter-chip.graded-today .chip-count {
  background: #fef3c7;
  color: #b45309;
}

.filter-chip.graded-today.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.filter-chip.zalo-sent {
  border-color: #0068ff;
  color: #0068ff;
}

.filter-chip.zalo-sent:hover {
  background: #e6f0ff;
}

.filter-chip.zalo-sent.active {
  background: #0068ff;
  border-color: #0068ff;
  color: white;
}

.filter-chip.zalo-sent .chip-count {
  background: #e6f0ff;
  color: #0068ff;
}

.filter-chip.zalo-sent.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.filter-chip.homework {
  border-color: #10b981;
  color: #059669;
}

.filter-chip.homework:hover {
  background: #d1fae5;
}

.filter-chip.homework.active {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.filter-chip.homework .chip-count {
  background: #d1fae5;
  color: #059669;
}

.filter-chip.homework.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.filter-chip.homework-pending {
  border-color: #f97316;
  color: #ea580c;
}

.filter-chip.homework-pending:hover {
  background: #ffedd5;
}

.filter-chip.homework-pending.active {
  background: #f97316;
  border-color: #f97316;
  color: white;
}

.filter-chip.homework-pending .chip-count {
  background: #ffedd5;
  color: #ea580c;
}

.filter-chip.homework-pending.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box-compact {
    max-width: 100%;
  }

  .filter-chips {
    justify-content: flex-start;
  }

  .filter-chip {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .chip-count {
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
  }
}

/* ========================================
   NEW SUBMISSIONS HEADER - 2 ROW DESIGN
   ======================================== */

.submissions-header-new {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

/* Row 1: Back, Title, Search */
.header-row-1 {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #f3f4f6;
  border-radius: 10px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.2s;
  flex-shrink: 0;
}

.back-btn-new:hover {
  background: #6366f1;
  color: white;
}

.title-new {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.title-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.title-icon i {
  color: #fff;
  font-size: 1.1rem;
}

.title-text {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.search-wrapper {
  flex: 1;
  max-width: 320px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.2s;
}

.search-wrapper:focus-within {
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-wrapper i {
  color: #9ca3af;
  font-size: 0.9rem;
}

.search-wrapper input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  color: #374151;
}

/* Search wrapper inline (in filter row) */
.search-wrapper-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 14px;
  min-width: 200px;
  max-width: 280px;
  transition: all 0.2s;
}

.search-wrapper-inline:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-wrapper-inline i {
  color: #9ca3af;
  font-size: 0.85rem;
}

.search-wrapper-inline input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
  color: #374151;
}

/* Row 2: Filters */
.header-row-2 {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Main Filter Tabs */
.filter-tabs {
  display: flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.filter-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tab:hover {
  color: #374151;
  background: rgba(255, 255, 255, 0.5);
}

.filter-tab.active {
  background: white;
  color: #1f2937;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #e5e7eb;
  border-radius: 11px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
}

.filter-tab.active .tab-badge {
  background: #6366f1;
  color: white;
}

.tab-badge.highlight {
  background: #fef3c7;
  color: #d97706;
}

.filter-tab.active .tab-badge.highlight {
  background: #6366f1;
  color: white;
}

/* Divider */
.filter-divider {
  width: 1px;
  height: 28px;
  background: #e5e7eb;
}

/* Special Filter Tags */
.filter-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid;
  background: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tag i {
  font-size: 0.75rem;
}

.tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Yellow Tag - Graded Today */
.filter-tag.tag-yellow {
  border-color: #fcd34d;
  color: #b45309;
  background: #fffbeb;
}

.filter-tag.tag-yellow .tag-count {
  background: #fef3c7;
  color: #b45309;
}

.filter-tag.tag-yellow:hover {
  background: #fef3c7;
}

.filter-tag.tag-yellow.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: white;
}

.filter-tag.tag-yellow.active .tag-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* Blue Tag - Zalo */
.filter-tag.tag-blue {
  border-color: #60a5fa;
  color: #1d4ed8;
  background: #eff6ff;
}

.filter-tag.tag-blue .tag-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.filter-tag.tag-blue:hover {
  background: #dbeafe;
}

.filter-tag.tag-blue.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.filter-tag.tag-blue.active .tag-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* Green Tag - BTVN */
.filter-tag.tag-green {
  border-color: #6ee7b7;
  color: #047857;
  background: #ecfdf5;
}

.filter-tag.tag-green .tag-count {
  background: #d1fae5;
  color: #047857;
}

.filter-tag.tag-green:hover {
  background: #d1fae5;
}

.filter-tag.tag-green.active {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.filter-tag.tag-green.active .tag-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* Orange Tag - Waiting */
.filter-tag.tag-orange {
  border-color: #fdba74;
  color: #c2410c;
  background: #fff7ed;
}

.filter-tag.tag-orange .tag-count {
  background: #ffedd5;
  color: #c2410c;
}

.filter-tag.tag-orange:hover {
  background: #ffedd5;
}

.filter-tag.tag-orange.active {
  background: #f97316;
  border-color: #f97316;
  color: white;
}

.filter-tag.tag-orange.active .tag-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header-row-1 {
    flex-wrap: wrap;
  }

  .search-wrapper {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
  }

  .header-row-2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filter-divider {
    display: none;
  }

  .filter-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .filter-tab {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .filter-tags {
    width: 100%;
  }

  .filter-tag {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
}

/* ========== Date Filter Section ========== */
.header-row-3 {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.date-filter-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.date-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #c4b5fd;
  background: #f5f3ff;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #6d28d9;
  transition: all 0.2s;
}

.date-filter-group:hover {
  background: #ede9fe;
}

.date-filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6d28d9;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.date-filter-group label i {
  color: #7c3aed;
  font-size: 0.75rem;
}

.date-input {
  padding: 4px 8px;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #5b21b6;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.date-input:hover {
  border-color: #6366f1;
  background: white;
}

.date-input:focus {
  outline: none;
  border-color: #6366f1;
  background: white;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.date-clear-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: #fecaca;
  color: #dc2626;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.7rem;
}

.date-clear-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

.range-group {
  flex-wrap: wrap;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .header-row-3 {
    padding: 10px 12px;
  }

  .date-filter-section {
    flex-direction: column;
    gap: 10px;
  }

  .date-filter-group {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .date-input {
    flex: 1;
    min-width: 120px;
  }

  .range-group {
    gap: 6px;
  }
}

/* ==================== PAGINATION STYLES ==================== */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  margin-top: 24px;
  border: 1px solid #e2e8f0;
}

.pagination-info {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
  background: #6366f1;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-num {
  min-width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0 12px;
}

.pagination-num:hover {
  background: #e0e7ff;
  color: #6366f1;
}

.pagination-num.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transform: scale(1.05);
}

.pagination-dots {
  color: #94a3b8;
  font-weight: bold;
  padding: 0 4px;
}

.pagination-goto {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #64748b;
}

.pagination-goto span {
  font-weight: 500;
  white-space: nowrap;
}

.pagination-goto input {
  width: 60px;
  height: 40px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s ease;
  background: white;
}

.pagination-goto input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.pagination-goto input::placeholder {
  color: #94a3b8;
}

.pagination-goto-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.pagination-goto-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Responsive pagination */
@media (max-width: 768px) {
  .pagination-container {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .pagination-info {
    order: 1;
    text-align: center;
    width: 100%;
  }

  .pagination-controls {
    order: 2;
  }

  .pagination-goto {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .pagination-num {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .pagination-btn {
    width: 36px;
    height: 36px;
  }
}

/* View More Button for Test Links */
.view-more-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  margin-top: 10px;
}

.view-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.view-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.view-more-btn i {
  font-size: 12px;
  animation: bounce 1.5s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(3px);
  }
}

/* ========== Complaint Button Styles ========== */
.complaint-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.complaint-btn:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.complaint-btn i {
  font-size: 12px;
}

/* ========== Complaint Popup Styles ========== */
.complaint-popup {
  max-width: 500px;
  width: 90%;
}

.complaint-textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #fecaca;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  margin-top: 10px;
  background: #fef2f2;
  transition: all 0.2s ease;
}

.complaint-textarea:focus {
  outline: none;
  border-color: #ef4444;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ========== Complaints Section (Multiple Complaints) ========== */
.complaints-section {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #fecaca;
  background: #fff;
}

.complaints-section-header {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.complaints-section-header i {
  font-size: 16px;
  animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.complaints-list {
  padding: 0;
}

.complaint-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #fecaca;
  background: #fef2f2;
  transition: background 0.2s ease;
}

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

.complaint-item:hover {
  background: #fee2e2;
}

.complaint-item-number {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.complaint-item-content {
  flex: 1;
}

.complaint-item-text {
  font-size: 14px;
  color: #7f1d1d;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
}

.complaint-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: #991b1b;
}

.complaint-item-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.complaint-item-meta i {
  color: #ef4444;
  font-size: 11px;
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .complaint-item {
    flex-direction: column;
    gap: 8px;
  }

  .complaint-item-number {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 11px;
  }

  .complaint-item-meta {
    flex-direction: column;
    gap: 4px;
  }
}


/* Red filter tag for Complaints */
.filter-tag.tag-red {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.filter-tag.tag-red:hover {
  background: linear-gradient(135deg, #fecaca, #fca5a5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.filter-tag.tag-red.active {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border-color: #b91c1c;
}


/* ========== VIDEO RECORDER STYLES ========== */
.video-recorder-container {
  background: #f8fafc;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.recorder-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.recorder-preview-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-timer {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.idle-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.idle-card {
  text-align: center;
  color: white;
  padding: 32px;
}

.idle-card i {
  font-size: 48px;
  color: #6366f1;
  margin-bottom: 16px;
}

.idle-card h3 {
  font-size: 20px;
  margin: 0 0 8px;
}

.idle-card p {
  font-size: 14px;
  color: #94a3b8;
  margin: 0;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: white;
  margin-top: 16px;
  font-size: 14px;
}

.recorder-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.toggle-control input {
  accent-color: #6366f1;
}

.mic-select {
  flex: 1;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
}

.actions-row {
  justify-content: center;
  padding-top: 8px;
}

.record-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.record-btn.start {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

.record-btn.start:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
}

.record-btn.stop {
  background: linear-gradient(135deg, #475569, #334155);
  color: white;
}

.record-btn.again {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
}

.record-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.upload-progress-container {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

#uploadStatusText {
  color: #475569;
}

#uploadPercentText {
  color: #6366f1;
  font-weight: 600;
}

.progress-bar-wrapper {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  width: 0%;
  transition: width 0.3s;
}

/* FIX: Make hidden attribute work properly */
.idle-overlay[hidden],
.loading-overlay[hidden],
[hidden] {
  display: none !important;
}

/* Video Grade Button */
.grade-video-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 10px;
}

.grade-video-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.grade-video-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Video Grade Result */
.video-grade-result-container {
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.video-grade-result {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.grade-score {
  text-align: center;
  padding: 16px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.grade-percent {
  font-size: 32px;
  font-weight: 700;
  color: #10b981;
}

.grade-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.grade-details {
  flex: 1;
}

.grade-details p {
  margin: 8px 0;
  color: #334155;
}

.transcribed-text {
  background: white;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-style: italic;
  color: #475569;
}


/* ========== Video Player Styles ========== */
.video-player-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  margin-bottom: 12px;
}

.submission-video-player {
  width: 100%;
  max-width: 640px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: #000;
}

.submission-video-player:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Hide transcribed text by default */
.transcribed-text-hidden {
  display: none;
}

/* Optional: Add a toggle button style if you want to show/hide transcript later */
.toggle-transcript-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}

.toggle-transcript-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}


/* ========== Video Player Styles for Submissions Page ========== */
.submission-video-section {
  margin-bottom: 16px;
}

/* Video Inner Container - wraps video and overlay together */
.video-inner-container {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
}

/* Video Play Overlay - covers entire video */
.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s ease;
}

.video-play-overlay:hover {
  background: rgba(0, 0, 0, 0.4);
}

.video-play-overlay:hover .video-play-btn {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 1);
}

/* Play Button - centered circle */
.video-play-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.video-play-btn i {
  font-size: 28px;
  color: #1e293b;
  margin-left: 4px; /* Slight offset to center the play icon visually */
}


.video-player-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  margin-top: 8px;
}

.submission-video-player {
  width: 100%;
  max-width: 560px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: #000;
}

.submission-video-player:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Hide transcript by default when video exists */
.transcript-hidden {
  display: none !important;
}

/* Toggle transcript button */
.toggle-transcript-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s;
}

.toggle-transcript-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* ========== Two Column Layout: Nội dung đề bài + Video ========== */
.submission-content-video-row {
  display: flex;
  gap: 20px;
  margin: 16px 24px 16px 24px;
}

.submission-content-left {
  flex: 1;
  min-width: 0;
}

.submission-content-left .submission-writing-content {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.submission-content-left .submission-writing-content .writing-content-body {
  flex: 1;
}

.submission-content-left .submission-source {
  margin-top: 12px;
}

.submission-content-right {
  flex: 0 0 420px;
  min-width: 0;
}

.submission-content-right .submission-video-section {
  margin: 0;
  height: 100%;
}

.submission-content-right .video-player-wrapper {
  margin-top: 8px;
  height: calc(100% - 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.submission-content-right .submission-video-player {
  max-width: 100%;
  max-height: 280px;
  width: 100%;
}

/* Responsive: Stack on mobile */
@media (max-width: 900px) {
  .submission-content-video-row {
    flex-direction: column;
  }

.submission-content-left,
  .submission-content-right {
    flex: none !important;
    width: 100%;
  }
}

.speaking-two-column-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.speaking-two-column-layout .left-column-stack {
  flex: 1;
  min-width: 0;
}

.speaking-two-column-layout .topic-card {
  margin-bottom: 0;
}

.speaking-two-column-layout .student-submission-section {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  position: sticky;
  top: 20px;
}

/* Make video recorder smaller */
.speaking-two-column-layout .recorder-preview-wrapper {
  aspect-ratio: 4/3;
}

.speaking-two-column-layout .video-recorder-container {
  padding: 16px;
}

.speaking-two-column-layout .submission-header h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.speaking-two-column-layout .idle-card {
  padding: 20px;
}

.speaking-two-column-layout .idle-card i {
  font-size: 36px;
  margin-bottom: 12px;
}

.speaking-two-column-layout .idle-card h3 {
  font-size: 16px;
}

.speaking-two-column-layout .idle-card p {
  font-size: 12px;
}

.speaking-two-column-layout .record-btn {
  padding: 10px 20px;
  font-size: 14px;
}

/* Mobile: Stack vertically */
@media (max-width: 1024px) {
  .speaking-two-column-layout {
    flex-direction: column;
  }

  .speaking-two-column-layout .left-column-stack,
  .speaking-two-column-layout .student-submission-section {
    width: 100%;
  }

  .speaking-two-column-layout .student-submission-section {
    margin-top: 20px;
  }
}


/* ========== BEAUTIFUL RECORDING CARD ========== */
.recording-card {
  background: white;
  border-radius: 24px;
  box-shadow:
    0 4px 6px rgba(16, 185, 129, 0.08),
    0 10px 40px rgba(16, 185, 129, 0.15);
  overflow: hidden;
  border: none;
  height: 100%;
}

.recording-card-header {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
  padding: 14px 20px;
  position: relative;
  overflow: hidden;
}

.recording-card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
  pointer-events: none;
}

.recording-header-decoration {
  position: absolute;
  top: -30%;
  right: -5%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

.recording-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.95);
  color: #0284c7;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.recording-label i {
  font-size: 0.9rem;
}

.recording-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin: 0;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.15);
}

/* ===== NEW HEADER CONTROLS LAYOUT ===== */
.recording-header-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.recording-header-top-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recording-header-left {
  flex: 1;
}

.recording-header-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Header Control Groups */
.header-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 12px;
}

.header-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-toggle-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #0284c7;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.header-toggle-control:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.header-toggle-control input {
  width: 18px;
  height: 18px;
  accent-color: #0284c7;
}

.header-toggle-control span {
  display: flex;
  align-items: center;
}

.header-mic-select {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #374151;
  min-width: 180px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.header-mic-select:hover {
  background: white;
  transform: translateY(-1px);
}

.header-mic-select:focus {
  outline: 2px solid white;
}

.header-visibility-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #0284c7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.header-visibility-badge:hover {
  background: white;
  transform: translateY(-1px);
}

.header-mini-toggle {
  position: relative;
  width: 40px;
  height: 22px;
}

.header-mini-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.header-mini-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 22px;
  transition: 0.3s;
}

.header-mini-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-mini-toggle input:checked+.header-mini-slider {
  background-color: #0284c7;
}

.header-mini-toggle input:checked+.header-mini-slider::before {
  transform: translateX(18px);
}

.header-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: #0284c7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.header-time-badge i {
  font-size: 13px;
}

.header-time-badge span {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

.header-adjust-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.header-adjust-btn:hover {
  background: #0284c7;
  color: white;
}

/* Header Record Button */
.header-record-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.header-record-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.header-record-btn i {
  font-size: 12px;
  animation: pulse-record 1.5s ease-in-out infinite;
}

@keyframes pulse-record {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.header-record-btn.stop {
  background: linear-gradient(135deg, #64748b, #475569);
  box-shadow: 0 4px 15px rgba(100, 116, 139, 0.4);
}

.header-record-btn.stop:hover {
  box-shadow: 0 6px 20px rgba(100, 116, 139, 0.5);
}

.header-record-btn.again {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.header-record-btn.again:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.header-record-btn.again i {
  animation: none;
}

.header-record-btn.grade {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.header-record-btn.grade:hover {
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.header-record-btn.grade i {
  animation: none;
}

.header-record-btn.stop i {
  animation: none;
}

.header-submit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.header-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.header-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.header-submit-btn i {
  font-size: 13px;
}

/* Compact actions row */
.compact-actions {
  justify-content: center;
  padding: 12px 20px !important;
  min-height: auto !important;
}

.controls-row.actions-only {
  justify-content: center;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .recording-header-controls {
    flex-direction: column;
    gap: 10px;
  }

  .header-controls-left,
  .header-controls-right {
    width: 100%;
    justify-content: center;
  }

  .header-mic-select {
    max-width: 120px;
    font-size: 12px;
  }

  .header-submit-btn,
  .header-record-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

.recording-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.recording-card-body {
  padding: 20px;
}

/* Override video recorder styles inside the card */
.recording-card .video-recorder-container {
  background: transparent;
  padding: 0;
  margin-bottom: 16px;
}

.recording-card .recorder-preview-wrapper {
  aspect-ratio: 4/3;
  border-radius: 16px;
  border: 3px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.recording-card .idle-overlay {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 13px;
}

.recording-card .idle-card {
  padding: 24px;
}

.recording-card .idle-card i {
  font-size: 40px;
  color: #10b981;
  margin-bottom: 12px;
}

.recording-card .idle-card h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.recording-card .idle-card p {
  font-size: 12px;
}

/* Nicer controls */
.recording-card .recorder-controls {
  background: #f8fafc;
  padding: 16px;
  border-radius: 12px;
  margin-top: 16px;
}

.recording-card .controls-row {
  gap: 10px;
}

.recording-card .toggle-control {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  transition: all 0.2s;
}

.recording-card .toggle-control:hover {
  border-color: #10b981;
}

.recording-card .mic-select {
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  transition: all 0.2s;
}

.recording-card .mic-select:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.recording-card .record-btn {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: 12px;
}

.recording-card .record-btn.start {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.recording-card .record-btn.start:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.recording-card .record-btn.again {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* Submission actions inside card */
.recording-card .submission-actions {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  margin: 0 -20px -20px -20px;
  padding: 16px 20px;
  border-top: 1px solid #bbf7d0;
  border-radius: 0 0 24px 24px;
}

.recording-card .submit-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.recording-card .submit-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

/* Student name input inside card */
.recording-card .student-name-input-wrapper {
  margin-bottom: 16px;
}

.recording-card .student-name-input-wrapper label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.recording-card .student-name-input-wrapper input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.recording-card .student-name-input-wrapper input:focus {
  border-color: #10b981;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Hide old header since we have new card header */
.recording-card+.submission-header,
.student-submission-section>.submission-header {
  display: none;
}

/* Two column layout adjustments */
.speaking-two-column-layout .student-submission-section {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}


/* ========== TRANSCRIPTION PREVIEW CARD ========== */
.transcript-card {
  background: white;
  border-radius: 24px;
  box-shadow:
    0 4px 6px rgba(245, 158, 11, 0.08),
    0 10px 40px rgba(245, 158, 11, 0.15);
  overflow: hidden;
  margin-top: 0;
}

.transcript-card-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 40%, #b45309 100%);
  padding: 10px 16px 12px;
  position: relative;
  overflow: hidden;
}

.transcript-card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

.transcript-header-decoration {
  position: absolute;
  top: -30%;
  right: -5%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}

.transcript-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.95);
  color: #b45309;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.transcript-label i {
  font-size: 0.85rem;
}

.transcript-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  margin: 0;
  line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.transcript-card-body {
  padding: 16px;
}

.transcript-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid #fcd34d;
}

.transcript-hint i {
  color: #f59e0b;
  font-size: 1.1rem;
}

.transcript-hint span {
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 500;
}

.transcript-content {
  background: #fffbeb;
  border: 2px dashed #fcd34d;
  border-radius: 16px;
  padding: 20px;
  min-height: 120px;
}

/* Remove extra space when grammar content is shown */
.transcript-content:has(.transcript-grammar-section) {
  padding: 4px 14px 8px 14px;
  min-height: auto;
}


.transcript-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: #d97706;
}

.transcript-placeholder i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.transcript-placeholder p {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
}

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

.transcript-text.transcribing {
  color: #6b7280;
  font-style: italic;
}

.transcript-text.transcribing::after {
  content: '...';
  animation: dots 1.5s infinite;
}

@keyframes dots {

  0%,
  20% {
    content: '.';
  }

  40% {
    content: '..';
  }

  60%,
  100% {
    content: '...';
  }
}

/* Loading state for transcript */
.transcript-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.transcript-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #fde68a;
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.transcript-loading p {
  margin: 12px 0 0;
  color: #92400e;
  font-size: 0.9rem;
}

/* Custom scrollbar for transcript */
.transcript-content::-webkit-scrollbar {
  width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
  background: #fef3c7;
  border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb {
  background: #fcd34d;
  border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb:hover {
  background: #f59e0b;
}

/* Transcript text result styling */
.transcript-text-result {
  background: #f0fdf4;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
}

.transcript-text-result p {
  margin: 0;
  color: #166534;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Left column stack - topic and transcript stacked vertically */
.left-column-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Make transcript card always visible with min height for empty state */
.transcript-card {
  min-height: 150px;
}

/* Transcript text result styling */
.transcript-text-result {
  background: #f0fdf4;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
}

.transcript-text-result p {
  margin: 0;
  color: #166534;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ===== SINGLE ROW HEADER LAYOUT ===== */
.recording-header-single-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.recording-header-single-row .header-controls-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recording-header-single-row .header-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recording-header-single-row .header-control-group {
  background: transparent;
  padding: 0;
}

@media (max-width: 900px) {
  .recording-header-single-row {
    flex-wrap: wrap;
  }

  .recording-header-single-row .header-controls-left,
  .recording-header-single-row .header-controls-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .header-mic-select {
    min-width: 150px;
  }
}

/* ========== Prompt Section Styles ========== */
.prompt-section {
  margin-bottom: 20px;
}

.prompt-section:last-child {
  margin-bottom: 0;
}

.prompt-section-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-section-header i {
  background: rgba(255,255,255,0.2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.prompt-section .prompt-editor-container {
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.prompt-popup-body {
  max-height: 60vh;
  overflow-y: auto;
}

/* Grammar Feedback Section */
.transcript-grammar-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.grammar-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #92400e;
  font-size: 0.95rem;
  padding: 30px 20px;
  background: #fffbeb;
  border-radius: 12px;
}

.grammar-loading i {
  color: #f5a623;
}

.grammar-feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #4f46e5;
  margin-bottom: 12px;
}

.grammar-feedback-header i {
  font-size: 1.1rem;
}

.grammar-feedback-content {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
}

.grammar-feedback-content:first-child {
  margin-top: 0;
}
/* Remove ALL leading gaps from content */
.grammar-feedback-content > *:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.grammar-feedback-content > p:first-child:empty,
.grammar-feedback-content > br {
  display: none;
}

.grammar-feedback-content > p:not(:empty) ~ br {
  display: inline;
}

.grammar-feedback-content p {
  margin: 0 0 0.5em 0;
}

.grammar-feedback-content p:last-child {
  margin-bottom: 0;
}

.grammar-feedback-error {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dc2626;
  font-size: 0.9rem;
}

/* Force remove all leading whitespace in grammar content */
.grammar-feedback-content {
  white-space: normal;
}

.grammar-feedback-content::before {
  content: none;
}

/* ========== ENHANCED GRADING SECTIONS - Improvement & Requirements ========== */

/* Style for improvement sections (pink/coral colored) */
.inline-grading-result .grading-improvement-section,
.inline-grading-result div[style*="f43f5e"],
.inline-grading-result div[style*="ec4899"],
.inline-grading-result div[style*="fb7185"],
.inline-grading-result div[style*="ff6b6b"],
.inline-grading-result div[style*="fda4af"] {
  border-radius: 16px !important;
  overflow: hidden !important;
  margin: 20px 0 !important;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.15) !important;
}

/* Style for requirement sections (purple colored) */
.inline-grading-result .grading-requirement-section,
.inline-grading-result div[style*="a855f7"],
.inline-grading-result div[style*="8b5cf6"],
.inline-grading-result div[style*="7c3aed"],
.inline-grading-result div[style*="c084fc"] {
  border-radius: 16px !important;
  overflow: hidden !important;
  margin: 20px 0 !important;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15) !important;
}

/* Content area inside improvement/requirement sections */
.inline-grading-result .grading-improvement-section > div:last-child,
.inline-grading-result .grading-requirement-section > div:last-child,
.inline-grading-result div[style*="background"][style*="fff"] > div,
.inline-grading-result div[style*="background: #fff"],
.inline-grading-result div[style*="background:#fff"],
.inline-grading-result div[style*="background: white"],
.inline-grading-result div[style*="background:white"] {
  padding: 20px 24px !important;
}

/* Better bullet point styling inside these sections */
.inline-grading-result .grading-improvement-section ul,
.inline-grading-result .grading-requirement-section ul,
.inline-grading-result div[style*="f43f5e"] ~ div ul,
.inline-grading-result div[style*="a855f7"] ~ div ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 12px 0 !important;
}

.inline-grading-result .grading-improvement-section li,
.inline-grading-result .grading-requirement-section li {
  position: relative !important;
  padding: 12px 16px 12px 40px !important;
  margin-bottom: 10px !important;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9) !important;
  border-radius: 10px !important;
  border-left: 4px solid #6366f1 !important;
  line-height: 1.7 !important;
}

.inline-grading-result .grading-improvement-section li::before,
.inline-grading-result .grading-requirement-section li::before {
  content: "•" !important;
  position: absolute !important;
  left: 16px !important;
  top: 12px !important;
  color: #6366f1 !important;
  font-size: 18px !important;
  font-weight: bold !important;
}

/* Style for bold labels like "Ngữ pháp:", "Đã làm tốt:", etc */
.inline-grading-result .grading-improvement-section strong:first-child,
.inline-grading-result .grading-requirement-section strong:first-child,
.inline-grading-result div[style*="f43f5e"] ~ div strong,
.inline-grading-result div[style*="a855f7"] ~ div strong {
  display: inline-block !important;
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: white !important;
  padding: 3px 10px !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  margin-right: 8px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
}

/* Different color for improvement section labels */
.inline-grading-result .grading-improvement-section strong:first-child,
.inline-grading-result div[style*="f43f5e"] ~ div strong:first-of-type {
  background: linear-gradient(135deg, #f43f5e, #ec4899) !important;
}

/* Style paragraphs inside these sections */
.inline-grading-result .grading-improvement-section p,
.inline-grading-result .grading-requirement-section p {
  margin: 10px 0 !important;
  line-height: 1.8 !important;
  color: #374151 !important;
}

/* Style for examples or quoted text */
.inline-grading-result .grading-improvement-section em,
.inline-grading-result .grading-requirement-section em {
  background: #fef3c7 !important;
  color: #92400e !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-style: normal !important;
}

/* Compact sub-sections with icons */
.inline-grading-result div[style*="padding"] > p:first-child strong {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .inline-grading-result .grading-improvement-section,
  .inline-grading-result .grading-requirement-section {
    margin: 12px 0 !important;
  }
  
  .inline-grading-result .grading-improvement-section li,
  .inline-grading-result .grading-requirement-section li {
    padding: 10px 12px 10px 32px !important;
  }
  
  .inline-grading-result .grading-improvement-section li::before,
  .inline-grading-result .grading-requirement-section li::before {
    left: 10px !important;
  }
}

/* ========== Processing Overlay - Clean Design ========== */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.processing-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Two-column wrapper */
.processing-wrapper {
  display: flex;
  gap: 32px;
  align-items: stretch;
  max-width: 1100px;
  width: 95%;
  padding: 20px;
}

.processing-content {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px;
  width: 440px;
  flex-shrink: 0;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Video Preview Section */
.processing-video-section {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.video-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.video-section-header i {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  font-size: 1rem;
}

.video-section-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.video-section-header span {
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: 400;
}

/* Video Container */
.processing-video-container {
  flex: 1;
  background: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  min-height: 300px;
}

.processing-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1a2e;
  border-radius: 12px;
}

/* Video placeholder when no video */
.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
  padding: 40px;
}

.video-placeholder i {
  font-size: 3rem;
  opacity: 0.5;
}

.video-placeholder p {
  margin: 0;
  font-size: 0.9rem;
}

/* Video Controls Overlay */
.video-controls-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.processing-video-container:hover .video-controls-overlay {
  opacity: 1;
}

.processing-video-container.playing .video-controls-overlay {
  opacity: 0;
}

.processing-video-container.playing:hover .video-controls-overlay {
  opacity: 1;
}

.play-btn-overlay {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  font-size: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.play-btn-overlay:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.play-btn-overlay i {
  margin-left: 4px; /* Optical centering for play icon */
}

.processing-video-container.playing .play-btn-overlay i::before {
  content: "\f04c"; /* Pause icon */
}

/* Video Info Bar */
.video-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
}

.video-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #64748b;
}

.video-info-item i {
  color: #f59e0b;
  font-size: 0.85rem;
}

.video-info-item.recording-badge {
  background: #fee2e2;
  color: #dc2626;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.video-info-item.recording-badge i {
  color: #dc2626;
  animation: recordingPulse 1.5s ease-in-out infinite;
}

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

/* Tip at bottom of video section */
.video-section-tip {
  margin-top: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #bfdbfe;
}

.video-section-tip i {
  color: #3b82f6;
  font-size: 1rem;
  margin-top: 2px;
}

.video-section-tip p {
  margin: 0;
  font-size: 0.8rem;
  color: #1e40af;
  line-height: 1.4;
}

/* Mobile Responsive - Stack vertically */
@media (max-width: 800px) {
  .processing-wrapper {
    flex-direction: column;
    align-items: center;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .processing-content {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
  }
  
  .processing-video-section {
    width: 100%;
    max-width: 420px;
    min-width: unset;
  }
  
  .processing-video-container {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .processing-wrapper {
    padding: 12px;
    gap: 16px;
  }
  
  .processing-content {
    padding: 24px 20px;
  }
  
  .processing-video-section {
    padding: 16px;
  }
  
  .video-section-header h3 {
    font-size: 0.9rem;
  }
  
  .processing-video-container {
    min-height: 180px;
  }
  
  .play-btn-overlay {
    width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }
}

/* Simple Loader */
.processing-loader {
  margin-bottom: 20px;
}

.loader-circle {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  position: relative;
}

.loader-circle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid #f0f0f0;
}

.loader-circle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #f5a623;
  animation: loaderSpin 1s linear infinite;
}

.loader-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #f5a623;
}

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

/* Title */
.processing-title {
  color: #1a1a2e;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.processing-subtitle {
  color: #6b7280;
  font-size: 1rem;
  margin-bottom: 24px;
}

/* Progress Steps - Horizontal */
.processing-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 28px;
  padding: 0 10px;
}

.processing-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 100px;
}

.step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #9ca3af;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  position: relative;
}

.step-icon::after {
  content: '';
  position: absolute;
  right: -28px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 2px;
  background: #e5e7eb;
}

.processing-step:last-child .step-icon::after {
  display: none;
}

.processing-step.active .step-icon {
  background: #fef3c7;
  color: #f5a623;
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.15);
}

.processing-step.active .step-icon i {
  animation: stepBounce 0.6s ease infinite;
}

@keyframes stepBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.processing-step.completed .step-icon {
  background: #d1fae5;
  color: #10b981;
}

.processing-step.completed .step-icon::after {
  background: #10b981;
}

.processing-step.error .step-icon {
  background: #fee2e2;
  color: #ef4444;
}

.step-text {
  text-align: center;
}

.step-label {
  color: #9ca3af;
  font-size: 0.9rem;
  display: block;
  line-height: 1.3;
}

.processing-step.active .step-label {
  color: #1a1a2e;
  font-weight: 500;
}

.processing-step.completed .step-label {
  color: #10b981;
}

.processing-step.error .step-label {
  color: #ef4444;
}

.step-status {
  display: none;
}

/* Progress bar */
.processing-progress {
  background: #f5f5f5;
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-bar-container {
  height: 100%;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f5a623, #fbbf24);
  border-radius: 100px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 8px;
}

/* Tips Section */
.processing-tips {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid #fef08a;
  margin: 0 -8px;
  width: calc(100% + 16px);
}
.tips-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.tips-header i {
  color: #eab308;
  font-size: 0.9rem;
}

.tips-header span {
  color: #a16207;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tip-content {
  color: #713f12;
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tip-content.fade-out {
  animation: tipFadeOut 0.3s ease forwards;
}

.tip-content.fade-in {
  animation: tipFadeIn 0.3s ease forwards;
}

@keyframes tipFadeOut {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Error state */
.processing-overlay.has-error .loader-circle::after {
  border-top-color: #ef4444;
}

.processing-overlay.has-error .loader-icon {
  color: #ef4444;
}

/* Mobile */
@media (max-width: 480px) {
  .processing-content {
    padding: 28px 24px;
    margin: 16px;
  }
  
  .loader-circle {
    width: 60px;
    height: 60px;
  }
  
  .loader-icon {
    font-size: 1.25rem;
  }
  
  .processing-title {
    font-size: 1.15rem;
  }
  
  .processing-steps {
    gap: 4px;
  }
  
  .step-icon {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
  
  .step-icon::after {
    width: 12px;
    right: -16px;
  }
  
  .step-label {
    font-size: 0.7rem;
  }
}

/* ========== Re-record Suggestion Popup ========== */
.rerecord-suggestion-popup {
  max-width: 400px;
}

.rerecord-suggestion-popup .confirm-popup-header {
  flex-direction: column;
  gap: 16px;
}

.rerecord-score-circle {
  width: 100px;
  height: 100px;
  position: relative;
  margin: 0 auto;
}

.rerecord-score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.rerecord-score-circle .score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ef4444;
}

.rerecord-suggestion-popup h3 {
  color: #1f2937;
  font-size: 1.25rem;
  margin: 0;
}

.rerecord-intro {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.rerecord-reasons {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rerecord-reasons li {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: left;
}

.rerecord-encourage {
  color: #059669;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  padding: 12px;
  background: #d1fae5;
  border-radius: 8px;
}

.confirm-popup-btn.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.confirm-popup-btn.warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.confirm-popup-overlay.active {
  animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* ========== FIX: Connect Header Bars with Content Boxes ========== */
/* Make gradient headers connect to content below - no gap, rounded top only */
.inline-grading-result > div[style*="linear-gradient"] {
  border-radius: 12px 12px 0 0 !important;
  margin-bottom: 0 !important;
  padding: 12px 16px !important;
}

/* Make content boxes connect to headers above - no gap, rounded bottom only */
.inline-grading-result > div[style*="linear-gradient"] + div {
  border-radius: 0 0 12px 12px !important;
  margin-top: 0 !important;
  border-top: none !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

/* Add spacing BETWEEN complete sections (after content box, before next header) */
.inline-grading-result > div[style*="background"]:not([style*="linear-gradient"]) + div[style*="linear-gradient"] {
  margin-top: 20px !important;
}

/* First header should have no top margin */
.inline-grading-result > div[style*="linear-gradient"]:first-child {
  margin-top: 0 !important;
}

/* Ensure content boxes have proper padding */
.inline-grading-result > div[style*="background: #"]:not([style*="linear-gradient"]),
.inline-grading-result > div[style*="background:#"]:not([style*="linear-gradient"]) {
  padding: 16px 20px !important;
}

/* ========== SCORING RUBRIC - 3 COLUMN GRID LAYOUT ========== */
.grading-rubric-section > div:last-child {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 12px !important;
  padding: 16px !important;
}

.grading-rubric-section > div:last-child > div {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%) !important;
  border: 1px solid #fbbf24 !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.grading-rubric-section > div:last-child > div:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25) !important;
}

/* Score number styling */
.grading-rubric-section > div:last-child > div > div:first-child {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #92400e !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* Score value styling */
.grading-rubric-section > div:last-child > div span[style*="float"],
.grading-rubric-section > div:last-child > div [style*="color"][style*="059669"],
.grading-rubric-section > div:last-child > div [style*="color"][style*="dc2626"],
.grading-rubric-section > div:last-child > div [style*="color"][style*="f59e0b"] {
  font-size: 18px !important;
  font-weight: 800 !important;
}

/* Explanation text */
.grading-rubric-section > div:last-child > div > div:last-child {
  font-size: 12px !important;
  color: #78716c !important;
  line-height: 1.4 !important;
  margin-top: 4px !important;
}

/* Responsive: 2 columns on tablet */
@media (max-width: 992px) {
  .grading-rubric-section > div:last-child {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Responsive: 1 column on mobile */
@media (max-width: 600px) {
  .grading-rubric-section > div:last-child {
    grid-template-columns: 1fr !important;
  }
}


/* ========== SCORING GRID - 3 COLUMNS ========== */
.inline-grading-result .scoring-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 14px !important;
}

.inline-grading-result .scoring-grid > div {
  padding: 16px !important;
  border-radius: 12px !important;
}

/* Bigger font for score title */
.inline-grading-result .scoring-grid > div > div:first-child span:first-child {
  font-size: 15px !important;
  font-weight: 700 !important;
}

/* Bigger font for score number */
.inline-grading-result .scoring-grid > div > div:first-child span:last-child {
  font-size: 18px !important;
  font-weight: 800 !important;
}

/* Bigger font for comment */
.inline-grading-result .scoring-grid > div > div:last-child {
  font-size: 13px !important;
  line-height: 1.5 !important;
  margin-top: 8px !important;
}

/* Average score card - bigger text */
.inline-grading-result .scoring-grid > div[style*="linear-gradient"] {
  padding: 18px !important;
}

.inline-grading-result .scoring-grid > div[style*="linear-gradient"] > div:first-child {
  font-size: 14px !important;
}

.inline-grading-result .scoring-grid > div[style*="linear-gradient"] > div:last-child {
  font-size: 28px !important;
}

/* Responsive: 2 columns on tablet */
@media (max-width: 900px) {
  .inline-grading-result .scoring-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Responsive: 1 column on mobile */
@media (max-width: 600px) {
  .inline-grading-result .scoring-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Grader name badge */
.grader-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  margin-right: 10px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.grader-name i {
  font-size: 0.8rem;
}

.grading-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Time Added Indicator - subtle display */
.time-added-indicator {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-left: 4px;
  font-weight: 400;
}

/* R2 URL Badge */
.r2-url-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #3b82f6;
  color: white;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.r2-url-badge:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.r2-url-badge i {
  font-size: 11px;
}

/* Zalo Sent Badge */
.zalo-sent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: auto;
}

.zalo-sent-badge i {
  font-size: 0.75rem;
}


/* ========== COMPACT MODE STYLES ========== */

/* Compact Toggle Button */
.compact-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: auto;
}

.compact-toggle-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.compact-toggle-btn.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-color: #6366f1;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.compact-toggle-btn.active:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.compact-toggle-btn i {
  font-size: 0.9rem;
}

/* Compact Cards Grid */
.compact-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 4px;
}

/* Individual Compact Card */
.compact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.compact-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #c7d2fe;
}

.compact-card.graded {
  border: 1px solid #10b981;
  background: linear-gradient(to right, rgba(16, 185, 129, 0.05), white);
}

.compact-card.ungraded {
  border: 1px solid #f59e0b;
  background: linear-gradient(to right, rgba(245, 158, 11, 0.05), white);
}
/* Compact Card Avatar */
.compact-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.compact-avatar-initials {
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
}

/* Compact Card Info */
.compact-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compact-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-card-topic {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact Card Meta */
.compact-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.compact-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.compact-card-status.graded {
  background: #dcfce7;
  color: #16a34a;
}

.compact-card-status.ungraded {
  background: #fef3c7;
  color: #d97706;
}

.compact-card-time,
.compact-card-duration {
  font-size: 0.72rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-card-time i,
.compact-card-duration i {
  font-size: 0.65rem;
}

/* Highlight animation for expanded card */
.submission-card.highlight-card {
  animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
  50% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}


/* Expanded single card container */
.expanded-single-card-wrapper {
  position: relative;
}

/* Close button integrated into card */
.close-expanded-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-expanded-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
  transform: scale(1.1);
}

/* Back to list button */
.back-to-compact-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.back-to-compact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.back-to-compact-btn i {
  font-size: 0.85rem;
}

/* Enhanced expanded card header */
.expanded-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  border-radius: 16px 16px 0 0;
  gap: 16px;
}

.expanded-card-student-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.expanded-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.expanded-card-avatar span {
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.expanded-card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.expanded-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.expanded-card-topic {
  font-size: 0.95rem;
  color: #6366f1;
  font-weight: 500;
}

.expanded-card-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.expanded-card-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #6b7280;
}

.expanded-card-meta-item i {
  font-size: 0.8rem;
  color: #9ca3af;
}

.expanded-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-right: 44px;
}

.expanded-card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.expanded-card-status-badge.graded {
  background: #dcfce7;
  color: #16a34a;
}

.expanded-card-status-badge.ungraded {
  background: #fef3c7;
  color: #d97706;
}

.expanded-card-action-buttons {
  display: flex;
  gap: 8px;
}

/* Mobile Responsive for Compact Mode */
@media (max-width: 768px) {
  .compact-toggle-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .compact-toggle-btn span {
    display: none;
  }
  
  .compact-cards-grid {
    grid-template-columns: 1fr;
  }
  
  .compact-card {
    padding: 12px;
  }
  
  .compact-card-avatar {
    width: 38px;
    height: 38px;
  }
  
  .compact-avatar-initials {
    font-size: 0.85rem;
  }
}


/* ========== Email Search Popup Styles ========== */
.email-search-popup {
  max-width: 500px;
  width: 90%;
}

.email-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.email-search-input:focus {
  outline: none;
  border-color: #6366f1;
}

.email-suggestions {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.email-suggestion-hint {
  padding: 16px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.email-suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.15s;
}

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

.email-suggestion-item:hover {
  background: #eef2ff;
}

.email-suggestion-item.selected {
  background: #6366f1;
  color: white;
}

.email-suggestion-item.selected .suggestion-count {
  background: rgba(255,255,255,0.2);
  color: white;
}

.suggestion-email {
  font-size: 14px;
  font-weight: 500;
}

.suggestion-count {
  font-size: 12px;
  background: #e5e7eb;
  padding: 4px 8px;
  border-radius: 12px;
  color: #6b7280;
}

/* Email Search Button - Redesigned for better visibility */
.email-search-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border: 2px solid #d97706 !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4) !important;
  color: white !important;
  margin-left: 0 !important;
}

.email-search-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5) !important;
  transform: translateY(-2px);
}

.email-search-btn i {
  font-size: 14px;
  color: white !important;
}

/* Active Email Filter Badge */
.active-email-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 8px 14px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 12px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  animation: slideIn 0.3s ease;
}

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

.filter-email-text {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-email-filter {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.clear-email-filter:hover {
  background: rgba(255,255,255,0.4);
}

.clear-email-filter i {
  font-size: 10px;
}


/* ========== Score Review Popup - Simple Design ========== */
.score-review-popup-simple {
  background: white;
  border-radius: 24px;
  width: 95%;
  max-width: 480px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  animation: scorePopupIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  position: relative;
}

@keyframes scorePopupIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.score-review-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  z-index: 10;
}

.score-review-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Header */
.score-review-header-simple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
}

.score-review-header-simple .score-review-icon {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.score-review-header-text h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.score-review-header-text p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

/* Body */
.score-review-body-simple {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

/* Total Score Card */
.score-review-total-simple {
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border: 2px solid;
}

.score-total-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.total-emoji-simple {
  font-size: 36px;
}

.total-info {
  display: flex;
  flex-direction: column;
}

.total-label-simple {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.total-message-simple {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-top: 2px;
}

.score-total-right {
  font-size: 32px;
  font-weight: 800;
  color: white;
  padding: 12px 24px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Section Title */
.score-review-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-review-section-title i {
  color: #8b5cf6;
  font-size: 14px;
}

/* Score Items */
.score-review-items-simple {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid;
  transition: all 0.2s ease;
}

.score-review-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.score-review-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.score-review-number {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.score-review-label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-review-value {
  font-size: 13px;
  font-weight: 700;
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  min-width: 55px;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Footer */
.score-review-footer-simple {
  display: flex;
  gap: 12px;
  padding: 18px 20px;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
}

.score-review-btn-simple {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-review-btn-simple.cancel {
  background: white;
  color: #64748b;
  border: 2px solid #e2e8f0;
}

.score-review-btn-simple.cancel:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.score-review-btn-simple.confirm {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.score-review-btn-simple.confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
}

/* Scrollbar */
.score-review-body-simple::-webkit-scrollbar {
  width: 6px;
}

.score-review-body-simple::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.score-review-body-simple::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Mobile */
@media (max-width: 500px) {
  .score-review-popup-simple {
    max-width: 95%;
  }
  
  .score-total-right {
    font-size: 26px;
    padding: 10px 18px;
  }
  
  .total-emoji-simple {
    font-size: 30px;
  }
}

/* --------- Floating Format Toolbar (shows above selected text) --------- */
#floatingFormatToolbar {
  position: absolute;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 8px 10px;
  max-width: calc(100vw - 16px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  z-index: 100000;
}

#floatingFormatToolbar .fft-row {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

#floatingFormatToolbar .fft-row > button,
#floatingFormatToolbar .line-spacing-btn,
#floatingFormatToolbar select {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  color: #4b5563;
  font-size: 0.95rem;
  flex-shrink: 0;
}

#floatingFormatToolbar .fft-row > button:hover,
#floatingFormatToolbar .line-spacing-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

#floatingFormatToolbar .fft-sep {
  width: 1px;
  height: 20px;
  background: #d1d5db;
  margin: 0 4px;
  flex-shrink: 0;
}

#floatingFormatToolbar .fft-label {
  color: #9ca3af;
  font-size: 0.85rem;
  padding: 0 6px 0 2px;
  flex-shrink: 0;
}

#floatingFormatToolbar .fft-row > button.fft-dot {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

#floatingFormatToolbar .fft-row > button.fft-dot:hover {
  transform: scale(1.2);
  border-color: #6366f1;
}

/* Hide the old fixed toolbar above the main editor (the floating toolbar replaces it) */
.rich-editor-container > .toolbar {
  display: none;
}

/* Nicer look for structured content pasted from Claude (code, quotes, tables, headings) */
.editor-content pre {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Courier New', monospace;
  font-size: 0.9em;
}

.editor-content code {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Courier New', monospace;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.editor-content pre code {
  background: transparent;
  padding: 0;
}

.editor-content blockquote {
  border-left: 3px solid #d1d5db;
  margin: 6px 0;
  padding: 4px 12px;
  color: #4b5563;
}

.editor-content table {
  border-collapse: collapse;
  margin: 8px 0;
  max-width: 100%;
}

.editor-content th,
.editor-content td {
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  text-align: left;
}

.editor-content th {
  background: #f9fafb;
}

.editor-content h1,
.editor-content h2,
.editor-content h3,
.editor-content h4 {
  margin: 0.6em 0 0.3em;
  line-height: 1.3;
}

/* ================================================================
   Compose layout (title + levels beside editor) + level dropdown
   Added 2026-07-18
   ================================================================ */
.compose-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.compose-left {
  min-width: 0;
}

.compose-right {
  min-width: 0;
}

.compose-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.compose-label i {
  color: var(--primary);
  font-size: 0.8rem;
}

.compose-left .level-selection-section {
  margin-bottom: 0;
}

.compose-right .rich-editor-container {
  margin-bottom: 0;
}

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

/* ---------- Level dropdown ---------- */
.lvl-dropdown {
  position: relative;
}

.lvl-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 8px 38px 8px 10px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lvl-field:hover {
  border-color: #c7cbf5;
}

.lvl-dropdown.open .lvl-field {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.lvl-caret {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.85rem;
  transition: transform 0.2s;
}

.lvl-dropdown.open .lvl-caret {
  transform: translateY(-50%) rotate(180deg);
}

.lvl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  max-height: 112px;
  overflow-y: auto;
}

.lvl-placeholder {
  color: #9ca3af;
  font-size: 0.95rem;
  padding-left: 4px;
}

.lvl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid;
  border-radius: 8px;
  padding: 3px 8px;
  background: #fff;
}

.lvl-chip-x {
  cursor: pointer;
  opacity: 0.65;
  font-size: 0.75rem;
}

.lvl-chip-x:hover {
  opacity: 1;
}

.lvl-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  z-index: 60;
  overflow: hidden;
}

.lvl-panel.open {
  display: block;
}

.lvl-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f4;
}

.lvl-search i {
  color: #9ca3af;
  font-size: 0.85rem;
}

.lvl-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.92rem;
  background: transparent;
  color: #1f2937;
  font-family: inherit;
}

.lvl-panel #classOptionsContainer {
  display: block;
  max-height: 290px;
  overflow-y: auto;
  padding: 0;
}

.lvl-panel #classOptionsContainer::-webkit-scrollbar {
  width: 6px;
}

.lvl-panel #classOptionsContainer::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

.lvl-group {
  border-bottom: 1px solid #f1f2f6;
}

.lvl-group:last-child {
  border-bottom: none;
}

.lvl-group-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.lvl-group-header:hover {
  background: #f8f9fc;
}

.lvl-gcheck {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  transition: all 0.15s;
}

.lvl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.lvl-gname {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lvl-gbadge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
  background: #f3f4f6;
  color: #6b7280;
}

.lvl-gchev {
  font-size: 0.72rem;
  color: #9ca3af;
  transition: transform 0.18s;
}

.lvl-group.open .lvl-gchev,
.lvl-group.search-open .lvl-gchev {
  transform: rotate(90deg);
}

.lvl-group-body {
  display: none;
  padding: 2px 0 8px;
}

.lvl-group.open .lvl-group-body,
.lvl-group.search-open .lvl-group-body {
  display: block;
}

.lvl-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 42px;
  cursor: pointer;
  transition: background 0.12s;
}

.lvl-item:hover {
  background: #f8f9fc;
}

.lvl-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lvl-item .lvl-check {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.lvl-item .lvl-check i {
  font-size: 0.62rem;
  color: #fff;
  opacity: 0;
}

.lvl-item input:checked ~ .lvl-check {
  background: var(--gc, #6366f1);
  border-color: var(--gc, #6366f1);
}

.lvl-item input:checked ~ .lvl-check i {
  opacity: 1;
}

.lvl-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #4b5563;
}

.lvl-item input:checked ~ .lvl-item-name {
  color: #111827;
  font-weight: 600;
}

.lvl-hidden {
  display: none !important;
}

.lvl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid #eef0f4;
  background: #fafbfc;
}

.lvl-footer-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
}

.lvl-footer-btns {
  display: flex;
  gap: 8px;
}

.lvl-footer-btns button {
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

#lvlClearBtn {
  background: #fff;
  color: #4b5563;
  border: 1px solid var(--border);
}

#lvlClearBtn:hover {
  background: #f3f4f6;
}

#lvlApplyBtn {
  background: #111827;
  color: #fff;
}

#lvlApplyBtn:hover {
  background: #1f2937;
}

/* ================================================================
   Compose left: settings chips + full-width publish button (option 3)
   Added 2026-07-18 (evening)
   ================================================================ */
.compose-left .send-wrapper {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  padding-top: 14px;
}

.compose-chips-row {
  display: flex;
  gap: 8px;
}

.compose-chips-row .option-badge {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--border);
  color: #64748b;
}

.compose-chips-row .option-badge i {
  color: #94a3b8;
}

.compose-chips-row .time-badge input {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: #334155;
}

.compose-chips-row .time-badge input:focus {
  border-color: var(--primary);
}

.compose-chips-row .mini-slider {
  background: #cbd5e1;
}

.compose-chips-row .mini-toggle input:checked + .mini-slider {
  background: #22c55e;
}

.compose-chips-row .visibility-badge.is-public {
  background: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}

.compose-chips-row .visibility-badge.is-public i {
  color: #22c55e;
}

.compose-left .send-wrapper .send-btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
}

.compose-left .send-wrapper .send-btn:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.compose-left .send-wrapper .send-btn:active {
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.compose-left .send-wrapper .send-btn:disabled {
  background: var(--text-light);
  box-shadow: none;
}

.compose-left .send-wrapper .cancel-edit-btn {
  width: 100%;
  justify-content: center;
  border-radius: 999px;
}


/* ========== Copy Submission URL button (deep link to submissions page) ========== */
.grading-action-btn.copy-submission-url-btn {
  background: #ede9fe;
  color: #7c3aed;
  padding: 8px 10px;
}

.grading-action-btn.copy-submission-url-btn:hover {
  background: #7c3aed;
  color: #ffffff;
}

.compact-copy-url-btn {
  border: none;
  background: #ede9fe;
  color: #7c3aed;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.compact-copy-url-btn:hover {
  background: #7c3aed;
  color: #ffffff;
}


/* ========== Xem lai - instant AI feedback layout (gfb = grammar feedback) ========== */
.transcript-content:has(.grammar-feedback-content) {
  background: #fffefb;
  border: 1px solid #fde68a;
}

.gfb-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #92400e;
  background: linear-gradient(90deg, #fef3c7, #fffbeb);
  border-left: 4px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 14px 0 8px;
}

.gfb-heading:first-child {
  margin-top: 4px;
}

.gfb-heading i {
  color: #d97706;
  font-size: 0.95rem;
}

.gfb-text {
  margin: 6px 2px;
}

.gfb-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 7px 2px 7px 8px;
}

.gfb-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #7c3aed;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.gfb-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  margin-top: 8px;
}

.gfb-item-text {
  flex: 1;
}

.grammar-feedback-content strong {
  color: #b45309;
}

.grammar-feedback-content em {
  color: #4f46e5;
}

/* ===== OPTION 4 HEADER REDESIGN (hero record button) — added 2026-07-19 ===== */
/* Buttons move left (hero), mic + lock become quiet chips on the right. CSS-only. */

.recording-header-single-row .header-controls-right { order: 1; }
.recording-header-single-row .header-controls-left { order: 2; }

.recording-header-single-row .header-record-btn,
.recording-header-single-row .header-submit-btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(2, 44, 83, 0.25);
}

.recording-header-single-row .header-record-btn { background: #dc2626; }
.recording-header-single-row .header-record-btn:hover { background: #b91c1c; box-shadow: 0 4px 12px rgba(2, 44, 83, 0.3); }
.recording-header-single-row .header-record-btn.stop { background: #475569; }
.recording-header-single-row .header-record-btn.stop:hover { background: #334155; }
.recording-header-single-row .header-record-btn.again { background: #d97706; }
.recording-header-single-row .header-record-btn.again:hover { background: #b45309; }
.recording-header-single-row .header-record-btn.grade { background: #7c3aed; }
.recording-header-single-row .header-record-btn.grade:hover { background: #6d28d9; }

.recording-header-single-row .header-submit-btn {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  padding: 8.5px 15px;
}
.recording-header-single-row .header-submit-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: #ffffff;
  box-shadow: none;
}
.recording-header-single-row .header-submit-btn:disabled { opacity: 0.55; }

.recording-header-single-row .header-mic-select {
  background-color: rgba(255, 255, 255, 0.18);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='16' viewBox='0 0 14 16'%3E%3Crect x='4.5' y='0.8' width='5' height='9' rx='2.5' fill='white'/%3E%3Cpath d='M2.5 7.5a4.5 4.5 0 0 0 9 0' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M7 12v2.2' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"), url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: left 9px center, right 10px center;
  color: #ffffff;
  min-width: 0;
  width: 136px;
  padding: 8px 26px 8px 30px;
  font-size: 12.5px;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recording-header-single-row .header-mic-select:hover { background-color: rgba(255, 255, 255, 0.28); transform: none; }
.recording-header-single-row .header-mic-select option { color: #1f2937; background: #ffffff; }

.recording-header-single-row .header-visibility-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: none;
  padding: 7px 10px;
}
.recording-header-single-row .header-visibility-badge:hover { background: rgba(255, 255, 255, 0.28); transform: none; }
.recording-header-single-row .header-mini-slider { background-color: rgba(255, 255, 255, 0.45); }
.recording-header-single-row .header-mini-toggle input:checked + .header-mini-slider { background-color: #22c55e; }

.recording-header-single-row .header-time-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: none;
}
.recording-header-single-row .header-adjust-btn { background: rgba(255, 255, 255, 0.85); }
/* ===== END OPTION 4 HEADER REDESIGN ===== */


/* ========== Extra Topics (post multiple topics at once) ========== */
.add-topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 11px 20px;
  background: #eef2ff;
  color: #4f46e5;
  border: 2px dashed #a5b4fc;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-topic-btn:hover {
  background: #e0e7ff;
  border-color: #6366f1;
  transform: translateY(-1px);
}

.extra-topic-block {
  margin-top: 16px;
  padding: 16px;
  background: #fafbff;
  border: 1px solid #e0e7ff;
  border-radius: 12px;
}

.extra-topic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.extra-topic-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4f46e5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.remove-topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-topic-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.extra-topic-title {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 10px;
  background: white;
  box-sizing: border-box;
}

.extra-topic-title:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.extra-topic-editor {
  min-height: 140px;
  max-height: 400px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  font-size: 1rem;
  line-height: 1.6;
  outline: none;
}

.extra-topic-editor:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.extra-topic-editor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}


/* ===== Sidebar rail (main page) — mockup option 4 ===== */
.side-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 88px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 6px;
  z-index: 900;
  overflow-y: auto;
}

.side-rail-brand {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.side-rail-item {
  width: 66px;
  padding: 9px 0 7px;
  border-radius: 12px;
  border: none;
  background: none;
  color: var(--text-medium);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  flex: 0 0 auto;
}

.side-rail-item i {
  font-size: 1.15rem;
}

.side-rail-item:hover {
  background: #eef2ff;
  color: var(--primary-dark);
}

.side-rail-item.active {
  background: #e0e7ff;
  color: var(--primary-dark);
}

.side-rail-divider {
  width: 52px;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
  flex: 0 0 auto;
}

.side-rail-spacer {
  flex: 1 1 auto;
}

.side-rail-logout {
  color: #dc2626;
}

.side-rail-logout:hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* The sidebar replaces the old floating buttons on the main page */
#mainApp .submissions-float-btn,
#mainApp .prompt-float-btn {
  display: none !important;
}

body:has(#mainApp[style*="display: block"]) .logout-icon {
  display: none !important;
}

/* Make room for the rail */
#mainApp {
  padding-left: 108px;
}

@media (max-width: 640px) {
  .side-rail {
    width: 64px;
  }

  .side-rail-item {
    width: 56px;
    font-size: 0.6rem;
  }

  #mainApp {
    padding-left: 72px;
  }
}

/* Purple filter tag (Làm lại) on the submissions page */
.filter-tag.tag-purple {
  border-color: #c7d2fe;
  color: #4f46e5;
  background: #eef2ff;
}

.filter-tag.tag-purple .tag-count {
  background: #e0e7ff;
  color: #4f46e5;
}

.filter-tag.tag-purple:hover {
  background: #e0e7ff;
}

.filter-tag.tag-purple.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
}

.filter-tag.tag-purple.active .tag-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* ========== Compare (So sánh) — badge + popup ========== */
.cmp-icon-wrap {
  position: relative;
  display: inline-flex;
}

.cmp-badge {
  position: absolute;
  top: -7px;
  right: -11px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--card-bg);
}

.cmp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: cmpFadeIn 0.15s ease;
}

@keyframes cmpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cmp-modal {
  background: #fff;
  border-radius: 16px;
  width: 440px;
  max-width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.cmp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e7eb;
}

.cmp-title {
  font-weight: 700;
  color: #1f2937;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmp-title i {
  color: #6366f1;
}

.cmp-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.cmp-close:hover {
  background: #f3f4f6;
  color: #4b5563;
}

.cmp-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
}

.cmp-loading,
.cmp-error {
  color: #6b7280;
  font-size: 0.9rem;
  text-align: center;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cmp-error {
  color: #b91c1c;
}

.cmp-note {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 12px;
}

.cmp-block {
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 10px;
}

.cmp-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.cmp-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.cmp-okblock {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.cmp-block-title {
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
}

.cmp-danger .cmp-block-title {
  color: #b91c1c;
}

.cmp-warning .cmp-block-title {
  color: #b45309;
}

.cmp-okblock .cmp-block-title {
  color: #15803d;
  margin-bottom: 2px;
}

.cmp-block-text {
  font-size: 0.86rem;
  color: #991b1b;
  font-weight: 600;
  line-height: 1.5;
}

.cmp-block-sub {
  font-size: 0.76rem;
  color: #6b7280;
  margin-top: 6px;
}

.cmp-behind-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 3px 0;
  color: #92400e;
}

.cmp-behind-name {
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmp-behind-count {
  font-variant-numeric: tabular-nums;
}

.cmp-behind-need {
  background: #f59e0b;
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.cmp-okline {
  font-size: 0.8rem;
  color: #15803d;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 2px 0 12px;
  line-height: 1.5;
}

.cmp-okline i {
  margin-top: 2px;
}

.cmp-toggle-all {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px dashed #c7d2fe;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.cmp-toggle-all:hover {
  background: #e0e7ff;
}

.cmp-toggle-all .cmp-chev {
  transition: transform 0.2s;
}

.cmp-toggle-all.open .cmp-chev {
  transform: rotate(180deg);
}

.cmp-all {
  margin-top: 12px;
}

.cmp-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 0.83rem;
}

.cmp-bar-name {
  flex: 0 0 108px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-bar-track {
  flex: 1;
  height: 9px;
  background: #f3f4f6;
  border-radius: 5px;
  overflow: hidden;
}

.cmp-bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: #6366f1;
}

.cmp-bar-row.is-empty .cmp-bar-fill {
  background: #ef4444;
}

.cmp-bar-row.is-behind .cmp-bar-fill {
  background: #f59e0b;
}

.cmp-bar-row.is-ok .cmp-bar-fill {
  background: #10b981;
}

.cmp-bar-count {
  flex: 0 0 28px;
  text-align: right;
  font-weight: 700;
  color: #4b5563;
  font-variant-numeric: tabular-nums;
}

.cmp-bar-row.is-empty .cmp-bar-count {
  color: #ef4444;
}

/* ===========================================================
   TEST APP ADDITIONS
   Everything above this line is the Speaking app's stylesheet,
   unchanged. Below are the only two components Speaking has no
   equivalent for: the sections builder (teacher) and the paste
   board (student). Both follow the same idiom as the rules above.
   =========================================================== */

/* ---------- sections builder (sits where "Thêm chủ đề" is) ---------- */
.sec-wrap { margin-top: 18px; }

.sec-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.sec-head .compose-label { margin: 0; }
.sec-head .count-badge { margin-left: 2px; }

.sec-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  border: 2px solid #e5e7eb; border-radius: 12px; background: #fafbfc;
  transition: all .2s ease;
}
.sec-row:focus-within { border-color: #818cf8; background: #fff; }

.sec-num {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  display: grid; place-items: center;
  background: #eef2ff; color: #4f46e5;
  font-size: .74rem; font-weight: 700;
}
.sec-row input.sec-label {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-family: inherit; font-size: .94rem; font-weight: 500;
  color: #1e293b; outline: none; padding: 0;
}
.sec-cap {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; color: #6b7280; white-space: nowrap;
}
.sec-cap select {
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 4px 6px;
  font-family: inherit; font-size: .8rem; background: #fff; color: #374151;
}
.sec-del {
  all: unset; width: 28px; height: 28px; flex: none; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; color: #9ca3af;
}
.sec-del:hover { background: #fee2e2; color: #dc2626; }

.sec-hint {
  padding: 13px 14px; border: 2px dashed #e5e7eb; border-radius: 12px;
  background: #f8fafc; color: #6b7280; font-size: .85rem;
  text-align: center; line-height: 1.55; margin-bottom: 8px;
}

/* ---------- paste board (student) ---------- */
.paste-section { margin-bottom: 18px; }

.paste-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.paste-section-name {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem; font-weight: 700; color: #1e293b;
}
.paste-count {
  font-size: .75rem; color: #6b7280; font-variant-numeric: tabular-nums;
}

.paste-drop {
  border: 2.5px dashed #e5e7eb; border-radius: 14px; background: #fafbfc;
  padding: 20px 16px; text-align: center; cursor: pointer;
  transition: all .2s ease;
}
.paste-drop:hover, .paste-drop.armed { border-color: #6366f1; background: #eef2ff; }
.paste-drop.full { opacity: .5; cursor: not-allowed; border-style: solid; }
.paste-drop i { font-size: 1.5rem; color: #6366f1; display: block; margin-bottom: 8px; }
.paste-drop-title { font-size: .88rem; font-weight: 600; color: #374151; }
.paste-drop-hint { font-size: .76rem; color: #6b7280; margin-top: 3px; }

.shot-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }

.shot {
  position: relative; width: 92px; height: 92px; flex: none;
  border: 1.5px solid #e5e7eb; border-radius: 11px;
  overflow: hidden; background: #f1f5f9;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.shot-del {
  all: unset; position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(15,23,42,.72); color: #fff; font-size: .68rem;
}
.shot-del:hover { background: #dc2626; }
.shot-progress {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.86); color: #6366f1; font-size: .8rem;
}
.shot.failed { border-color: #fca5a5; background: #fef2f2; }
.shot-retry {
  all: unset; position: absolute; inset: 0; display: grid; place-items: center;
  cursor: pointer; color: #dc2626; font-size: .7rem; font-weight: 700;
  text-align: center; line-height: 1.3;
}

.shot-viewer {
  position: fixed; inset: 0; z-index: 3000; background: rgba(15,23,42,.9);
  display: grid; place-items: center; padding: 24px; cursor: zoom-out;
}
.shot-viewer img { max-width: 100%; max-height: 92vh; border-radius: 10px; }

/* the short note */
.note-wrap { margin-top: 6px; }
.note-wrap label {
  display: block; font-size: .84rem; font-weight: 700;
  color: #374151; margin-bottom: 7px;
}
.note-wrap textarea {
  width: 100%; min-height: 84px; padding: 12px 14px; box-sizing: border-box;
  border: 2px solid #e5e7eb; border-radius: 12px; background: #fafbfc;
  font-family: inherit; font-size: .93rem; line-height: 1.6;
  resize: vertical; outline: none;
}
.note-wrap textarea:focus {
  border-color: #6366f1; background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.note-read {
  padding: 12px 14px; background: #f8fafc; border-radius: 12px;
  font-size: .93rem; line-height: 1.6; white-space: pre-wrap; color: #334155;
}
.note-counter { text-align: right; font-size: .72rem; color: #94a3b8; margin-top: 4px; }

/* the mark, once a teacher has given one */
.mark-box {
  margin-top: 16px; padding: 16px 18px;
  border: 1px solid #e2e8f0; border-radius: 14px; background: #f8fafc;
}
.mark-score {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 1.6rem; font-weight: 800; color: #4f46e5;
}
.mark-score small { font-size: .85rem; font-weight: 600; color: #64748b; }
.mark-comment { margin-top: 10px; font-size: .93rem; line-height: 1.7; color: #334155; }
.mark-pending {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: #fef3c7; color: #b45309; font-size: .84rem; font-weight: 600;
}
.mark-hint { font-size: .8rem; color: #6b7280; margin: 8px 0 0; }

/* ========================================
   SKILLS PICKER            (revision 1d)
   ======================================== */

.skill-selection-section {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.skill-pill {
  border: 1.5px solid var(--border, #e5e7eb);
  background: #f9fafb;
  color: var(--text-medium, #4b5563);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.skill-pill:hover {
  border-color: #a5b4fc;
  background: #eef2ff;
  color: #4f46e5;
}

.skill-pill.is-on {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.skill-pill.is-on:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.skill-pill i {
  font-size: 0.72rem;
  margin-right: 2px;
}

.skill-add {
  border: 1.5px dashed #c7d2fe;
  background: #fff;
  color: #4f46e5;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.skill-add:hover {
  background: #eef2ff;
  border-style: solid;
}

.skill-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.skill-empty {
  display: block;
  width: 100%;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-light, #9ca3af);
}

/* ========================================
   TEST LIST CARD           (revision 1e)
   Labelled rows so the card is scannable.
   ======================================== */

/* the card is taller now, so line the columns up at the top
   instead of centring them */
.link-item {
  align-items: flex-start;
}

.tk-row {
  display: flex;
  gap: 10px;
  margin-top: 9px;
}

.tk-label {
  flex: 0 0 92px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  white-space: nowrap;
}

.tk-label i {
  font-size: 0.72rem;
}

.tk-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* teal -- deliberately not the indigo the level tags use */
.skill-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
}

.sec-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
}

.tk-none {
  font-size: 0.78rem;
  font-style: italic;
  color: #9ca3af;
}

@media (max-width: 640px) {
  .tk-row {
    flex-direction: column;
    gap: 4px;
  }

  .tk-label {
    flex: none;
    padding-top: 0;
  }
}

/* ========================================
   CARD ACTIONS             (revision 1f)

   Edit + trash moved from the top right to the bottom right, because
   the Xem / Copy Link buttons now sit in the top-right corner.

   The class is still named .item-actions-top -- it is written by
   script.js, and renaming it there would be churn for no gain.
   ======================================== */

.item-actions-top {
  top: auto;
  bottom: 10px;
  right: 12px;
}

/* ===========================================================
   REVISION 1e — a part per skill, each taking pictures + writing
   Appended, so every rule above is untouched.
   =========================================================== */

/* ---------- teacher side: the skill tag on a built row ---------- */
.sec-row.is-skill {
  border-color: #ddd6fe;
  background: linear-gradient(180deg, #faf9ff 0%, #f5f3ff 100%);
}
.sec-row.is-skill:focus-within { border-color: #818cf8; background: #fff; }

.sec-skill-tag {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 3px 9px; border-radius: 999px;
  background: #ede9fe; color: #6d28d9;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; white-space: nowrap;
}
.sec-skill-tag i { font-size: .74rem; }

/* ---------- student side: one card per part ---------- */
.parts-lead {
  margin: 0 0 14px; padding: 10px 14px;
  border-radius: 11px; background: #f1f5f9;
  color: #475569; font-size: .84rem; line-height: 1.55;
}
.parts-lead b { color: #1e293b; }

/* the whole part becomes a card, so two skills never blur together */
#answerBody .paste-section {
  padding: 15px 16px 16px;
  border: 2px solid #eef0f4; border-radius: 16px;
  background: #fff; transition: border-color .2s ease, box-shadow .2s ease;
}
#answerBody .paste-section + .paste-section { margin-top: 16px; }

/* the card holding the next Ctrl + V */
#answerBody .paste-section.is-armed {
  border-color: #c7d2fe;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .10);
}

#answerBody .paste-section-head {
  padding-bottom: 11px; margin-bottom: 13px;
  border-bottom: 1px solid #f1f5f9;
}
.ps-icon {
  font-size: .92rem; color: #6366f1;
  width: 18px; text-align: center;
}

/* the same writing, read back after the test is in */
.sec-note-read { margin-top: 12px; border: 1px solid #eef0f4; }

/* ---------- why the send button is still grey ---------- */
.submit-hint {
  display: none; margin: 9px 2px 0;
  font-size: .8rem; line-height: 1.5; color: #94a3b8; text-align: center;
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  #answerBody .paste-section { padding: 13px 13px 14px; border-radius: 14px; }
  .sec-skill-tag { font-size: .62rem; padding: 2px 7px; }
}

/* the part name is now shown, not typed -- it belongs to the skill */
.sec-label-text {
  flex: 1; min-width: 0;
  font-size: .94rem; font-weight: 600; color: #1e293b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sec-row:not(.is-skill) .sec-skill-tag { background: #f1f5f9; color: #64748b; }

/* ---------- the merged answer field: writing + links share a border ---------- */
.ans-group {
  margin-top: 13px;
  border: 2px solid #e5e7eb; border-radius: 12px;
  background: #fafbfc; overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.ans-group:focus-within {
  border-color: #6366f1; background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.ans-group textarea.ans-text {
  display: block; width: 100%; min-height: 74px; box-sizing: border-box;
  padding: 11px 13px; border: none; background: transparent;
  font-family: inherit; font-size: .92rem; line-height: 1.6;
  color: #1e293b; resize: vertical; outline: none;
}
.ans-group textarea.ans-text::placeholder { color: #b6bfcc; }

.ans-links {
  display: none; flex-wrap: wrap; gap: 6px;
  padding: 0 11px 10px;
}

.ans-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 6px 4px 10px; border-radius: 999px;
  background: #eef2ff; color: #4338ca;
  font-size: .76rem; line-height: 1.4;
}
.ans-chip > i { font-size: .7rem; flex: none; }
.ans-chip-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ans-chip.is-link { text-decoration: none; padding-right: 10px; }
.ans-chip.is-link:hover { background: #e0e7ff; }

.ans-chip-x {
  all: unset; width: 17px; height: 17px; flex: none; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  color: #6366f1; font-size: .66rem;
}
.ans-chip-x:hover { background: #c7d2fe; color: #3730a3; }

.ans-link-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 11px; border-top: 1px solid #eef0f4;
}
.ans-link-row > i { font-size: .8rem; color: #94a3b8; flex: none; }

input.ans-link-input {
  flex: 1; min-width: 0; border: none; background: transparent; padding: 2px 0;
  font-family: inherit; font-size: .86rem; color: #1e293b; outline: none;
}
input.ans-link-input::placeholder { color: #b6bfcc; }

.ans-link-add {
  all: unset; flex: none; cursor: pointer;
  padding: 4px 11px; border-radius: 999px;
  background: #eef2ff; color: #4f46e5;
  font-size: .76rem; font-weight: 600;
}
.ans-link-add:hover { background: #e0e7ff; }

.ans-meta {
  text-align: right; font-size: .72rem; color: #94a3b8; margin-top: 4px;
}

@media (max-width: 640px) {
  .ans-group textarea.ans-text { font-size: .9rem; }
  .ans-chip { font-size: .72rem; }
}

/* a link box holding something that is not a link */
.ans-link-row.is-bad { background: #fef2f2; border-top-color: #fecaca; }
.ans-link-row.is-bad > i { color: #dc2626; }
.ans-link-row.is-bad input.ans-link-input { color: #b91c1c; }
.ans-group:has(.ans-link-row.is-bad) { border-color: #fca5a5; }
.ans-group:has(.ans-link-row.is-bad):focus-within {
  border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

.ans-link-err {
  display: none; align-items: flex-start; gap: 6px;
  padding: 7px 11px 9px; background: #fef2f2;
  font-size: .76rem; line-height: 1.45; color: #b91c1c;
}
.ans-link-err > i { font-size: .74rem; margin-top: 2px; flex: none; }
