/* ============================================================
   AULA 7: ANÁLISE DE ALGORITMOS RECURSIVOS (PDF SLIDE VIEWER)
   Tema LaTeX Beamer Warsaw Fiel para Visualização de Slides
   Autor: Prof. Pedro Ximenes (UNICAP)
   ============================================================ */

:root {
  --warsaw-dark: #001f3f;
  --warsaw-primary: #003366;
  --warsaw-secondary: #174276;
  --warsaw-light: #e8f0fe;
  --warsaw-accent: #2563eb;
  --warsaw-gold: #fbbf24;

  --bg-main: #0f172a;
  --viewport-bg: #1e293b;
  --slide-bg: #ffffff;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.12);
  --header-bg: #001f3f;
  --header-sub: #003366;
  --footline-bg: #001f3f;
  --footline-sub: #174276;
}

body.theme-light {
  --bg-main: #e2e8f0;
  --viewport-bg: #cbd5e1;
  --slide-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: rgba(0, 0, 0, 0.15);
  --header-bg: #001f3f;
  --header-sub: #003366;
  --footline-bg: #001f3f;
  --footline-sub: #174276;
}

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

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

/* ============================================================
   WARSAW BEAMER DUAL-BAR HEADER
   ============================================================ */
#warsaw-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.warsaw-section-bar {
  height: 38px;
  background: var(--header-bg);
  background: linear-gradient(180deg, #00152b 0%, #002244 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.warsaw-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.warsaw-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.warsaw-nav-back:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-2px);
}

.warsaw-tag {
  font-size: 11px;
  font-weight: 800;
  color: #60a5fa;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.warsaw-header-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warsaw-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 2px 6px;
}

.page-nav-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s;
}

.page-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
}

.page-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-nav-input {
  width: 38px;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
  border-radius: 3px;
  padding: 1px 2px;
}

.page-nav-total {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
}

.font-zoom-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  overflow: hidden;
}

.font-zoom-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}

.font-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

#zoom-label {
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  padding: 0 6px;
  min-width: 44px;
  text-align: center;
}

.warsaw-tool-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  height: 26px;
}

.warsaw-tool-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.warsaw-tool-btn.primary-btn {
  background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
  border-color: rgba(255, 255, 255, 0.3);
}

.warsaw-tool-btn.primary-btn:hover {
  background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
}

.warsaw-subsection-bar {
  height: 24px;
  background: var(--header-sub);
  background: linear-gradient(180deg, #002e5d 0%, #003a75 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: #bfdbfe;
}

/* ============================================================
   MAIN SLIDE VIEWER CONTAINER
   ============================================================ */
#viewer-container {
  position: absolute;
  top: 62px;
  bottom: 28px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  background-color: var(--viewport-bg);
}

.slide-canvas-wrapper {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  background-color: var(--slide-bg);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

#pdf-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  user-select: none;
}

/* Side Hover Arrows */
.side-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 72px;
  background: rgba(0, 31, 63, 0.65);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}

.side-nav-btn.prev {
  left: 12px;
  border-radius: 0 8px 8px 0;
}

.side-nav-btn.next {
  right: 12px;
  border-radius: 8px 0 0 8px;
}

#viewer-container:hover .side-nav-btn {
  opacity: 0.65;
}

.side-nav-btn:hover:not(:disabled) {
  opacity: 1 !important;
  background: rgba(0, 51, 102, 0.95);
  transform: translateY(-50%) scale(1.08);
}

.side-nav-btn:disabled {
  opacity: 0.15 !important;
  cursor: not-allowed;
}

/* Loading Spinner */
#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  backdrop-filter: blur(4px);
  color: #ffffff;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Fallback Container */
#pdf-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  background: var(--slide-bg);
  color: var(--text-main);
  border-radius: 8px;
  max-width: 600px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

#pdf-fallback h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
  color: #e53935;
}

#pdf-fallback p {
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ============================================================
   WARSAW FOOTLINE (RODAPÉ)
   ============================================================ */
#warsaw-footline {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 28px;
  background: var(--footline-bg);
  background: linear-gradient(180deg, #001f3f 0%, #001124 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
}

.foot-left {
  font-weight: 600;
  color: #93c5fd;
  white-space: nowrap;
}

.foot-mid {
  color: #e2e8f0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px;
}

.foot-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.foot-right kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  color: #ffffff;
}

/* Fullscreen mode adjustments */
:fullscreen #viewer-container {
  top: 0;
  bottom: 0;
  padding: 0;
  background: #000000;
}

:fullscreen #warsaw-header,
:fullscreen #warsaw-footline {
  display: none;
}

/* Responsive design */
@media (max-width: 768px) {
  .warsaw-header-title {
    display: none;
  }
  .foot-mid {
    display: none;
  }
  .font-zoom-group {
    display: none;
  }
}
