/* Estilo DOS Anos 90 */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap');

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background: #000080;
  color: #00FF00;
  text-align: center;
  padding: 10px;
  margin: 0;
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #00FF00 #000080;
}

.container {
  max-width: 95%;
  margin: auto;
  background: #000;
  border: 3px solid #00FF00;
  padding: 15px;
  box-shadow: 
    0 0 20px #00FF00,
    inset 0 0 20px rgba(0,255,0,0.2);
  position: relative;
  height: calc(100vh - 20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.container::before {
  content: "╔══════════════════════════════════════════════════════════════╗";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  color: #00FF00;
  font-size: 12px;
  text-align: center;
  background: #000;
  padding: 0 10px;
}

.container::after {
  content: "╚══════════════════════════════════════════════════════════════╝";
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  color: #00FF00;
  font-size: 12px;
  text-align: center;
  background: #000;
  padding: 0 10px;
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 20px;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.left-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.right-column {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chart-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  margin-top: 15px;
}

.chart-section h1 {
  color: #FFFF00;
  text-shadow: 0 0 10px #FFFF00;
  font-size: 20px;
  margin: 0 0 15px 0;
  letter-spacing: 2px;
}

.news-sidebar {
  background: #000080;
  border: 2px solid #FFFF00;
  padding: 12px;
  position: relative;
  box-shadow: 0 0 15px rgba(255,255,0,0.3);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.news-sidebar h3 {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #00FFFF;
  border-bottom: 1px solid #00FFFF;
  padding-bottom: 5px;
  text-align: left;
  flex-shrink: 0;
}

.news-container {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #00FF00 #000080;
}

.news-container::-webkit-scrollbar {
  width: 12px;
}

.news-container::-webkit-scrollbar-track {
  background: #000080;
  border: 1px solid #00FF00;
}

.news-container::-webkit-scrollbar-thumb {
  background: #00FF00;
  border: 1px solid #000080;
}

.news-item {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px dotted #00FFFF;
  gap: 8px;
}

.news-item:last-child {
  border-bottom: none;
}

.news-item::before {
  content: "►";
  color: #FFFF00;
  font-size: 10px;
  margin-right: 5px;
  align-self: flex-start;
  margin-top: 2px;
}

.news-image {
  flex-shrink: 0;
  width: 50px;
  height: 35px;
  border: 1px solid #00FFFF;
  overflow: hidden;
  background: #000080;
}

.news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.2) brightness(0.8);
}

.news-content {
  flex: 1;
  min-width: 0;
}

.news-content a {
  text-decoration: none;
  color: #FFFFFF;
  font-size: 12px;
  line-height: 1.3;
  display: block;
  word-wrap: break-word;
  text-align: left;
}

.news-content a:hover {
  color: #FFFF00;
  text-shadow: 0 0 5px #FFFF00;
}

.news-date {
  font-size: 10px;
  color: #00FFFF;
  margin-top: 2px;
  text-align: left;
}

.news-loading {
  text-align: center;
  color: #FFFF00;
  font-size: 12px;
  padding: 20px;
}

.news-loading::before {
  content: "░░░ CARREGANDO ░░░";
  display: block;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.news-error {
  text-align: center;
  color: #FF0000;
  font-size: 12px;
  padding: 20px;
  border: 1px solid #FF0000;
  background: rgba(255,0,0,0.1);
}

.news-error::before {
  content: "⚠ ERRO NO SISTEMA ⚠";
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
}

.load-more-container {
  text-align: center;
  padding: 10px 0;
  border-top: 1px dotted #00FFFF;
  margin-top: 10px;
}

.load-more-btn {
  background: #000080;
  border: 2px solid #00FF00;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  color: #00FF00;
  font-family: 'Courier Prime', monospace;
  transition: all 0.2s ease;
  position: relative;
  min-width: 120px;
}

.load-more-btn:hover:not(:disabled) {
  background: #00FF00;
  color: #000080;
  box-shadow: 0 0 10px #00FF00;
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #000080;
  color: #666;
}

.load-more-btn::before {
  content: "[";
  margin-right: 5px;
}

.load-more-btn::after {
  content: "]";
  margin-left: 5px;
}

@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .right-column {
    order: -1;
  }
  
  .news-sidebar {
    height: 120px;
  }
  
  .chart-section {
    margin-top: 10px;
  }
  
  .container::before,
  .container::after {
    font-size: 8px;
  }
  
  .chart-section h1 {
    font-size: 16px;
    margin: 0 0 10px 0;
  }

  .chart-container {
    min-height: 250px;
    max-height: calc(100vh - 250px);
  }

  .filter-btn {
    font-size: 10px;
    padding: 4px 8px;
  }
  
  /* Ajustes dos anúncios para mobile */
  .ad-container {
    margin: 8px 0;
    padding: 5px;
  }
  
  .header-ad, .chart-bottom-ad {
    margin: 10px 0;
  }
  
  .sidebar-ad, .sidebar-ad-bottom {
    margin: 5px 0;
    padding: 3px;
  }
  
  .ad-label {
    font-size: 7px;
  }
  
  /* Ajustes para o toggle em mobile */
  .toggle-btn {
    font-size: 7px;
    padding: 1px 4px;
    min-width: 18px;
  }
  
  .ad-header {
    margin-bottom: 3px;
  }
  
  /* Header responsivo para mobile */
  .header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .system-info {
    min-width: auto;
    width: 100%;
  }
  
  .dos-header .header-ad {
    flex: none;
    width: 100%;
    max-width: 300px;
    margin-top: 10px;
  }
}

canvas {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 300px); /* Limita altura máxima baseada na viewport */
  border: 2px solid #00FF00;
  background: #000;
  box-shadow: 0 0 15px rgba(0,255,0,0.3);
}

.chart-container {
  flex: 1;
  min-height: 200px;
  max-height: calc(100vh - 300px);
  position: relative;
  overflow: hidden;
}

.filter-buttons {
  margin-bottom: 15px;
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.filter-btn {
  background: #000080;
  border: 2px solid #FFFF00;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  font-family: 'Courier Prime', monospace;
  color: #FFFF00;
  transition: all 0.2s ease;
  position: relative;
}

.filter-btn:hover {
  background: #FFFF00;
  color: #000080;
  box-shadow: 0 0 10px #FFFF00;
}

.filter-btn.active {
  background: #00FF00;
  border-color: #00FF00;
  color: #000;
  box-shadow: 0 0 15px #00FF00;
}

.filter-btn::before {
  content: "[";
  margin-right: 3px;
}

.filter-btn::after {
  content: "]";
  margin-left: 3px;
}

.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #000080;
  border: 3px solid #00FF00;
  padding: 30px;
  box-shadow: 0 0 20px #00FF00;
  z-index: 1000;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #000080;
  border-top: 3px solid #00FF00;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading p {
  margin: 0;
  color: #00FF00;
  font-size: 12px;
  font-family: 'Courier Prime', monospace;
  animation: blink 1s infinite;
}

.error-message {
  background: #800000;
  border: 2px solid #FF0000;
  color: #FFFF00;
  padding: 15px 20px;
  margin: 20px 0;
  display: none;
  text-align: center;
  font-size: 12px;
  font-family: 'Courier Prime', monospace;
  box-shadow: 0 0 15px rgba(255,0,0,0.5);
}

.error-message::before {
  content: "⚠ ERRO CRITICO ⚠";
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: #FF0000;
  animation: blink 0.5s infinite;
}

.creditos {
  margin-top: 20px;
  font-size: 10px;
  color: #00FFFF;
  font-family: 'Courier Prime', monospace;
  border-top: 1px dotted #00FFFF;
  padding-top: 10px;
}

/* Efeito CRT adicional */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,255,0,0.03) 2px,
      rgba(0,255,0,0.03) 4px
    );
  pointer-events: none;
  z-index: 1000;
}

/* Efeito de texto digitando */
.typing-effect {
  border-right: 2px solid #00FF00;
  animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
  0%, 50% { border-color: #00FF00; }
  51%, 100% { border-color: transparent; }
}

/* Estilos do cabeçalho e rodapé DOS */
.dos-header {
  text-align: left;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.system-info {
  flex: 1;
  min-width: 250px;
}

.dos-header .header-ad {
  flex: 0 0 250px;
  margin: 0;
  padding: 8px;
  border: 2px solid #FFFF00;
  background: rgba(255,255,0,0.05);
  box-shadow: 0 0 10px rgba(255,255,0,0.3);
  align-self: flex-start;
}

.dos-header .header-ad .ad-label {
  color: #FFFF00;
  text-shadow: 0 0 5px #FFFF00;
  font-size: 8px;
  margin-bottom: 5px;
}

.dos-footer {
  margin-top: 10px;
  text-align: center;
  flex-shrink: 0;
}

/* Barra de teclas de função */
.function-keys-bar {
  background: #000080;
  border: 1px solid #00FFFF;
  padding: 5px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  margin-bottom: 8px;
}

.function-key {
  color: #00FFFF;
  background: #000040;
  padding: 2px 6px;
  border: 1px solid #00FFFF;
  white-space: nowrap;
  cursor: help;
  transition: all 0.2s ease;
}

.function-key:hover {
  background: rgba(0,255,255,0.1);
  box-shadow: 0 0 5px rgba(0,255,255,0.3);
  text-shadow: 0 0 3px #00FFFF;
}

/* Responsivo para barra de funções */
@media (max-width: 768px) {
  .function-keys-bar {
    font-size: 7px;
    gap: 4px;
    padding: 3px;
  }
  
  .function-key {
    padding: 1px 4px;
  }
}

/* Efeito de tela CRT adicional */
.container {
  position: relative;
}

.container::before {
  content: "╔══════════════════════════════════════════════════════════════╗";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  color: #00FF00;
  font-size: 12px;
  text-align: center;
  background: #000080;
  padding: 0 10px;
  z-index: 10;
}

.container::after {
  content: "╚══════════════════════════════════════════════════════════════╝";
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  color: #00FF00;
  font-size: 12px;
  text-align: center;
  background: #000080;
  padding: 0 10px;
  z-index: 10;
}

/* Estilo para anúncios no tema DOS */
.ad-container {
  margin: 10px 0;
  padding: 8px;
  border: 2px solid #00FFFF;
  background: rgba(0,0,255,0.1);
  position: relative;
  box-shadow: 0 0 10px rgba(0,255,255,0.3);
}

.ad-label {
  color: #00FFFF;
  font-size: 8px;
  text-align: center;
  margin-bottom: 5px;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 5px #00FFFF;
}

.header-ad {
  border-color: #FFFF00;
  background: rgba(255,255,0,0.05);
  box-shadow: 0 0 10px rgba(255,255,0,0.3);
}

.header-ad .ad-label {
  color: #FFFF00;
  text-shadow: 0 0 5px #FFFF00;
}

.sidebar-ad, .sidebar-ad-bottom {
  margin: 8px 0;
  border: 1px dotted #00FFFF;
  padding: 5px;
  background: rgba(0,255,255,0.05);
}

.sidebar-ad .ad-label, .sidebar-ad-bottom .ad-label {
  font-size: 7px;
  color: #00FFFF;
}

.chart-bottom-ad {
  border-color: #00FF00;
  background: rgba(0,255,0,0.05);
  box-shadow: 0 0 10px rgba(0,255,0,0.3);
  margin-top: 15px;
}

.chart-bottom-ad .ad-label {
  color: #00FF00;
  text-shadow: 0 0 5px #00FF00;
}

/* Estilos para anúncios recolhíveis (toggleable) */
.toggleable-ad {
  transition: all 0.3s ease;
  overflow: hidden;
}

.toggleable-ad.collapsed {
  max-height: 35px;
}

.toggleable-ad.collapsed .ad-content {
  display: none;
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.toggle-btn {
  background: transparent;
  border: 1px solid #00FF00;
  color: #00FF00;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 8px;
  font-family: 'Courier Prime', monospace;
  transition: all 0.2s ease;
  border-radius: 0;
  min-width: 20px;
}

.toggle-btn:hover {
  background: rgba(0,255,0,0.1);
  box-shadow: 0 0 5px rgba(0,255,0,0.3);
  text-shadow: 0 0 3px #00FF00;
}

.toggle-btn:active {
  transform: scale(0.95);
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  font-weight: bold;
}

.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.ad-content {
  transition: opacity 0.3s ease;
}

.collapsed .ad-content {
  opacity: 0;
}

/* Estilos para sistema de navegação por teclado DOS */
.dos-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  font-family: 'Courier Prime', monospace;
}

.dos-modal-overlay {
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.dos-modal-window {
  background: #000080;
  border: 3px solid #00FF00;
  box-shadow: 
    0 0 20px #00FF00,
    inset 0 0 20px rgba(0,255,0,0.2);
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  color: #FFFFFF;
}

.dos-modal-header {
  background: #00FF00;
  color: #000000;
  padding: 8px 15px;
  font-weight: bold;
  text-align: center;
  font-size: 14px;
}

.dos-modal-content {
  padding: 20px;
  line-height: 1.4;
}

.dos-modal-footer {
  background: #00FF00;
  color: #000000;
  padding: 5px 15px;
  text-align: center;
  font-size: 12px;
}

.dos-modal-close {
  text-align: center;
  color: #FFFF00;
  font-size: 10px;
  padding: 10px;
  border-top: 1px dotted #00FFFF;
  margin-top: 15px;
}

.help-section, .info-section {
  margin-bottom: 20px;
}

.help-title, .info-title {
  color: #FFFF00;
  font-weight: bold;
  margin-bottom: 8px;
  text-decoration: underline;
}

.help-item, .info-item {
  color: #FFFFFF;
  margin-bottom: 3px;
  padding-left: 10px;
}

.help-item::before {
  content: "• ";
  color: #00FFFF;
  font-weight: bold;
}

.info-item::before {
  content: "> ";
  color: #00FF00;
  font-weight: bold;
}

/* Mensagens de status */
.status-message {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #000080;
  border: 2px solid #FFFF00;
  color: #FFFF00;
  padding: 8px 16px;
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  z-index: 8888;
  box-shadow: 0 0 15px rgba(255,255,0,0.5);
  animation: status-fade-in 0.3s ease-in;
}

@keyframes status-fade-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsivo para modais */
@media (max-width: 768px) {
  .dos-modal-window {
    max-width: 95%;
    margin: 10px;
  }
  
  .dos-modal-content {
    padding: 15px;
  }
  
  .help-item, .info-item {
    font-size: 11px;
  }
  
  .status-message {
    bottom: 10px;
    right: 10px;
    left: 10px;
    font-size: 11px;
    text-align: center;
  }
}

/* Estilos para navegação no gráfico */
.chart-point-highlight {
  animation: highlight-pulse 1s infinite;
}

@keyframes highlight-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
}

.chart-navigation-indicator {
  animation: indicator-blink 1.5s infinite;
}

@keyframes indicator-blink {
  0%, 70% {
    opacity: 1;
  }
  85%, 100% {
    opacity: 0.3;
  }
}

/* Melhorias no canvas para navegação */
#ipcaChart {
  outline: none;
}

#ipcaChart:focus {
  box-shadow: 0 0 20px rgba(255,255,0,0.5);
}

/* Indicador de modo de navegação ativo */
.chart-container.navigation-active {
  position: relative;
}

.chart-container.navigation-active::before {
  content: "⌨️ NAVEGAÇÃO ATIVA";
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(255,255,0,0.9);
  color: #000;
  padding: 3px 8px;
  font-size: 9px;
  font-family: 'Courier Prime', monospace;
  border: 1px solid #000;
  z-index: 999;
  animation: navigation-indicator 2s infinite;
}

@keyframes navigation-indicator {
  0%, 100% {
    background: rgba(255,255,0,0.9);
  }
  50% {
    background: rgba(255,255,0,0.6);
  }
}

/* Tooltip customizado para navegação */
.chart-tooltip-enhanced {
  position: absolute;
  background: #000080;
  border: 2px solid #FFFF00;
  color: #FFFFFF;
  padding: 8px 12px;
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  z-index: 1002;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(255,255,0,0.5);
}

.chart-tooltip-enhanced::before {
  content: "█ DADOS DO PONTO █";
  display: block;
  color: #FFFF00;
  text-align: center;
  margin-bottom: 5px;
  font-weight: bold;
}

/* Responsivo para navegação do gráfico */
@media (max-width: 768px) {
  .chart-navigation-indicator {
    font-size: 8px;
    padding: 3px 6px;
    top: 5px;
    right: 5px;
  }
  
  .chart-container.navigation-active::before {
    font-size: 7px;
    padding: 2px 5px;
  }
  
  .chart-point-highlight {
    width: 12px !important;
    height: 12px !important;
    margin-left: -2px;
    margin-top: -2px;
  }
}

.adsbygoogle {
  border: 1px dotted #00FFFF !important;
  background: rgba(0,0,0,0.3) !important;
  min-height: 100px;
  display: block !important;
}

.footer-sticky-ad {
  border-color: #FF00FF;
  background: rgba(255,0,255,0.1);
  box-shadow: 0 0 15px rgba(255,0,255,0.4);
  margin: 10px 0;
  position: sticky;
  bottom: 0;
  z-index: 1000;
}

.footer-sticky-ad .ad-label {
  color: #FF00FF;
  text-shadow: 0 0 8px #FF00FF;
  animation: glow-purple 2s ease-in-out infinite alternate;
}

@keyframes glow-purple {
  from {
    text-shadow: 0 0 8px #FF00FF;
  }
  to {
    text-shadow: 0 0 15px #FF00FF, 0 0 20px #FF00FF;
  }
}

/* Estilos personalizados para a legenda do Chart.js */
.chart-container canvas {
  cursor: crosshair;
}

/* Melhorar visibilidade dos tooltips */
.chartjs-tooltip {
  font-family: 'Courier Prime', monospace !important;
}

/* Monitor de RAM */
#ramUsage {
  font-weight: bold;
  transition: color 0.3s ease;
}
