/* Área de conteúdo Markdown (rolagem horizontal em tabelas largas) */
/* Área principal */
body {
    background-color: #0f2e46;
}
.chat-main {
 /* position: relative;*/
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #0f2e46;
  color: white;
  width: 100%;
  /*z-index: 0;*/
}

.chat-main::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("/media/imagens/admin/fluxoia.png");
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.1; /* transparência só na imagem */
  z-index: -1;
}


.conteudo.markdown {
    font-size: 15px;
    line-height: 1.5;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 7px;
    color: rgb(197 195 188);
    
}

/* Tabelas */
.conteudo.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8rem 0;
    table-layout: fixed;          /* colunas proporcionais */
    min-width: 500px;             /* evita colunas espremidas */
}

.conteudo.markdown th,
.conteudo.markdown td {
    border: 1px solid #ccc;
    padding: 8px;
    vertical-align: middle;
    overflow-wrap: break-word;    /* quebra conteúdos longos */
    word-wrap: break-word;
}

.conteudo.markdown th {
    background-color: #0078d4;
    color: #fff;
    font-weight: 600;
    text-align: center;         /* evita quebra no cabeçalho */
}

.conteudo.markdown td:first-child {
    text-align: left;             /* nomes na primeira coluna */
}

.conteudo.markdown td:not(:first-child) {            /* números alinhados à direita */
    font-variant-numeric: tabular-nums; /* dígitos alinhados */
}

.conteudo.markdown tbody tr:nth-child(even) {
    background-color: #141d31;     /* zebra */
}

/* Código inline */
.conteudo.markdown code {
    background: #f4f4f5;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.95rem;
    color: #d63384;
}

/* Blocos de código */
.conteudo.markdown pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.conteudo.markdown pre code {
    display: block;
    padding: 12px;
    background: #1e1e1e;
    color: #f8f8f2;
    border-radius: 6px;
    font-family: "Fira Code", monospace;
    font-size: 0.9rem;

    /* 🔑 Ajustes para códigos longos */
    white-space: pre-wrap;   /* mantém formatação mas permite quebra de linha */
    word-wrap: break-word;   /* quebra palavras muito longas */
    overflow-x: auto;        /* adiciona scroll horizontal se ainda precisar */
}


/* ---------------- Layout do chat ---------------- */

.chat-wrapper {
    display: flex;
    height: 90vh;
    font-family: Arial, sans-serif;
    background-color: #f5f6f8;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #011121;
    color: #fff;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 500px){
    .sidebar {
       
    }
    .chat-wrapper {
    height: 90vh;
}
}
.sidebar h3 { margin-bottom: 1rem; }
.lista-sessoes {
    list-style: none;
    padding: 5px;
    flex: 1;
    overflow-y: auto;
    width: 270px;
}

.lista-sessoes li { margin-bottom: 0.5rem; }
.lista-sessoes li.ativo a {
    font-weight: bold;
    color: #00b4d8;
}
.lista-sessoes a {
    text-decoration: none;
    color: #ccc;
    transition: color 0.3s;
}
.lista-sessoes a:hover { color: #fff; }
.vazio { font-size: 0.9rem; color: #999; }
.btn-nova {
    background-color: #00b4d8;
    color: white;
    text-align: center;
    padding: 0.5rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
}
.btn-nova:hover { background-color: #0096c7; }

.historico {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    width: 80%;
    overflow-y: scroll;   /* mantém a rolagem */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge antigo */
}

@media (max-width: 700px) {
    .historico{
        width: 95%;
    }
    }
/* Chrome, Safari, Edge moderno */
::-webkit-scrollbar {
  display: none;
}

/* Formulário */
.form-mensagem {
    display: flex;
    padding: 1rem;
    background-color: #021321;
    color: white;
    gap: 0.5rem;
    width: 80%;
    flex-direction: column;
    border-radius: 30px;
}
.form-mensagem select{
    padding: 8px; 
    border-radius: 5px; 
    background-color: #021321;
    color: wheat;
}
@media (max-width: 430px) {
    .form-mensagem select{
        width: 40%;
    }
    .form-mensagem{
        width: 88%;
        border-radius: 30px;
    }
    }
.form-mensagem textarea {
    flex: 1;
    height: 80px;
    resize: vertical;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    font-size: 15px;
    border-radius: 20px;
    background-color: #021321;
    color: white;
    border: none;
    outline: none;
}

.form-mensagem button {
    padding: 0.6rem 1.2rem;
    background-color: #00b4d8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 20px;
}
.form-mensagem button:hover { background-color: #0096c7; }

/* Mensagens */
/* Container geral das mensagens */
.msg {
    margin-bottom: 1rem;
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;       /* Quebra palavras longas */
    
    box-shadow: 01px 5px 5px 6px #0f1012;
    
}

/* Remetente (nome acima da mensagem) */
.msg .remetente {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.85rem;
    opacity: 0.85;
}

/* Mensagem do usuário */
.msg.user {
    background-color: #1e273d;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.msg.user .conteudo.markdown.user {          /* Mantém quebras de linha */
    overflow-wrap: break-word;
}
.msg.user .conteudo.markdown.user ol {
    white-space: normal;           /* Mantém quebras de linha */
}

.msg.user .conteudo.markdown.user li {
    white-space: normal;           /* Mantém quebras de linha */
}

/* Mensagem da IA */
.msg.assistant {
    background-color: #061b2b;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.msg.assistant .conteudo.markdown.assistant {
   /* white-space: pre-wrap;*/
    overflow-wrap: break-word;
    text-align: left;
}
.msg.assistant .conteudo.markdown.assistant ol {
    white-space: normal;           /* Recuo em listas */
}

.conteudo.markdown.assistant ul {
    white-space: normal;           /* Recuo em listas */
}
/* Melhor visual em telas pequenas */
@media (max-width: 600px) {
    .msg {
        max-width: 100%;
        font-size: 14px;
        padding: 0.6rem 0.8rem;
    }
}

img {
    max-width: 100%;
    height: 70px;
    border-radius: 4px;
}

.toggle-btn {
    display: inline-block;
    margin: 8px 0;
    padding: 6px 12px;
    background: #0f172a;
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.code-collapsed pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-top: 8px;
}
.code-collapsed[hidden] {
  display: none;
}
.code-collapsed {
  margin-top: 8px;
}

.code-collapsed pre input{ 
    border: 1px solid #303131;
    border-radius: 5px;
    padding: 20px;
    font-size: 15px;
    margin: 3px;
    width: auto;
}

.code-collapsed pre  select{ 
    border: 1px solid #303131;
    border-radius: 5px;
    padding: 20px;
    font-size: 15px;
    margin: 3px;
    width: auto;
}
.code-collapsed pre  h1{
    font-size: 24px;
}


  .dropdown {
    position: relative;
    display: inline-block;
  }

  .dropdown-content {
    display: none;
    position: fixed;
    box-shadow: 0px 8px 16px 0px rgba(3, 3, 3, 0.2);
    z-index: 1;
  }

  .dropdown:hover .dropdown-content {
    display: block;
  }

  .dropdown-content button {
    cursor: pointer;
    border: none;
    background: 0;
    font-size: 14px;
    text-align: left;
  }

  .dropdown-content button:hover {
    background-color: #053952;
  }
