/* ============================================================
   RESPONSIVE LAYOUT - Ajustes para Telas Menores que 1750px
   ============================================================ */

/* Media query principal para responsividade */
@media (max-width: 1750px) {
  
  /* ============================================================
     AJUSTES NO CONTAINER PRINCIPAL
     ============================================================ */
  .container-principal {
    display: block !important;
    position: relative !important;
    width: 100vw !important;
    height: 100vh !important;
    padding-top: 0 !important; /* Removido pois a coluna-2 já tem top: 60px */
  }

  /* ============================================================
     COLUNA 1 - MENU LATERAL (MOBILE)
     ============================================================ */
  .coluna.coluna-1,
  .coluna-1 {
    position: fixed !important;
    top: 60px !important;
    left: -280px !important;
    width: 280px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1002 !important;
    transform: none !important;
    margin: 0 !important;
    background: #f8f8f8 !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
  }

  .coluna-1.ativo {
    left: 0 !important;
  }

  /* ============================================================
     COLUNA 2 - CONTEÚDO PRINCIPAL (SEMPRE VISÍVEL)
     ============================================================ */
  .coluna.coluna-2,
  .coluna-2,
  main.coluna.coluna-2 {
    position: absolute !important;
    top: 60px !important; /* Margem para o navbar */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: calc(100vh - 60px) !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 1 !important;
    transform: none !important;
    background: transparent !important;
    overflow: hidden !important;
  }

  /* Garantir que o conteúdo dinâmico ocupe todo o espaço */
  #conteudo-dinamico,
  .conteudo-dinamico {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: auto !important;
  }

  /* ============================================================
     COLUNA 3 - RANKINGS (MOBILE)
     ============================================================ */
  .coluna.coluna-3,
  .coluna-3 {
    position: fixed !important;
    top: 60px !important;
    right: -300px !important;
    width: 300px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1002 !important;
    transform: none !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
  }

  .coluna-3.ativo {
    right: 0 !important;
  }

  /* ============================================================
     AJUSTES ESPECÍFICOS PARA CONFLITOS DE CSS
     ============================================================ */
  
  /* Sobrescrever estilos conflituosos do coluna_central_inicial.css */
  html, body {
    overflow: visible !important; /* Permitir scroll quando necessário */
  }

  /* Ajustes para grid-linha1 e grid-linha2 */
  .grid-linha1,
  .grid-linha2 {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
    padding: 15px !important;
  }

  .grid-linha1 {
    grid-template-columns: 1fr !important;
    margin-bottom: 20px !important;
  }

  /* Ajustes para elementos que possam ter position fixed conflitante */
  .menu-mobile {
    display: block !important;
  }

  .btn-toggle-filtros-eventos,
  .btn-toggle-filtros-noticias,
  .btn-toggle-filtros-analises,
  .btn-toggle-filtros-lancamentos {
    display: inline-block !important;
    margin-bottom: 10px !important;
  }

  /* ============================================================
     PERFORMANCE E ANIMAÇÕES
     ============================================================ */
  
  /* Melhorar performance das transições */
  .coluna-1,
  .coluna-3 {
    will-change: transform, left, right !important;
    backface-visibility: hidden !important;
  }

  /* Suavizar scroll em dispositivos móveis */
  .coluna-1,
  .coluna-3,
  #conteudo-dinamico {
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
  }

  /* ============================================================
     AJUSTES PARA IFRAME E LAZY LOADING
     ============================================================ */
  
  /* Garantir que iframes se ajustem corretamente */
  .coluna-2 iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
  }

  /* Loading spinner responsivo */
  #loading-spinner {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10 !important;
  }

  /* Placeholder responsivo */
  .conteudo-placeholder {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    text-align: center !important;
    padding: 20px !important;
  }

  .conteudo-placeholder i {
    font-size: 48px !important;
    margin-bottom: 16px !important;
    color: #ccc !important;
  }

  .conteudo-placeholder p {
    font-size: 16px !important;
    color: #666 !important;
    margin: 0 !important;
  }
}

/* ============================================================
   AJUSTES PARA TELAS MUITO PEQUENAS (< 480px)
   ============================================================ */
@media (max-width: 480px) {
  .coluna-1 {
    width: 100vw !important;
    left: -100vw !important;
  }
  
  .coluna-1.ativo {
    left: 0 !important;
  }
  
  .coluna-3 {
    width: 100vw !important;
    right: -100vw !important;
  }
  
  .coluna-3.ativo {
    right: 0 !important;
  }

  .navbar-mobile {
    padding: 0 10px !important;
  }
}

/* ============================================================
   AJUSTES PARA TABLETS E TELAS MÉDIAS (481px - 768px)
   ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
  /* Garantir que a coluna-3 apareça corretamente em tablets */
  .coluna.coluna-3,
  .coluna-3 {
    position: fixed !important;
    top: 60px !important;
    right: -350px !important; /* Largura um pouco maior para tablets */
    width: 350px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1002 !important;
    transform: none !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1) !important;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    display: block !important; /* Forçar exibição */
  }

  .coluna-3.ativo {
    right: 0 !important;
  }

  /* Garantir que o botão ranking funcione */
  .ranking-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* ============================================================
   AJUSTES PARA TABLETS LANDSCAPE (769px - 1024px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Coluna-3 para tablets em landscape */
  .coluna.coluna-3,
  .coluna-3 {
    position: fixed !important;
    top: 60px !important;
    right: -400px !important; /* Largura ainda maior para tablets landscape */
    width: 400px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1002 !important;
    display: block !important;
    visibility: visible !important;
  }

  .coluna-3.ativo {
    right: 0 !important;
  }
}
