:root {
  --bg-dark: #0b090e;
  --bg-card: #16121c;
  --bg-card-hover: #1e1927;
  --bg-input: #231d2e;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(217, 119, 6, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --gold-primary: #d97706;
  --gold-hover: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --accent-rose: #e11d48;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  overflow-x: hidden;
}

/* CONTAINER MOBILE-FIRST (560px) */
.app-container {
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  position: relative;
}

/* HEADER */
.app-header {
  padding: 24px 20px 16px 20px;
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.12) 0%, rgba(11, 9, 14, 0) 100%);
  border-bottom: 1px solid var(--border-color);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.welcome-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold-hover);
  text-transform: uppercase;
}

.user-greeting h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.edit-name-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.edit-name-btn:hover {
  background: var(--gold-primary);
  color: #fff;
}

.header-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* CONTENT VIEWS */
.app-content {
  flex: 1;
  padding: 20px;
}

.view-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* MODULE CARDS */
.module-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
}

.hero-module {
  border-color: var(--border-gold);
  box-shadow: 0 8px 30px rgba(217, 119, 6, 0.15);
}

.pdf-module-card {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.1);
}

.module-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background-color: var(--gold-primary);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 30px;
  z-index: 2;
}

.pdf-badge {
  background-color: var(--accent-green);
}

.bonus-badge {
  background-color: var(--accent-rose);
}

.module-image-wrap {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
}

.module-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.module-card:hover .module-img {
  transform: scale(1.05);
}

.play-overlay-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(217, 119, 6, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding-left: 4px;
  box-shadow: 0 0 20px var(--gold-glow);
}

.pdf-icon-overlay {
  background: rgba(16, 185, 129, 0.9);
  padding-left: 0;
}

.module-body {
  padding: 20px;
}

.module-body h2 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

.module-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.module-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.meta-item {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 8px;
  color: #cbd5e1;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 8px;
  text-decoration: none;
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #fff;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
}

/* MODULE VIEW & NAV */
.view-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}

.view-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px 12px 40px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

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

.video-count-bar {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* VIDEO CARDS LIST */
.videos-list, .pdf-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-item-card, .pdf-item-card {
  display: flex;
  gap: 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  transition: all 0.2s;
}

.video-item-card:hover, .pdf-item-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-gold);
}

.pdf-icon-badge {
  width: 50px;
  height: 60px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.2) 0%, rgba(217, 119, 6, 0.2) 100%);
  border: 1px solid rgba(225, 29, 72, 0.4);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.video-thumb-wrap {
  position: relative;
  width: 130px;
  height: 85px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

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

.mini-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: rgba(217, 119, 6, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding-left: 2px;
}

.video-info, .pdf-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.aula-badge, .cat-badge {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-hover);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.cat-badge {
  color: var(--accent-green);
}

.video-title, .pdf-title {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.pdf-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pdf-actions .btn {
  padding: 8px 12px;
  font-size: 11.5px;
  border-radius: 8px;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 30px 24px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  animation: modalFade 0.3s ease-out;
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.modal-card h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  color: #fff;
  font-size: 15px;
  text-align: center;
  outline: none;
  margin-bottom: 16px;
}

.input-group input:focus {
  border-color: var(--gold-primary);
}

/* PLAYER & PDF MODALS */
.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  overflow: hidden;
}

.pdf-card {
  height: 85vh;
  max-height: 700px;
  display: flex;
  flex-direction: column;
}

.player-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.player-header h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.pdf-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.video-responsive {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
}

.pdf-responsive {
  flex: 1;
  width: 100%;
  background: #111;
  position: relative;
}

.video-responsive iframe, .pdf-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.player-footer {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.player-footer .btn {
  width: auto;
  padding: 10px 18px;
  font-size: 13px;
}

/* FOOTER */
.app-footer {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* CARDS DE BÔNUS DESTACADOS ELEGANTES */
.bonus-card-highlight {
  border: 1px solid rgba(217, 119, 6, 0.4) !important;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%), #16121e !important;
  box-shadow: 0 4px 20px rgba(217, 119, 6, 0.2) !important;
}

.bonus-card-highlight .cat-badge {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  letter-spacing: 0.5px !important;
  font-weight: 800 !important;
}

/* LEITOR MOZILLA PDF.JS CANVAS NATIVO */
.pdf-responsive {
  position: relative;
  width: 100%;
  height: 520px;
  overflow-y: auto;
  background: #0b090e;
  border-radius: 12px;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.pdf-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.pdf-page-canvas {
  max-width: 100%;
  height: auto !important;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  background: #ffffff;
}

.pdf-loading-spinner {
  padding: 50px 20px;
  text-align: center;
  color: var(--gold-hover);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
}

.pdf-fallback-wrap {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-main);
}

.pdf-fallback-icon {
  font-size: 48px;
  margin-bottom: 12px;
}


