/* CSS adicional para melhorar o comportamento mobile das tabelas */

@media screen and (max-width: 768px) {
  /* Layout e banner mobile */
  .banner-lp {
    margin: 0 -15px;
  }
  .wrapper {
  }

  /* Formulário de busca mobile */
  .form-search {
    width: 70% !important;
    margin: 20px !important;
  }

  .row-lp {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  /* Botão de print ajustado para mobile */
  .CT_envie_proj {
    width: unset !important;
    text-align: left;
    margin: 20px;
  }
  .print_link {
    font-size: 14px !important;
    padding: 12px 16px !important;
    justify-content: center;
    width: 75%;
    color: #fff !important;
    background-color: #f3911d !important;
    font-weight: normal !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    margin-left: 21px;
  }

  .print-text {
    color: #fff !important;
    font-weight: normal !important;
  }

  .img-link {
    width: 22px !important;
    height: 23px !important;
  }

  /* Menu de categorias responsivo - duas colunas */
  .menu-select ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .menu-select li {
    margin: 0;
  }

  .menu-select li a {
    font-size: 14px;
    padding: 8px 12px;
    display: block;
    text-align: center;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    color: #707070 !important;
    font-weight: normal !important;
  }

  /* Posicionamento específico para alinhamento correto */
  .menu-select li:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }
  .menu-select li:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }
  .menu-select li:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
  }
  .menu-select li:nth-child(4) {
    grid-column: 1;
    grid-row: 4;
  }
  .menu-select li:nth-child(5) {
    grid-column: 2;
    grid-row: 1;
  }
  .menu-select li:nth-child(6) {
    grid-column: 2;
    grid-row: 2;
  }
  .menu-select li:nth-child(7) {
    grid-column: 2;
    grid-row: 3;
  }

  /* Títulos das seções mobile */
  h2 {
    font-size: 24px;
    margin: 20px 0 15px 0;
    color: #87868a !important;
    font-weight: normal !important;
  }

  /* Título principal da tabela de preços mobile */
  .title--table-precos {
    font-size: 30px !important;
    color: #707070 !important;
    font-weight: bold !important;
    margin: 50px auto 20px 20px !important;
  }

  /* Tabelas específicas com largura fixa para scroll */
  #Fotolivros,
  #Scrapbook,
  table[id*="capaRevestida"],
  table[id*="Decoracao"],
  table[id*="Fotopresentes"],
  #Fotos {
    min-width: 550px;
    width: auto;
  }

  /* Células específicas da tabela com largura mínima */
  #Fotolivros .table_interna .modelos,
  #Fotolivros .modelos {
    min-width: 140px;
  }

  #Fotolivros .table_interna .tamanhos,
  #Fotolivros .tamanhos {
    min-width: 110px;
  }

  #Fotolivros .table_interna .val_qtd_paginas,
  #Fotolivros .val_qtd_paginas {
    min-width: 100px;
  }

  #Fotolivros .table_interna .val_pag_extra,
  #Fotolivros .val_pag_extra {
    min-width: 100px;
  }

  /* Scrapbook mobile */
  #Scrapbook .table_interna .modelos,
  #Scrapbook .modelos {
    min-width: 140px;
  }

  #Scrapbook .table_interna .tamanhos,
  #Scrapbook .tamanhos {
    min-width: 110px;
  }

  #Scrapbook .table_interna .val_qtd_paginas,
  #Scrapbook .val_qtd_paginas {
    min-width: 100px;
  }

  /* Ajustes na tabela interna */
  .table_interna {
    width: 100%;
  }

  .informacoes_internas {
    width: 100%;
  }

  /* Lightbox ajustado para mobile */
  .holder-lightbox {
    padding: 60px 20px;
    width: 90%;
    max-width: 400px;
    font-size: 140%;
  }

  .barra-area {
    width: 100%;
    max-width: 280px;
  }

  /* Garante que o body permita scroll horizontal */
  body {
    overflow-x: hidden;
  }

  /* Wrapper principal responsivo */
  .wrapper {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Container das tabelas */
  .container-tabela-precos {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Wrapper para scroll horizontal das tabelas */
  .table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  }

  /* Tabelas com largura mínima para scroll */
  .table-scroll-wrapper table {
    min-width: 550px;
    width: auto;
    margin: 0;
  }

  /* Regra geral para células mais compactas */
  .table-scroll-wrapper td,
  .table-scroll-wrapper th {
    line-height: 1.2;
    padding: 8px 6px !important;
    vertical-align: middle;
  }

  /* Células com larguras mínimas maiores */
  .table-scroll-wrapper .modelos {
    min-width: 140px !important;
    white-space: nowrap;
    text-align: left;
  }

  .table-scroll-wrapper .tamanhos {
    min-width: 110px !important;
    white-space: nowrap;
    text-align: center;
  }

  .table-scroll-wrapper .val_qtd_paginas,
  .table-scroll-wrapper .val_pag_extra {
    min-width: 100px !important;
    white-space: nowrap;
    text-align: center;
  }

  /* Subtítulos das tabelas */
  .table-scroll-wrapper .sub-titulo td {
    padding: 8px 6px !important;
    font-size: 13px;
  }

  /* Garante que células .modelos fiquem visíveis na tabela flat */
  .table-scroll-wrapper td.modelos {
    display: table-cell !important;
  }

  .table-scroll-wrapper td.titulo_produto.modelos {
    display: table-cell !important;
    width: auto !important;
    vertical-align: middle;
  }

  /* Produtos */
  .table-scroll-wrapper .titulo_produto {
    padding: 12px 8px !important;
    font-size: 14px;
    text-align: left;
  }

  .table-scroll-wrapper .titulo_produto p {
    font-size: 11px;
    margin: 4px 0 0 0;
  }

  .table-scroll-wrapper .titulo_produto a {
    font-size: 11px;
  }

  /* Ajustes nos preços */
  .table-scroll-wrapper .container_preco {
    font-size: 12px;
    padding: 6px 4px;
    text-align: center;
  }

  /* Informações internas */
  .table-scroll-wrapper .informacoes_internas td {
    padding: 8px 6px !important;
  }

  /* Tamanhos dos produtos */
  .table-scroll-wrapper .cont_tamanho {
    font-size: 12px;
    padding: 6px;
    text-align: center;
  }

  .table-scroll-wrapper .cont_tamanho small {
    font-size: 11px;
  }

  /* Estilização melhorada da scrollbar */
  .table-scroll-wrapper::-webkit-scrollbar {
    height: 6px;
  }

  .table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f8f8f8;
    border-radius: 3px;
  }

  .table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #f3911d, #e6850c);
    border-radius: 3px;
  }

  .table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #e6850c, #d67809);
  }

  /* Ajustes nos links "Saiba mais" */
  .table-scroll-wrapper a[href*="/"] {
    color: #c87333;
    font-weight: normal;
  }

  /* Garantir que bordas das células fiquem visíveis */
  .table-scroll-wrapper td {
    border: 1px solid #ececec !important;
  }

  .table-scroll-wrapper .sub-titulo td {
    border: 2px solid #fff !important;
    background-color: #f3911d;
  }

  /* Shadow nas laterais para indicar scroll */
  .table-scroll-wrapper {
    background:
      linear-gradient(
          90deg,
          rgba(255, 255, 255, 1) 0%,
          rgba(255, 255, 255, 0) 10%
        )
        left,
      linear-gradient(
          270deg,
          rgba(255, 255, 255, 1) 0%,
          rgba(255, 255, 255, 0) 10%
        )
        right,
      #fff;
    background-repeat: no-repeat;
    background-size:
      15px 100%,
      15px 100%,
      100% 100%;
    background-attachment: local, local, scroll;
  }
}

/* Ajustes para tablets em orientação portrait */
@media screen and (max-width: 1024px) and (min-width: 769px) {
  .wrapper {
    padding: 0 20px;
  }

  .form-search {
    width: 100%;
    max-width: 400px;
  }

  .table-scroll-wrapper {
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  }
}
