/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 260px;
  --blue: #4361ee;
  --blue-light: #4cc9f0;
  --green: #2dc653;
  --orange: #f77f00;
  --purple: #7b2d8b;
  --pink: #e63946;
  --yellow: #f9c74f;
  --bg: #f0f4ff;
  --surface: #ffffff;
  --surface2: #f7f9ff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(67, 97, 238, 0.10);
  --shadow-lg: 0 8px 40px rgba(67, 97, 238, 0.18);
  --transition: 0.25s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
}

.logo-icon {
  font-size: 2rem;
}

.logo-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.logo-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Progress in sidebar */
.progress-sidebar {
  margin-bottom: 20px;
  padding: 0 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.progress-bar-bg {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4cc9f0, #4361ee);
  border-radius: 999px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Nav */
.nav-group-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, #4361ee, #4cc9f0);
  color: #fff;
  box-shadow: 0 4px 16px rgba(67, 97, 238, 0.4);
}

.nav-icon {
  width: 20px;
  text-align: center;
}

/* ===== HAMBURGER ===== */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--blue);
  border: none;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

/* ===== MAIN ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 40px;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #4361ee 0%, #7b2d8b 50%, #e63946 100%);
  border-radius: 24px;
  padding: 56px 48px;
  color: #fff;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '🤖';
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8rem;
  opacity: 0.15;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 550px;
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 14px 24px;
  text-align: center;
  min-width: 80px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  background: #fff;
  color: var(--blue);
  border: none;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.4);
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== CARDS GRID (Home) ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.info-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border-top: 4px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-blue {
  border-color: var(--blue);
}

.card-green {
  border-color: var(--green);
}

.card-orange {
  border-color: var(--orange);
}

.card-purple {
  border-color: var(--purple);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.info-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.info-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===== SECTION HEADER ===== */
.section-header {
  margin-bottom: 32px;
}

.section-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
}

/* ===== KIT COMPONENTS ===== */
.kit-components {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.component-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.component-card:hover {
  transform: translateY(-4px);
}

.component-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  overflow: hidden;
}

.component-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
  transition: transform var(--transition);
  padding: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.component-img:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.4);
}

.component-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.component-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.info-box {
  background: linear-gradient(135deg, #f0f4ff, #e8f4ff);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
}

.info-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.info-box p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tag-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag-green {
  background: #dcfce7;
  color: #15803d;
}

.tag-purple {
  background: #ede9fe;
  color: #6d28d9;
}

.tag-orange {
  background: #ffedd5;
  color: #c2410c;
}

/* ===== SENSORS ===== */
.sensors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.sensor-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.sensor-card:hover {
  transform: translateY(-4px);
}

.sensor-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  color: #fff;
}

.sensor-emoji {
  font-size: 2rem;
}

.sensor-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sensor-name {
  font-weight: 700;
  font-size: 1rem;
}

.sensor-sub {
  font-size: 0.75rem;
  opacity: 0.85;
}

.sensor-body {
  padding: 20px 24px;
}

.sensor-body p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.sensor-used {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}

/* ===== MONTAGEM ===== */
.montagem-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 28px;
  font-size: 0.88rem;
  color: #92400e;
}

.montagem-tip span {
  font-size: 1.2rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.step-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform var(--transition);
}

.step-card:hover {
  transform: translateY(-2px);
}

.step-num {
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-final {
  border: 2px solid var(--green);
}

.step-final .step-num {
  background: linear-gradient(135deg, #2dc653, #38f9d7);
}

/* ===== STEPS INTERATIVOS (Montagem) ===== */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.step-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.step-item-final {
  border: 2px solid var(--green);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.step-header .step-num {
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-item-final .step-header .step-num,
.step-num-final {
  background: linear-gradient(135deg, #2dc653, #38f9d7) !important;
}

.step-label {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.step-header .task-expand {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.step-item.open .task-expand {
  transform: rotate(180deg);
}

.step-body {
  display: none;
  padding: 0 20px 18px 74px;
  border-top: 1px solid var(--border);
}

.step-item.open .step-body {
  display: block;
}

.step-body-empty p {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 14px;
  font-style: italic;
}

/* ===== BLOCOS SOFTWARE ===== */
.blocos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.bloco-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent, var(--blue));
  transition: transform var(--transition);
}

.bloco-card:hover {
  transform: translateY(-3px);
}

.bloco-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.bloco-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.bloco-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.comm-box {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: var(--radius);
  padding: 28px;
  color: #fff;
}

.comm-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
}

.comm-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
}

.comm-num {
  background: linear-gradient(135deg, #4cc9f0, #4361ee);
  color: #fff;
  font-weight: 800;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== TASKS ===== */
.tasks-filter {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.filter-btn:hover:not(.active) {
  border-color: var(--blue);
  color: var(--blue);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.task-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.task-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.task-item.done {
  opacity: 0.8;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  cursor: pointer;
  position: relative;
}

.task-num {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.task-info {
  flex: 1;
}

.task-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.difficulty {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.diff-1 {
  background: #dcfce7;
  color: #15803d;
}

.diff-2 {
  background: #dbeafe;
  color: #1d4ed8;
}

.diff-3 {
  background: #ede9fe;
  color: #6d28d9;
}

.diff-4 {
  background: #ffedd5;
  color: #c2410c;
}

.diff-5 {
  background: #fee2e2;
  color: #b91c1c;
}

.new-concept {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.task-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition);
  flex-shrink: 0;
}

.task-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.task-expand {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 8px;
  transition: transform var(--transition);
}

.task-item.open .task-expand {
  transform: rotate(180deg);
}

.task-body {
  display: none;
  padding: 0 24px 20px 84px;
  border-top: 1px solid var(--border);
}

.task-item.open .task-body {
  display: block;
}

.task-body p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 14px;
}

.task-commands {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.cmd-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* ===== GALLERY ===== */
.task-gallery {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.gallery-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.gallery-item {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.gallery-item:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

.gallery-item img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  background: #fff;
  padding: 8px;
  display: block;
}

.gallery-caption {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 6px 10px;
  text-align: center;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  line-height: 1.3;
}

/* Badge na task-meta */
.has-images {
  font-size: 0.72rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ===== LIGHTBOX ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
}

#lightbox.open {
  display: flex;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 30, 0.88);
  backdrop-filter: blur(6px);
}

.lb-container {
  position: relative;
  z-index: 1000;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeIn 0.2s ease;
}

.lb-img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
  background: #fff;
  object-fit: contain;
}

.lb-caption {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  max-width: 500px;
}

.lb-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  background: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition);
  z-index: 1001;
}

.lb-close:hover {
  transform: scale(1.15);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 150;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 24px 16px 24px;
    padding-top: 64px;
  }

  .hero {
    padding: 36px 24px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero::before {
    display: none;
  }

  .task-body {
    padding-left: 24px;
  }
}