/* ============================================================
   Dashboard - Área do Aluno e Admin
   ============================================================ */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 0;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 500;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: var(--space-xl);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
}

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  padding: var(--space-md) var(--space-xl) var(--space-xs);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.7rem var(--space-xl);
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: white;
  border-left-color: var(--accent-light);
}

.sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: white;
  border-left-color: var(--accent-light);
}

.sidebar-link .icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: var(--space-md) var(--space-xl) var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
  cursor: pointer;
  background: none;
  border: none;
  margin-top: var(--space-sm);
  transition: var(--transition);
}

.sidebar-logout:hover { color: rgba(255,255,255,0.85); }

/* ---- Main Content ---- */
.dashboard-main {
  flex: 1;
  margin-left: 260px;
  background: var(--off-white);
  min-height: 100vh;
}

.dashboard-topbar {
  background: white;
  border-bottom: 1px solid var(--gray-100);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.dashboard-content {
  padding: var(--space-2xl);
  max-width: 1100px;
}

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.purple { background: var(--gray-100); }
.stat-icon.teal { background: rgba(78,205,196,0.12); }
.stat-icon.gold { background: rgba(201,168,76,0.12); }
.stat-icon.green { background: var(--success-light); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-family: var(--font-serif);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ---- Enrollment Cards ---- */
.enrollment-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-100);
  display: flex;
  transition: var(--transition);
}

.enrollment-card:hover { box-shadow: var(--shadow-md); }

.enrollment-thumb {
  width: 140px;
  min-height: 140px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
}

.enrollment-body {
  padding: var(--space-lg);
  flex: 1;
}

.enrollment-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--gray-900);
  margin-bottom: var(--space-xs);
  font-weight: 700;
}

.enrollment-meta {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: var(--space-md);
}

.enrollment-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: var(--space-xs);
}

.enrollment-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

/* ---- Table ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-100);
  background: var(--gray-50);
}

.data-table td {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-50);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--gray-50); }

/* Sidebar mobile toggle */
.sidebar-toggle-btn {
  display: none;
  position: fixed;
  bottom: var(--space-xl);
  left: var(--space-xl);
  z-index: 600;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.3rem;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ---- Module Accordion ---- */
.module-accordion {
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  background: white;
  overflow: hidden;
}

.module-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--gray-50);
  cursor: pointer;
  transition: var(--transition);
  gap: var(--space-md);
  user-select: none;
}

.module-accordion-header:hover { background: var(--gray-100); }

.module-accordion-header .module-title {
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.module-accordion-header .module-title .order-badge {
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.module-accordion-header .module-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.module-accordion-header .chevron {
  transition: transform 0.2s ease;
  font-size: 0.9rem;
  color: var(--gray-400);
}

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

.module-accordion-body {
  display: none;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--gray-100);
}

.module-accordion.open .module-accordion-body { display: block; }

/* ---- Lesson Items ---- */
.lesson-list { list-style: none; padding: 0; margin: 0; }

.lesson-item {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  gap: var(--space-md);
  transition: var(--transition);
  border-bottom: 1px solid var(--gray-50);
}

.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: var(--gray-50); }

.lesson-item .lesson-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: var(--gray-100);
}

.lesson-item .lesson-icon.video { background: rgba(239,68,68,0.1); }
.lesson-item .lesson-icon.pdf { background: rgba(59,130,246,0.1); }
.lesson-item .lesson-icon.text { background: rgba(16,185,129,0.1); }

.lesson-item .lesson-info { flex: 1; }
.lesson-item .lesson-info .lesson-name { font-weight: 500; font-size: 0.9rem; color: var(--gray-800); }
.lesson-item .lesson-info .lesson-meta { font-size: 0.75rem; color: var(--gray-500); }

.lesson-item .lesson-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* ---- Question Cards ---- */
.question-card {
  background: white;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.question-card .question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.question-card .question-number {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.85rem;
}

.question-card .question-text {
  color: var(--gray-800);
  font-size: 0.95rem;
  margin-bottom: var(--space-md);
}

.question-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.question-option .option-label {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-600);
  flex-shrink: 0;
}

.question-option.correct {
  background: rgba(16,185,129,0.08);
  color: #065F46;
}

.question-option.correct .option-label {
  background: #10B981;
  color: white;
}

/* ---- Publish Checklist ---- */
.publish-checklist {
  background: white;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.publish-checklist .checklist-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  font-size: 0.95rem;
}

.checklist-item .check-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.checklist-item .check-icon.ok { background: rgba(16,185,129,0.15); }
.checklist-item .check-icon.fail { background: rgba(239,68,68,0.12); }

.checklist-item .check-text { color: var(--gray-700); }
.checklist-item .check-text.ok { color: #065F46; }
.checklist-item .check-text.fail { color: #DC2626; }

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--gray-100);
}

.section-header .section-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--primary);
  font-weight: 700;
}

.section-header .section-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--gray-400);
}

.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.empty-state .empty-text { font-size: 0.95rem; margin-bottom: var(--space-lg); }

/* ---- Badge Variants ---- */
.badge-outline {
  border: 1px solid var(--gray-300);
  background: transparent;
  color: var(--gray-600);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---- Action Icon Button ---- */
.btn-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gray-500);
  transition: var(--transition);
}

.btn-icon:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.1); color: #DC2626; }

/* ---- Info Grid ---- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.info-item .info-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 2px;
}

.info-item .info-value {
  font-size: 0.95rem;
  color: var(--gray-800);
  font-weight: 500;
}

/* ---- Thumbnail Upload Component ---- */
.thumb-upload {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.thumb-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 320px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  background: var(--gray-50);
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.thumb-preview:hover {
  border-color: var(--primary);
  background: rgba(74, 63, 143, 0.04);
}

.thumb-preview.dragover {
  border-color: var(--primary);
  background: rgba(74, 63, 143, 0.08);
}

.thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-preview .thumb-placeholder {
  color: var(--gray-400);
  font-size: 0.85rem;
  text-align: center;
  padding: var(--space-md);
  line-height: 1.5;
}

.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.thumb-remove:hover {
  background: #DC2626;
}

/* Thumb preview grande (painel de info do curso) */
.thumb-preview-lg {
  max-width: 220px;
  min-width: 180px;
}

.course-thumb-admin {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

/* ---- PDF Upload Component ---- */
.pdf-upload-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.pdf-upload-status {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  transition: border-color 0.2s;
}

.pdf-upload-status:hover {
  border-color: var(--primary);
}

/* Mini-thumbnail na tabela */
.table-thumb {
  width: 48px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.table-thumb-empty {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

/* ============================================================
   PIX Checkout
   ============================================================ */

/* Valor destacado */
.pix-amount {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-serif);
}

.pix-amount-sm {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-serif);
  white-space: nowrap;
}

/* QR Code container */
.pix-qr-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pix-qr-code img {
  display: block;
  image-rendering: pixelated;
}

/* Copy field */
.pix-copy-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

/* Timer */
.pix-timer {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: color 0.3s;
}

/* Status indicator */
.pix-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.82rem;
  color: var(--gray-500);
}

.pix-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pix-pulse 1.5s ease-in-out infinite;
}

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

/* Eligible card */
.eligible-card {
  border: 2px solid var(--gray-100);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.eligible-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(74, 63, 143, 0.12);
}

/* Spinner for loading */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dashboard-main { margin-left: 0; }
  .sidebar-toggle-btn { display: flex; }
  .dashboard-content { padding: var(--space-lg); }
  .enrollment-card { flex-direction: column; }
  .enrollment-thumb { width: 100%; height: 120px; }
  .module-accordion-header { flex-wrap: wrap; }
  .section-header { flex-wrap: wrap; gap: var(--space-sm); }
  .thumb-preview-lg { max-width: 100%; }
  .course-thumb-admin { width: 100%; }

  /* PIX responsive */
  .pix-qr-code img { width: 160px !important; height: 160px !important; }
  .pix-copy-field { flex-direction: column; }
  .pix-copy-field .btn { width: 100%; }
}

/* Backdrop do menu mobile (criado pelo main.js) */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); z-index: 480; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

/* Seção Avaliações: fluxo por curso (Estudar → Certificado → Prova → Emitir) */
.exam-flow-card { background: white; border: 1px solid var(--gray-100); border-radius: var(--radius-lg); padding: var(--space-lg); box-shadow: var(--shadow-card, 0 2px 8px rgba(2,6,23,.05)); }
.exam-flow-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: var(--space-md); }
.exam-flow-head h3 { font-size: 1rem; color: var(--gray-800); }
.exam-steps { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: var(--space-md); }
.exam-step { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.exam-step-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 700; background: var(--gray-100); color: var(--gray-500); border: 2px solid var(--gray-200); }
.exam-step.done .exam-step-dot { background: #16a34a; border-color: #16a34a; color: white; }
.exam-step.now .exam-step-dot { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 0 0 4px rgba(37,99,235,.18); }
.exam-step-label { font-size: .78rem; font-weight: 600; color: var(--gray-500); white-space: nowrap; }
.exam-step.now .exam-step-label { color: var(--primary); }
.exam-step.done .exam-step-label { color: #16a34a; }
.exam-step-line { flex: 1; min-width: 14px; height: 2px; background: var(--gray-200); }
.exam-flow-cta { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
@media (max-width: 640px) {
  .exam-flow-cta .btn { width: 100%; justify-content: center; }
}

@media (max-width: 720px) {
  .enrollment-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
  .enrollment-actions .btn { flex: 1 1 auto; justify-content: center; }
  .dashboard-topbar { padding-left: var(--space-md); padding-right: var(--space-md); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
  .stat-card { padding: var(--space-md); flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .card-body { overflow-x: auto; }
}

/* Hambúrguer no topbar (movido pelo main.js) */
.sidebar-toggle-btn.in-topbar { position: static; display: none; width: 42px; height: 42px; border-radius: 10px; margin-right: var(--space-md); box-shadow: none; flex-shrink: 0; align-items: center; justify-content: center; }
@media (max-width: 900px) {
  .sidebar-toggle-btn.in-topbar { display: flex; }
  #topbarDate { display: none; }
  .dashboard-topbar { gap: var(--space-sm); }
}
