/* ============================================================
   DIW - Desenvolvimento de Interfaces Web
   Estilos Customizados (complementam o Tailwind CSS)
   ============================================================ */

/* Scrollbar customizada */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #6366f1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4f46e5; }

/* ============================================================
   Prism.js override – tema escuro ajustado
   ============================================================ */
pre[class*="language-"] {
  border-radius: 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

code[class*="language-"],
pre[class*="language-"] {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* ============================================================
   Bloco de código com cabeçalho e botão Copiar
   ============================================================ */
.code-block {
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #374151;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1f2937;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.code-header .lang-badge {
  background: #374151;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid #4b5563;
  color: #9ca3af;
  padding: 0.2rem 0.6rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-copy:hover { background: #374151; color: #e5e7eb; border-color: #6b7280; }
.btn-copy.copied { color: #10b981; border-color: #10b981; }

/* ============================================================
   Mini Sandbox (editor + preview)
   ============================================================ */
.sandbox {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  margin: 1.5rem 0;
}

.sandbox-tabs {
  display: flex;
  background: #1f2937;
  border-bottom: 2px solid #374151;
}

.sandbox-tab {
  padding: 0.5rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.sandbox-tab.active { color: #818cf8; border-bottom-color: #818cf8; }
.sandbox-tab:hover:not(.active) { color: #d1d5db; }

.sandbox-run-btn {
  margin-left: auto;
  margin-right: 0.75rem;
  align-self: center;
  background: #059669;
  color: white;
  border: none;
  padding: 0.3rem 0.85rem;
  border-radius: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.2s;
}
.sandbox-run-btn:hover { background: #047857; }

.sandbox-panel { display: none; }
.sandbox-panel.active { display: block; }

.sandbox-panel pre[class*="language-"] {
  border-radius: 0;
  max-height: 300px;
  overflow-y: auto;
}

.sandbox-preview {
  background: white;
  border-top: 2px dashed #e5e7eb;
}

.sandbox-preview iframe {
  width: 100%;
  border: none;
  min-height: 200px;
  display: block;
}

.sandbox-preview-label {
  background: #f8fafc;
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}

/* ============================================================
   Cards de módulo
   ============================================================ */
.module-card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

/* Badge de status */
.badge-em-andamento { background: #dbeafe; color: #1d4ed8; }
.badge-concluido    { background: #d1fae5; color: #065f46; }
.badge-proximo      { background: #fef9c3; color: #92400e; }
.badge-pendente     { background: #f1f5f9; color: #64748b; }

/* ============================================================
   Linha do tempo da disciplina
   ============================================================ */
.timeline-item {
  position: relative;
  padding-left: 2rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 1.5rem;
  bottom: -0.5rem;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid white;
}

/* ============================================================
   Checklist de passos (tutoriais)
   ============================================================ */
.step-list { counter-reset: step; }
.step-item {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2rem;
}
.step-item::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: #4f46e5;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ============================================================
   Callout / Alert didático
   ============================================================ */
.callout {
  border-left: 4px solid;
  padding: 1rem 1.25rem;
  border-radius: 0 0.5rem 0.5rem 0;
  margin: 1.5rem 0;
}
.callout-info    { border-color: #6366f1; background: #eef2ff; }
.callout-tip     { border-color: #10b981; background: #ecfdf5; }
.callout-warning { border-color: #f59e0b; background: #fffbeb; }
.callout-danger  { border-color: #ef4444; background: #fef2f2; }

.callout-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.callout-info .callout-title    { color: #4338ca; }
.callout-tip .callout-title     { color: #065f46; }
.callout-warning .callout-title { color: #92400e; }
.callout-danger .callout-title  { color: #991b1b; }

/* ============================================================
   Accordion
   ============================================================ */
.accordion-header {
  cursor: pointer;
  user-select: none;
}
.accordion-content {
  display: none;
}
.accordion-content.open {
  display: block;
}
.accordion-icon {
  transition: transform 0.25s;
  display: inline-block;
}
.accordion-item.open .accordion-icon {
  transform: rotate(180deg);
}

/* ============================================================
   Navegação ativa
   ============================================================ */
.nav-link.active {
  color: #a5b4fc !important;
  border-bottom: 2px solid #a5b4fc;
}

/* ============================================================
   Hero gradient
   ============================================================ */
.hero-gradient {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 50%, #0f0e2e 100%);
}

/* ============================================================
   Animação de entrada
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.5s ease both;
}
.fade-in-up-delay-1 { animation-delay: 0.1s; }
.fade-in-up-delay-2 { animation-delay: 0.2s; }
.fade-in-up-delay-3 { animation-delay: 0.3s; }

/* ============================================================
   Endpoint reference table
   ============================================================ */
.endpoint-table th { background: #1e1b4b; color: white; }
.endpoint-table tr:nth-child(even) { background: #f8fafc; }
.method-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: monospace;
  letter-spacing: 0.05em;
}
.method-get    { background: #d1fae5; color: #065f46; }
.method-post   { background: #dbeafe; color: #1e40af; }
.method-put    { background: #fef3c7; color: #92400e; }
.method-patch  { background: #ede9fe; color: #5b21b6; }
.method-delete { background: #fee2e2; color: #991b1b; }

/* ============================================================
   Split-view – páginas de detalhe de exemplos
   ============================================================ */
.detail-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}
.detail-split.preview-only { grid-template-columns: 1fr 0; }
.detail-split.code-only    { grid-template-columns: 0 1fr; }
.detail-split.preview-only .code-pane   { display: none; }
.detail-split.code-only    .preview-pane { display: none; }

.preview-pane,
.code-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-pane { border-right: 2px solid #1f2937; }

.pane-header {
  background: #1f2937;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #9ca3af;
  flex-shrink: 0;
  border-bottom: 1px solid #374151;
  flex-wrap: wrap;
}

.file-tab {
  padding: 0.2rem 0.65rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: 'Fira Code', monospace;
  transition: all 0.15s;
  white-space: nowrap;
}
.file-tab.active           { background: #4f46e5; color: white; }
.file-tab:hover:not(.active) { background: #374151; color: #d1d5db; }

.split-toggle-btn {
  margin-left: auto;
  background: #374151;
  border: none;
  color: #d1d5db;
  padding: 0.2rem 0.6rem;
  border-radius: 0.25rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.split-toggle-btn:hover { background: #4b5563; }

.preview-pane iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: white;
}

.code-scroll {
  flex: 1;
  overflow-y: auto;
}
.code-scroll pre[class*="language-"] {
  margin: 0;
  border-radius: 0;
  min-height: 100%;
  font-size: 0.8rem;
  line-height: 1.55;
}

/* Responsive: empilha no mobile */
@media (max-width: 768px) {
  .detail-split {
    grid-template-columns: 1fr;
    grid-template-rows: 45vh auto;
    height: auto;
  }
  .preview-pane { border-right: none; border-bottom: 2px solid #1f2937; }
  .detail-split.preview-only { grid-template-rows: 45vh; }
  .detail-split.code-only    { grid-template-rows: auto; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  nav, footer, .no-print { display: none !important; }
  body { font-size: 12pt; }
}
