: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: 24px;
  box-shadow: 
    0 4px 6px rgba(102, 126, 234, 0.08),
    0 10px 40px rgba(102, 126, 234, 0.15);
  margin-bottom: 40px;
  overflow: hidden;
  border: none;
}

.topic-card-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 40%, #9f7aea 100%);
  padding: 28px 36px 32px;
  position: relative;
  overflow: hidden;
  border-radius: 24px 24px 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: 8px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.95);
  color: #667eea;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.topic-label i {
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px;
  border-radius: 50%;
}

.topic-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.6;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.15);
  max-width: 100%;
}

.topic-card-body {
  padding: 0;
  background: white;
}

.requirements-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
  font-size: 0.85rem;
  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: 28px 36px;
  background: white;
}

.topic-card-body p,
#writingContentDisplay p {
  font-size: 1.05rem;
  line-height: 1.9;
  color: #374151;
  margin: 0 0 1em 0;
}

.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: 0;
  list-style: none;
}

.topic-card-body li,
#writingContentDisplay li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  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: pre-wrap;
  text-align: justify;
}

.editor-content p {
  margin-top: 0;
}

.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;
}


/* ========== 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;
}