/* Modular CSS slice extracted from style.css (9331-10043) */
.class-mgmt-table th {
  background: #f8fafc;
  color: var(--text-secondary, #475569);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.class-mgmt-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  vertical-align: middle;
}
.class-mgmt-row {
  transition: background 0.15s ease;
}
.class-mgmt-row:hover {
  background: #f8fafc;
}
.class-mgmt-row.is-active-class {
  background: #f0fdf4;
}
.class-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.72rem;
  font-weight: 700;
}
.class-mgmt-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
}
.btn-class-action {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color, #cbd5e1);
  background: #fff;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.btn-class-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.btn-class-action.action-delete {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
}
.btn-class-action.action-delete:hover {
  background: #fee2e2;
  border-color: #f87171;
}
.btn-class-action.action-select {
  color: var(--primary, #4f46e5);
  border-color: #c7d2fe;
  background: #eef2ff;
}
.btn-class-action.action-select:hover {
  background: #e0e7ff;
}

/* ==========================================================================
   CUSTOM CONFIRM MODAL (Professional Commercial-Grade B2B Dialog)
   ========================================================================== */
#modal-custom-confirm {
  z-index: 100100 !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.65) !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#modal-custom-confirm.active {
  display: flex !important;
  animation: customConfirmFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes customConfirmFadeIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

#modal-custom-confirm .modal-content,
#modal-custom-confirm .custom-confirm-content {
  max-width: 460px !important;
  width: 92vw;
  background: #ffffff !important;
  border-radius: 20px !important;
  padding: 2rem 1.75rem 1.6rem !important;
  text-align: center;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
  border: 1px solid rgba(226, 232, 240, 0.9) !important;
  position: relative;
  overflow: hidden;
}

#modal-custom-confirm .custom-confirm-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  background: #eff6ff;
  border: 4px solid #dbeafe;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.12);
  transition: transform 0.2s ease;
}

#modal-custom-confirm.is-danger .custom-confirm-icon-wrap {
  background: #fef2f2 !important;
  border: 4px solid #fee2e2 !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.15) !important;
}

#modal-custom-confirm #custom-confirm-title {
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-bottom: 0.65rem !important;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

#modal-custom-confirm #custom-confirm-message {
  font-size: 0.925rem !important;
  color: #475569 !important;
  line-height: 1.6 !important;
  margin-bottom: 1.75rem !important;
  white-space: pre-line !important;
  text-align: center;
  word-break: break-word;
}

#modal-custom-confirm .custom-confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

#modal-custom-confirm #btn-custom-confirm-cancel {
  flex: 1;
  min-height: 44px;
  border-radius: 12px !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  color: #334155 !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  justify-content: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

#modal-custom-confirm #btn-custom-confirm-cancel:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

#modal-custom-confirm #btn-custom-confirm-ok {
  flex: 1.2;
  min-height: 44px;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  justify-content: center;
  border: none !important;
  transition: all 0.15s ease;
  cursor: pointer;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3) !important;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.42) !important;
  transform: translateY(-1px);
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3) !important;
}

#modal-custom-confirm #btn-custom-confirm-ok.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.42) !important;
  transform: translateY(-1px);
}

/* Inplace Auto-OCR Scanning Indicator */
@keyframes pulseScan {
  0% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.6; transform: scale(0.98); }
}
.ocr-scanning {
  animation: pulseScan 1.2s infinite ease-in-out;
}

/* ==========================================================================
   IMAGE FIT-TO-SCREEN & LIGHTBOX
   ========================================================================== */
.image-thumbnail-card img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  background: #0f172a;
}

#modal-image-lightbox.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.mvs-page-wrapper img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

/* ==========================================================================
   MULTI-VIEWPORT RESPONSIVE WORKSPACE STUDIO
   ========================================================================== */
@media (min-width: 1025px) {
  .workspace-modal {
    max-width: 1300px;
    width: 95vw;
    height: 90vh;
  }
  .workspace-body {
    display: grid;
    grid-template-columns: 60% 40%;
    height: calc(100% - 60px);
    overflow: hidden;
  }
  .viewer-pane {
    height: 100%;
    overflow: auto;
  }
  .grading-pane {
    height: 100%;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
  }
}

@media (max-width: 1024px) {
  .workspace-modal {
    width: 98vw;
    height: 95vh;
    max-height: 95vh;
  }
  .workspace-body {
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    overflow: hidden;
  }
  .viewer-pane {
    flex: 1;
    min-height: 40vh;
    max-height: 50vh;
  }
  .grading-pane {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 768px) {
  .workspace-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    padding: 0.75rem !important;
  }
}

/* ==========================================================================
   PRINT ENGINE OPTIMIZATIONS
   ========================================================================== */
@media print {
  .no-print,
  .sidebar,
  .app-header,
  .topbar-right,
  .modal-backdrop:not(.active-print) {
    display: none !important;
  }
}

/* ==========================================================================
   TEACHER SUBSCRIPTION & AI PAGE QUOTA DESIGN SYSTEM
   ========================================================================== */

/* --- Topbar Quota Pill --- */
.user-quota-capsule {
  display: inline-flex;
  align-items: center;
}

.btn-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-quota-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.btn-quota-pill.quota-ok {
  background: #f0fdf4;
  color: #166534;
  border: 1.5px solid #bbf7d0;
}

.btn-quota-pill.quota-ok:hover {
  background: #dcfce7;
  border-color: #86efac;
}

.btn-quota-pill.quota-low {
  background: #fffbeb;
  color: #b45309;
  border: 1.5px solid #fde68a;
  animation: quota-pulse-warn 2s infinite ease-in-out;
}

.btn-quota-pill.quota-low:hover {
  background: #fef3c7;
}

.btn-quota-pill.quota-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1.5px solid #fecaca;
  animation: quota-pulse-danger 1.5s infinite ease-in-out;
}

.btn-quota-pill.quota-danger:hover {
  background: #fee2e2;
}

@keyframes quota-pulse-warn {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  }
}

@keyframes quota-pulse-danger {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.2);
  }
}

/* --- Segmented Cycle Switcher --- */
.cycle-switcher-wrapper {
  display: inline-flex;
  background: #f1f5f9;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  gap: 0.25rem;
  max-width: 100%;
}

.cycle-switch-btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cycle-switch-btn:hover:not(.active) {
  color: #1e293b;
  background: rgba(255, 255, 255, 0.6);
}

.cycle-switch-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

/* --- Pricing Cards Grid --- */
.pricing-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.pricing-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.1);
}

.pricing-card.popular-glow {
  border-color: #6366f1 !important;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.25);
}

.pricing-card.popular-glow:hover {
  box-shadow: 0 16px 32px -4px rgba(99, 102, 241, 0.35);
}

.popular-badge {
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

/* --- Subscription Responsive Layout --- */
@media (max-width: 768px) {
  .cycle-switcher-wrapper {
    flex-direction: column;
    border-radius: var(--radius-md);
    width: 100%;
  }

  .cycle-switch-btn {
    width: 100%;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
  }

  .pricing-cards-grid {
    grid-template-columns: 1fr;
  }

  #modal-teacher-subscription .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .btn-quota-pill .quota-text {
    font-size: 0.75rem;
  }
}

/* --- School & Academic Year Management Responsive Layout --- */
.school-form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-form-grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.school-form-grid-school-top {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-form-grid-school-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.school-table-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.school-table-container table {
  min-width: 580px;
}

@media (max-width: 768px) {
  #modal-school-year-management .modal-content {
    padding: 1rem !important;
    width: 96vw !important;
    max-height: 94vh !important;
  }

  .school-form-grid-2col,
  .school-form-grid-3col,
  .school-form-grid-school-top,
  .school-form-grid-school-bottom {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .school-form-grid-3col > div {
    padding-top: 0 !important;
  }

  .btn-edit-school-year,
  .btn-delete-school-year {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* --- Admin Management Center Styling (Tone Sáng SaaS) --- */
#modal-admin-management .modal-content {
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.admin-tab-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.admin-tab-btn {
  font-weight: 700;
  transition: all var(--fast-transition, 0.2s ease);
  border-radius: var(--radius-sm, 6px);
  padding: 0.4rem 0.85rem;
}

.admin-tab-btn.btn-primary {
  background-color: var(--primary, #2563eb);
  color: #ffffff !important;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.2);
}

.admin-tab-btn.btn-outline {
  color: #475569 !important;
  border-color: #cbd5e1;
  background-color: #ffffff;
}

.admin-tab-btn.btn-outline:hover {
  background-color: #f1f5f9;
  color: #0f172a !important;
  border-color: #94a3b8;
}

@media (max-width: 768px) {
  #modal-admin-management .modal-content {
    width: 96vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    padding: 1rem !important;
  }

  .admin-tab-nav {
    gap: 0.35rem;
  }

  .admin-tab-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    flex: 1 1 auto;
    text-align: center;
  }
}

/* ==========================================================================
   EDIT SUBMISSION MODAL & PAGE MANAGEMENT STYLES
   ========================================================================== */
.submission-edit-gallery {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.sub-edit-thumb-card {
  position: relative;
  width: 90px;
  height: 120px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.sub-edit-thumb-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
}

.sub-edit-thumb-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background: #f1f5f9;
  cursor: pointer;
}

.sub-edit-thumb-footer {
  height: 30px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
}

.sub-edit-thumb-del {
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  transition: background 0.15s ease;
}

.sub-edit-thumb-del:hover {
  background: #ef4444;
  color: #ffffff;
}
