/* ==========================================================================
   Cosmic Vanguard — Visualizador e Atalho de HQs
   Estilo sci-fi, glassmorphism e responsivo
   ========================================================================== */

/* --- Atalhos no Canto da Tela / Topbar --- */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hq-corner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid rgba(121, 230, 255, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(16, 42, 78, 0.95), rgba(7, 18, 35, 0.95));
  color: #eaf4ff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  user-select: none;
  -webkit-user-select: none;
}

.hq-corner-btn:hover {
  border-color: #79e6ff;
  background: linear-gradient(135deg, rgba(25, 62, 112, 0.98), rgba(12, 28, 54, 0.98));
  box-shadow: 0 0 16px rgba(121, 230, 255, 0.45), inset 0 0 10px rgba(121, 230, 255, 0.2);
  transform: translateY(-1px);
  color: #ffffff;
}

.hq-corner-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 8px rgba(121, 230, 255, 0.3);
}

.hq-corner-icon {
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(121, 230, 255, 0.5));
}

.hq-corner-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 223, 105, 0.15);
  border: 1px solid rgba(255, 223, 105, 0.4);
  color: #ffdf69;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.hq-corner-key {
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(121, 230, 255, 0.3);
  color: #79e6ff;
  font-size: 9px;
  font-family: inherit;
  font-weight: 700;
}

/* Atalhos flutuantes no canto do Canvas (visível em telas cheias e mobile) */
.canvas-corner-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-corner-actions .hq-canvas-btn {
  position: static;
}

@media (hover: none), (pointer: coarse) {
  .canvas-corner-actions {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    gap: 6px;
  }

  .canvas-corner-actions .hq-canvas-btn {
    min-height: 44px;
    padding: 8px 10px;
    white-space: nowrap;
  }
}

.hq-canvas-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(121, 230, 255, 0.4);
  background: rgba(5, 14, 29, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #eaf4ff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  user-select: none;
}

.hq-canvas-btn:hover {
  border-color: #79e6ff;
  background: rgba(9, 25, 52, 0.95);
  box-shadow: 0 0 18px rgba(121, 230, 255, 0.5);
  transform: translateY(-1px);
}

.hq-canvas-btn:active {
  transform: translateY(1px);
}

/* Oculta botão do canvas durante combate na área de HUD em telas normais para não sobrepor placar */
.in-stage:not(.coarse-pointer) .hq-canvas-btn {
  opacity: 0.25;
  pointer-events: auto;
  transition: opacity 0.2s;
}
.in-stage:not(.coarse-pointer) .hq-canvas-btn:hover {
  opacity: 1;
}

/* --- Modal Leitor de HQs --- */
.hq-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

.hq-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(14, 30, 58, 0.88) 0%, rgba(2, 5, 12, 0.96) 80%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

.hq-modal-window {
  position: relative;
  width: min(96vw, 1340px);
  height: min(95vh, 920px);
  display: flex;
  flex-direction: column;
  background: #060c18;
  border: 1px solid #1f3b60;
  border-radius: 14px;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(121, 230, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hq-modal.open .hq-modal-window {
  transform: scale(1);
}

/* Header */
.hq-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
  background: linear-gradient(180deg, rgba(16, 35, 62, 0.98), rgba(7, 16, 31, 0.98));
  border-bottom: 1px solid #1a3352;
  flex-shrink: 0;
}

.hq-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.hq-logo-badge {
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(121, 230, 255, 0.15);
  border: 1px solid rgba(121, 230, 255, 0.4);
  color: #79e6ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.hq-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hq-title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #eaf3ff;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hq-subtitle {
  font-size: 11px;
  color: #8fa5c0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hq-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Botões utilitários no leitor */
.hq-icon-btn, .hq-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(121, 230, 255, 0.28);
  background: rgba(12, 27, 49, 0.7);
  color: #d8e8f8;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.hq-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.hq-pill-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
}

.hq-icon-btn:hover, .hq-pill-btn:hover {
  border-color: #79e6ff;
  background: rgba(22, 51, 88, 0.9);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(121, 230, 255, 0.3);
}

.hq-icon-btn:active, .hq-pill-btn:active {
  transform: translateY(1px);
}

.hq-icon-btn:disabled, .hq-pill-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.hq-zoom-group {
  display: flex;
  align-items: center;
  border: 1px solid rgba(121, 230, 255, 0.28);
  border-radius: 6px;
  background: rgba(12, 27, 49, 0.7);
  overflow: hidden;
}

.hq-zoom-group .hq-icon-btn {
  border: none;
  border-radius: 0;
  height: 30px;
  width: 28px;
}

.hq-zoom-label {
  border: none;
  background: transparent;
  color: #a6c0db;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  padding: 0 8px;
  cursor: pointer;
  min-width: 44px;
  text-align: center;
}

.hq-zoom-label:hover {
  color: #79e6ff;
}

.hq-pdf-btn {
  background: rgba(255, 223, 105, 0.12);
  border-color: rgba(255, 223, 105, 0.4);
  color: #ffdf69;
}

.hq-pdf-btn:hover {
  background: rgba(255, 223, 105, 0.25);
  border-color: #ffdf69;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 223, 105, 0.35);
}

.hq-close-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 93, 110, 0.4);
  border-radius: 6px;
  background: rgba(45, 14, 22, 0.7);
  color: #ff8e9b;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hq-close-btn:hover {
  border-color: #ff5d6e;
  background: rgba(85, 22, 34, 0.95);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 93, 110, 0.45);
}

/* Área central de leitura */
.hq-stage-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  background: #03060d;
}

.hq-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 46px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(121, 230, 255, 0.25);
  background: rgba(4, 11, 23, 0.75);
  backdrop-filter: blur(8px);
  color: #79e6ff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.hq-nav-prev {
  left: 12px;
  border-radius: 8px;
}

.hq-nav-next {
  right: 12px;
  border-radius: 8px;
}

.hq-nav-arrow:hover:not(:disabled) {
  border-color: #79e6ff;
  background: rgba(12, 32, 64, 0.95);
  color: #ffffff;
  box-shadow: 0 0 20px rgba(121, 230, 255, 0.45);
  transform: translateY(-50%) scale(1.06);
}

.hq-nav-arrow:disabled {
  opacity: 0.18;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
}

.hq-page-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 12px 64px;
}

.hq-page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s ease-out;
  cursor: default;
}

.hq-page-img {
  max-width: 100%;
  max-height: calc(95vh - 180px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.75), 0 0 1px rgba(255, 255, 255, 0.15);
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

/* Modo dupla página */
.hq-spread-mode .hq-page-container {
  max-width: 100%;
}
.hq-spread-mode .hq-page-img {
  max-width: calc(50% - 4px);
}

/* Zonas de clique para avançar/voltar */
.hq-click-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  z-index: 10;
  cursor: pointer;
}
.hq-click-zone-left { left: 0; }
.hq-click-zone-right { right: 0; }

/* Rodapé de navegação e controle de página */
.hq-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(7, 16, 31, 0.98), rgba(4, 10, 21, 0.99));
  border-top: 1px solid #1a3352;
}

.hq-footer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
}

.hq-footer-left, .hq-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hq-page-indicator {
  font-size: 12px;
  font-weight: 800;
  color: #79e6ff;
  letter-spacing: 0.05em;
  min-width: 120px;
  text-align: center;
  user-select: none;
}

.hq-page-slider-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
}

.hq-page-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #15273f;
  outline: none;
  cursor: pointer;
}

.hq-page-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #79e6ff;
  box-shadow: 0 0 10px rgba(121, 230, 255, 0.6);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.hq-page-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.hq-page-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #79e6ff;
  border: none;
  box-shadow: 0 0 10px rgba(121, 230, 255, 0.6);
  cursor: pointer;
}

/* Gaveta de miniaturas */
.hq-thumbs-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), padding 0.25s ease;
  background: #030812;
  border-top: 1px solid transparent;
}

.hq-thumbs-drawer.expanded {
  max-height: 140px;
  padding: 10px 18px 12px;
  border-top-color: #15263d;
}

.hq-thumbs-track {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #27456b #050a16;
}

.hq-thumbs-track::-webkit-scrollbar {
  height: 6px;
}
.hq-thumbs-track::-webkit-scrollbar-track {
  background: #050a16;
}
.hq-thumbs-track::-webkit-scrollbar-thumb {
  background: #27456b;
  border-radius: 3px;
}

.hq-thumb-item {
  position: relative;
  flex-shrink: 0;
  width: 68px;
  height: 96px;
  border-radius: 5px;
  border: 2px solid #1c324e;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #091526;
}

.hq-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hq-thumb-num {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 0;
  background: rgba(3, 7, 15, 0.85);
  color: #a4bedb;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.hq-thumb-item:hover {
  border-color: #5bbde8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hq-thumb-item.active {
  border-color: #79e6ff;
  box-shadow: 0 0 14px rgba(121, 230, 255, 0.55);
}

.hq-thumb-item.active .hq-thumb-num {
  background: rgba(121, 230, 255, 0.9);
  color: #030814;
}

/* Responsividade e Telas Pequenas */
@media (max-width: 768px) {
  .hq-modal { padding: 4px; }
  .hq-modal-window { width: 100vw; height: 100svh; border-radius: 0; border: none; }
  .hq-header { padding: 6px 10px; }
  .hq-header-left { gap: 8px; }
  .hq-logo-badge { display: none; }
  .hq-page-viewport { padding: 8px 12px; }
  .hq-nav-arrow { width: 36px; height: 60px; font-size: 14px; }
  .hq-nav-prev { left: 4px; }
  .hq-nav-next { right: 4px; }
  .hq-footer-controls { padding: 6px 10px; gap: 8px; }
  .hq-page-slider-wrap { max-width: none; }
  .hq-page-indicator { min-width: 80px; font-size: 11px; }
  .hq-zoom-group { display: none; }
  .hq-mode-btn { display: none; }
}
