:root {
  --bg: #070709;
  --bg-2: #0c0c0f;
  --surface: #111116;
  --surface-2: #17171d;
  --surface-3: #202028;
  --text: #f6f3f1;
  --text-muted: #a7a3a0;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --brand: #d92c35;
  --brand-2: #ff3f49;
  --brand-soft: rgba(217, 44, 53, 0.16);
  --green: #48c889;
  --green-soft: rgba(72, 200, 137, 0.15);
  --yellow: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.50);
  --header-h: 74px;
  --max: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h, 74px) + 20px);
}

section[id],
[id] {
  scroll-margin-top: calc(var(--header-h, 74px) + 20px);
}

body {
  margin: 0;
  background: radial-gradient(circle at 75% -10%, rgba(217, 44, 53, .10), transparent 32%), var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: .2s;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.shell {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* TOPBAR / HEADER */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(7, 7, 10, 0);
  border-bottom: 1px solid rgba(255, 255, 255, 0);
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    -webkit-backdrop-filter 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(5, 5, 7, 0.88) 0%, rgba(5, 5, 7, 0.35) 60%, transparent 100%);
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
}

.topbar.scrolled,
.topbar.solid {
  background: rgba(8, 8, 12, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.50);
}

.topbar.scrolled::before,
.topbar.solid::before {
  opacity: 0;
}

.nav-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-logo img {
  height: 40px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
}

.brand-logo span {
  color: var(--brand);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-menu a {
  opacity: .8;
}

.nav-menu a:hover,
.nav-menu a.active {
  opacity: 1;
  color: #fff;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: .92rem;
  border-radius: var(--radius-sm);
  padding: 0 20px;
  min-height: 44px;
  border: 1px solid transparent;
  transition: all .2s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 24px rgba(217, 44, 53, .28);
}

.btn-primary:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(217, 44, 53, .40);
}

.btn-secondary {
  background: var(--surface-2);
  color: #fff;
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: .84rem;
}

.btn-lg {
  min-height: 52px;
  padding: 0 28px;
  font-size: 1.05rem;
  border-radius: 12px;
}

/* SLEEK HEADER ACTION PILLS */
.btn-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  height: 34px;
  font-size: 0.80rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(217, 44, 53, 0.12);
  border: 1px solid rgba(217, 44, 53, 0.35);
  color: #ff5252;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-admin-badge:hover {
  background: rgba(217, 44, 53, 0.25);
  border-color: rgba(217, 44, 53, 0.60);
  color: #fff;
  transform: translateY(-1px);
}

/* USER DROPDOWN FLUIDO E MOLDURA DE PERFIL ESCURA */
.user-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #23232c 0%, #141419 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f0ece9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.80rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.avatar:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.avatar-btn {
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: inherit;
  padding: 0;
  outline: none;
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 260px;
  background: rgba(18, 18, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease;
  z-index: 1000;
}

.user-dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-user-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 12px;
}

.dropdown-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e50914 0%, #b81d24 100%);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.35);
}

.dropdown-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropdown-user-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  color: #48c889;
  background: rgba(72, 200, 137, 0.12);
  border: 1px solid rgba(72, 200, 137, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 6px 0;
}

.dropdown-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.dropdown-link-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(3px);
}

.dropdown-link-item svg {
  color: var(--text-muted);
  transition: color 0.15s;
  flex-shrink: 0;
}

.dropdown-link-item:hover svg {
  color: #fff;
}

.dropdown-logout {
  color: #ff5c5c !important;
}

.dropdown-logout svg {
  color: #ff5c5c !important;
}

.dropdown-logout:hover {
  background: rgba(229, 9, 20, 0.14) !important;
  color: #ff4747 !important;
}

.dropdown-logout:hover svg {
  color: #ff4747 !important;
}

@media (max-width: 992px) {
  .nav-actions {
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .nav-container {
    gap: 8px;
  }

  .brand-logo img {
    height: 30px;
    max-width: 130px;
  }

  .nav-actions {
    gap: 6px;
    margin-left: auto;
  }

  .btn-admin-badge {
    height: 32px;
    padding: 0 10px;
    font-size: 0.75rem;
    gap: 4px;
  }

  .btn-admin-badge svg {
    width: 13px;
    height: 13px;
  }

  .btn-profile-pill {
    height: 32px;
    padding: 2px 10px 2px 4px;
    font-size: 0.78rem;
    gap: 6px;
  }

  .btn-profile-pill .avatar-circle {
    width: 22px;
    height: 22px;
    font-size: 0.70rem;
  }

  .btn-logout-pill {
    height: 32px;
    padding: 0 10px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .btn-admin-badge span.admin-label {
    display: none;
  }

  .btn-admin-badge {
    padding: 0 8px;
  }

  .btn-profile-pill span.profile-name {
    display: none !important;
  }

  .btn-profile-pill {
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    justify-content: center;
  }

  .btn-logout-pill span {
    display: none;
  }

  .btn-logout-pill {
    padding: 0 8px;
  }
}

/* HERO */
.hero-section {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: 120px 0 60px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -1;
}

.hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 7, 9, 1) 0%, rgba(7, 7, 9, 0.85) 45%, rgba(7, 7, 9, 0.3) 100%),
    linear-gradient(0deg, rgba(7, 7, 9, 1) 0%, transparent 60%);
}

.hero-content {
  max-width: 680px;
  z-index: 2;
}

.hero-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--brand-soft);
  border: 1px solid rgba(217, 44, 53, .3);
  color: var(--brand-2);
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 16px;
  letter-spacing: .08em;
}

.hero-title {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}

.hero-desc {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.hero-btns {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* SECTION & GRID */
.section {
  padding: 60px 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title a {
  font-size: .88rem;
  font-weight: 600;
  color: var(--brand);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}

@media (max-width: 600px) {
  .course-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
}

.course-thumb {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface-2);
}

.course-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.course-card:hover .course-thumb img {
  transform: scale(1.04);
}

.course-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(7, 7, 9, .85);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .70rem;
  font-weight: 750;
  border: 1px solid var(--line);
}

.course-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.course-title {
  font-size: 1rem;
  font-weight: 750;
  margin: 0 0 6px;
  line-height: 1.3;
}

.course-meta {
  font-size: .80rem;
  color: var(--text-muted);
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* PROGRESS BAR */
.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--surface-3);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 10px;
  transition: width .3s ease;
}

/* FLASH ALERTS */
.flash-alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 600;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
}

.flash-success {
  background: var(--green-soft);
  color: #72ebb0;
  border: 1px solid rgba(72, 200, 137, .3);
}

.flash-error {
  background: var(--brand-soft);
  color: #ff6b72;
  border: 1px solid rgba(217, 44, 53, .3);
}

/* FOOTER */
footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 36px;
}

.footer-copy {
  font-size: .86rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 380px;
}

.footer-col h4 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 16px;
  color: #fff;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: .86rem;
  color: var(--text-muted);
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

/* RESPONSIVENESS */
@media (max-width: 900px) {
  .hero-section {
    padding: 100px 0 40px;
    min-height: 65vh;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .nav-menu {
    display: none;
  }
}

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 32px);
  }

  .btn-lg {
    width: 100%;
  }
}

/* ==========================================
   MOBILE PWA APP SPLASH LOADER (APENAS DISPOSITIVOS MÓVEIS)
   ========================================== */
.pwa-mobile-splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #070709;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
  pointer-events: auto;
}

@media (min-width: 881px) {
  .pwa-mobile-splash {
    display: none !important;
  }
}

.pwa-mobile-splash.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.pwa-splash-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: pwaSplashPulse 1.8s ease-in-out infinite alternate;
}

.pwa-splash-logo {
  height: 38px;
  max-width: 170px;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(217, 44, 53, 0.45));
}

.pwa-splash-loader-bar {
  width: 130px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.pwa-splash-loader-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 45%;
  background: linear-gradient(90deg, #d92c35, #ff525a);
  border-radius: 99px;
  animation: pwaSplashBar 1.2s ease-in-out infinite;
}

@keyframes pwaSplashBar {
  0% {
    left: -45%;
    width: 35%;
  }

  50% {
    width: 65%;
  }

  100% {
    left: 100%;
    width: 35%;
  }
}

@keyframes pwaSplashPulse {
  0% {
    transform: scale(0.98);
    opacity: 0.92;
  }

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