/* =========================================================
   ISAC DANIEL — Estilos das Aulas (slides interactivos)
   ========================================================= */

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

:root {
  --isps-blue: #1a3a6b;
  --isps-red: #c8102e;
  --isps-blue-light: #2c5aa0;
  --bg-dark: #0f172a;
  --bg-slide: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-dark);
  overflow: hidden;
  color: var(--text-dark);
}

/* ---------- Barra de progresso ---------- */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--isps-blue), var(--accent-cyan));
  width: 0%; z-index: 1000; transition: width 0.35s ease;
}

/* ---------- Botão voltar às aulas ---------- */
.back-to-aulas {
  position: fixed; top: 18px; left: 22px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  z-index: 999;
}
.back-to-aulas:hover {
  background: var(--isps-red);
  color: #fff;
  transform: translateX(-2px);
}

/* ---------- Deck e slides ---------- */
.deck { position: relative; width: 100vw; height: 100vh; overflow: hidden; }

.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 48px 64px 80px;
  background: var(--bg-slide);
  opacity: 0; transform: translateX(40px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
  overflow-y: auto;
}
.slide.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.slide.prev { transform: translateX(-40px); }

/* ---------- Slide de título ---------- */
.slide.title {
  background: linear-gradient(135deg, var(--isps-blue) 0%, var(--isps-blue-light) 60%, #3b82f6 100%);
  color: #fff;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.slide.title .isps-logo {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 40px; padding: 14px 26px;
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.slide.title .isps-logo img {
  height: 70px; width: auto; object-fit: contain; display: block;
}
.slide.title .isps-logo .logo-text {
  display: flex; flex-direction: column; align-items: flex-start;
  color: var(--isps-blue); font-weight: 700; letter-spacing: 0.5px; line-height: 1.25;
}
.slide.title .isps-logo .logo-text .inst { font-size: 0.92rem; color: var(--isps-blue); }
.slide.title .isps-logo .logo-text .sigla {
  font-size: 1.6rem; font-weight: 900; color: var(--isps-red);
  letter-spacing: 3px; margin-top: 2px;
}
.slide.title .logo-mark-fallback {
  display: none; width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--isps-red), #e63946);
  border-radius: 10px; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.slide.title h1 {
  font-size: 3.2rem; font-weight: 800; line-height: 1.15;
  margin-bottom: 20px; letter-spacing: -1px;
}
.slide.title h1 .highlight {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.slide.title .subtitle {
  font-size: 1.15rem; opacity: 0.9; max-width: 780px;
  line-height: 1.6; margin-bottom: 40px;
}
.slide.title .meta-grid {
  display: grid; grid-template-columns: repeat(2, auto);
  gap: 12px 48px;
  background: rgba(255,255,255,0.08);
  padding: 24px 40px; border-radius: 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.95rem;
}
.slide.title .meta-grid .label { opacity: 0.7; text-align: right; font-weight: 500; }
.slide.title .meta-grid .value { text-align: left; font-weight: 600; }

/* ---------- Cabeçalho dos slides ---------- */
.slide-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 3px solid #e2e8f0;
}
.slide-header .mini-logo {
  height: 42px; width: auto; object-fit: contain; flex-shrink: 0;
  padding: 3px; background: #fff; border-radius: 6px; border: 1px solid #e2e8f0;
}
.slide-header .section-tag {
  background: var(--isps-blue); color: #fff;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; padding: 6px 12px; border-radius: 6px; white-space: nowrap;
}
.slide-header h2 {
  font-size: 1.85rem; font-weight: 700; color: var(--isps-blue);
  letter-spacing: -0.5px; line-height: 1.2;
}
.slide-header .slide-num {
  margin-left: auto; font-size: 0.85rem; color: var(--text-muted);
  font-weight: 600; font-variant-numeric: tabular-nums;
}

/* ---------- Corpo dos slides ---------- */
.slide-body {
  flex: 1; font-size: 1.05rem;
  line-height: 1.65; color: var(--text-dark);
}
.slide-body p { margin-bottom: 14px; }
.slide-body ul, .slide-body ol { margin: 0 0 16px 24px; }
.slide-body li { margin-bottom: 10px; padding-left: 4px; }
.slide-body li::marker { color: var(--isps-red); font-weight: 700; }
.slide-body strong { color: var(--isps-blue); font-weight: 700; }

.slide-body code:not(pre code) {
  background: #f1f5f9; color: #be123c; padding: 2px 7px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.9em; font-weight: 600;
}

/* ---------- Blocos de código ---------- */
pre {
  background: var(--code-bg); color: var(--code-text);
  padding: 18px 22px; border-radius: 10px;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
  font-size: 0.92rem; line-height: 1.6;
  overflow-x: auto;
  margin: 14px 0 18px;
  border-left: 4px solid var(--accent-cyan);
  box-shadow: 0 4px 14px rgba(15,23,42,0.15);
}
pre code { font-family: inherit; }

/* Syntax highlight */
.kw  { color: #c792ea; font-weight: 600; }
.ty  { color: #82aaff; }
.fn  { color: #82aaff; }
.num { color: #f78c6c; }
.str { color: #c3e88d; }
.com { color: #64748b; font-style: italic; }
.pp  { color: #ffcb6b; }
.op  { color: #89ddff; }

/* ---------- Grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }

/* ---------- Cards ---------- */
.card {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-left: 4px solid var(--isps-blue);
  border-radius: 10px; padding: 18px 20px;
}
.card.red    { border-left-color: var(--isps-red); }
.card.green  { border-left-color: var(--accent-green); }
.card.amber  { border-left-color: var(--accent-amber); }
.card.purple { border-left-color: var(--accent-purple); }
.card.pink   { border-left-color: var(--accent-pink); }
.card.cyan   { border-left-color: var(--accent-cyan); }

.card h4 { font-size: 1rem; color: var(--isps-blue); margin-bottom: 8px; font-weight: 700; }
.card p, .card ul { font-size: 0.92rem; color: #475569; margin-bottom: 0; }
.card ul { margin-left: 18px; margin-top: 6px; }

/* ---------- Callouts ---------- */
.callout {
  display: flex; gap: 14px; padding: 16px 20px; border-radius: 10px;
  margin: 16px 0; font-size: 0.98rem; line-height: 1.55; align-items: flex-start;
}
.callout .icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.callout.info    { background: #eff6ff; border-left: 4px solid #3b82f6; color: #1e40af; }
.callout.warn    { background: #fffbeb; border-left: 4px solid var(--accent-amber); color: #92400e; }
.callout.danger  { background: #fef2f2; border-left: 4px solid var(--isps-red); color: #991b1b; }
.callout.success { background: #ecfdf5; border-left: 4px solid var(--accent-green); color: #065f46; }
.callout strong { color: inherit; }

/* ---------- Tabelas ---------- */
table.data-table {
  width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.92rem;
}
table.data-table th {
  background: var(--isps-blue); color: #fff; padding: 10px 14px;
  text-align: left; font-weight: 600; font-size: 0.85rem;
}
table.data-table td {
  padding: 10px 14px; border-bottom: 1px solid #e2e8f0; color: #334155;
}
table.data-table tr:nth-child(even) td { background: #f8fafc; }
table.data-table tr:hover td { background: #eff6ff; }
table.data-table code {
  background: #f1f5f9; color: #be123c; padding: 1px 5px;
  border-radius: 4px; font-size: 0.85em; font-weight: 600;
}

/* ---------- Diagramas de fluxo ---------- */
.flow-diagram {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin: 20px 0; flex-wrap: wrap;
}
.flow-box {
  background: #fff; border: 2px solid var(--isps-blue);
  border-radius: 10px; padding: 12px 18px;
  font-weight: 600; color: var(--isps-blue); font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}
.flow-box.red    { border-color: var(--isps-red); color: var(--isps-red); }
.flow-box.green  { border-color: var(--accent-green); color: var(--accent-green); }
.flow-box.purple { border-color: var(--accent-purple); color: var(--accent-purple); }
.flow-box.amber  { border-color: var(--accent-amber); color: #b45309; }
.flow-box.pink   { border-color: var(--accent-pink); color: #be185d; }
.flow-arrow { font-size: 1.6rem; color: var(--text-muted); font-weight: 700; }

/* ---------- Controlos de navegação ---------- */
.nav-controls {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 10px 18px; border-radius: 40px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  z-index: 999;
  border: 1px solid rgba(255,255,255,0.1);
}
.nav-btn {
  background: transparent; border: none; color: #e2e8f0;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: all 0.2s;
}
.nav-btn:hover:not(:disabled) { background: var(--isps-red); transform: scale(1.1); }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-counter {
  color: #e2e8f0; font-size: 0.85rem; font-weight: 600;
  font-variant-numeric: tabular-nums; min-width: 60px;
  text-align: center; letter-spacing: 0.5px;
}
.nav-counter .current { color: var(--accent-cyan); }

/* ---------- Pontos de navegação ---------- */
.dots {
  position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 998; max-width: 90vw;
  flex-wrap: wrap; justify-content: center;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(148,163,184,0.4); cursor: pointer;
  transition: all 0.2s; border: none; padding: 0;
}
.dot:hover { background: var(--accent-cyan); transform: scale(1.3); }
.dot.active { background: var(--isps-red); width: 20px; border-radius: 4px; }

/* ---------- Botão ecrã inteiro ---------- */
.fs-btn {
  position: fixed; top: 18px; right: 22px;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e2e8f0; width: 40px; height: 40px;
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; z-index: 999; transition: all 0.2s;
}
.fs-btn:hover { background: var(--isps-blue); }

/* ---------- Animações ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide.active .slide-header { animation: fadeUp 0.4s ease 0.05s both; }
.slide.active .slide-body   { animation: fadeUp 0.5s ease 0.15s both; }

/* ---------- Scrollbar ---------- */
.slide::-webkit-scrollbar { width: 8px; }
.slide::-webkit-scrollbar-track { background: transparent; }
.slide::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.slide::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .slide { padding: 32px 24px 100px; }
  .slide.title h1 { font-size: 2.1rem; }
  .slide-header h2 { font-size: 1.35rem; }
  .slide-header .mini-logo { height: 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  pre { font-size: 0.78rem; padding: 14px 16px; }
  .slide-body { font-size: 0.95rem; }
  .slide.title .meta-grid {
    grid-template-columns: 1fr; gap: 6px; padding: 18px 22px;
  }
  .slide.title .meta-grid .label { text-align: left; }
  .slide.title .isps-logo {
    flex-direction: column; gap: 8px; padding: 14px 20px;
  }
  .slide.title .isps-logo img { height: 56px; }
  .flow-diagram { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
  .back-to-aulas { font-size: 0.75rem; padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
