/**
 * ====================================================================
 * ESTILOS PRINCIPAIS DA PLATAFORMA DO MINI CURSO (MAIN.CSS)
 * ====================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-hover: #374151;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-glow: rgba(37, 99, 235, 0.35);

  --success: #10b981;
  --success-hover: #059669;
  --success-glow: rgba(16, 185, 129, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);

  --sidebar-width: 380px;
  --header-height: 70px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ------------------------------------------------------------------
   CABEÇALHO (HEADER)
   ------------------------------------------------------------------ */
.app-header {
  height: var(--header-height);
  background-color: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
}

/* Progresso Global no Header */
.header-center {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.progress-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.progress-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-values {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.global-progress-bar-container {
  width: 130px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.global-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 10px;
  transition: width 0.4s ease;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-cert-header {
  display: none;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.user-avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 0.75rem;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.btn-logout:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.btn-sidebar-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ------------------------------------------------------------------
   LAYOUT PRINCIPAL
   ------------------------------------------------------------------ */
.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Área de Conteúdo / Vídeo */
.main-content {
  flex: 1;
  padding: 24px 32px 40px 32px;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  transition: all 0.3s ease;
}

/* Barra de Ações da Aula */
.lesson-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
  gap: 16px;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-complete:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-complete.completed {
  background: var(--success);
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-complete.completed:hover {
  background: var(--success-hover);
}

.btn-rewatch {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

.btn-rewatch:hover {
  background: rgba(255, 255, 255, 0.15);
}

.action-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-nav-lesson {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-nav-lesson:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-nav-lesson:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Informações da Aula e Abas */
.lesson-meta-card {
  margin-top: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.lesson-badge-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.lesson-module-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-light);
  background: rgba(37, 99, 235, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
}

.lesson-header-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  margin-bottom: 20px;
}

/* Abas */
.tabs-navigation {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-nav-btn:hover {
  color: var(--text-primary);
}

.tab-nav-btn.active {
  color: var(--primary-light);
}

.tab-nav-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lesson-desc-text {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.7;
}

/* Lista de Anexos */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.2s, border-color 0.2s;
}

.attachment-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.attachment-icon {
  color: var(--primary-light);
}

.attachment-name {
  font-size: 0.88rem;
  font-weight: 600;
  display: block;
}

.attachment-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Bloco de Anotações */
.notes-container textarea {
  width: 100%;
  min-height: 130px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.notes-container textarea:focus {
  border-color: var(--primary);
}

.notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------------
   BARRA LATERAL (SIDEBAR COM AS AULAS)
   ------------------------------------------------------------------ */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  transition: transform 0.3s ease, width 0.3s ease;
  z-index: 50;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(100%);
  width: 0;
  border-left: none;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px 12px 9px 36px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
}

.lessons-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

/* Grupos de Módulo */
.module-group {
  margin-bottom: 16px;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 4px;
}

.module-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.module-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Item de Aula na Lista */
.lesson-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 4px;
  color: inherit;
}

.lesson-item:hover {
  background: var(--bg-surface-elevated);
}

.lesson-item.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
}

.lesson-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.lesson-item.is-active .lesson-status-icon {
  background: var(--primary);
  color: #fff;
}

.lesson-item.is-completed .lesson-status-icon {
  background: var(--success);
  color: #fff;
}

.lesson-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.lesson-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-item.is-completed .lesson-title {
  color: var(--text-secondary);
}

.lesson-duration {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ------------------------------------------------------------------
   MODAIS E TELA DE ACESSO (GATEKEEPER)
   ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.auth-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.auth-header p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-error {
  display: none;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 0.82rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.btn-primary-block {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 13px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: background 0.2s, transform 0.1s;
}

.btn-primary-block:hover {
  background: var(--primary-hover);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Modal Certificado */
.cert-modal-content {
  max-width: 780px;
  padding: 0;
  background: #fff;
  color: #1e293b;
  overflow: hidden;
}

.certificate-sheet {
  padding: 40px;
  border: 8px solid #0f172a;
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  position: relative;
  text-align: center;
}

.cert-badge {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.cert-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
}

.cert-desc {
  font-size: 1.05rem;
  color: #475569;
  margin-bottom: 12px;
}

.cert-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1e3a8a;
  text-decoration: underline;
  text-underline-offset: 6px;
  margin-bottom: 24px;
}

.cert-course {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.cert-footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #cbd5e1;
  font-size: 0.82rem;
  color: #64748b;
  text-align: left;
}

.cert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  background: #f1f5f9;
}

/* Toast de Notificação */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

.app-toast.show {
  transform: translateY(0);
  opacity: 1;
}
