/* ================= RESET E VARIÁVEIS ================= */
:root {
    --verde-escuro: #1b5e20;
    --verde-tema: #2e7d32;
    --azul-bot: #e3f2fd;
    --bg-dark: #0d1117;
    --glass-white: rgba(255, 255, 255, 0.85);
    --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ================= FUNDO (IGUAL À PÁGINA INICIAL) ================= */
body {
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
    /* Imagem de fundo com overlay escuro fixo */
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)),
                url('fundo.jpg') center/cover no-repeat fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

/* ================= BOTÕES FLUTUANTES (CIRCULARES E UNIFICADOS) ================= */
.controles-flutuantes {
    position: fixed;
    inset: 0; /* Ocupa a tela toda mas é invisível, serve apenas de container */
    pointer-events: none; /* Garante que cliques passem através do container */
    z-index: 1000;
}

.btn-circular {
    position: absolute;
    pointer-events: auto; /* Reativa cliques para os botões */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #000;
    background: linear-gradient(180deg, #2e7d32, #1b5e20);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    text-decoration: none; /* Para o link voltar */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-circular:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* Posicionamento Específico */
.btn-voltar {
    top: 20px;
    left: 20px;
    font-size: 32px; /* Ajuste leve para o ícone ↩ */
}

#floating-guia-btn {
    bottom: 20px;
    right: 20px;
    border: 3px solid #000; /* Garante que o botão HTML tenha a borda */
}

/* ================= CONTAINER PRINCIPAL (ESTILO GLASS) ================= */
.container {
 width: 95%;
    max-width: 1100px;
    background: var(--glass-white);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 28px;
    padding: 40px 25px; /* Mais respiro lateral */
    margin: 40px auto;  /* Diminuído o topo para não demorar a ver o chat */
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.4);
    display: flex;
    flex-direction: column;
}

/* Ajuste do Título e Descrição para acompanhar o tamanho */
.app-title { 
    font-size: 3rem; /* Título maior */
    text-align: center; 
    color: var(--verde-tema); 
    margin-bottom: 15px; 
    font-weight: 900; 
}

.descricao-app { 
    max-width: 800px; /* Mantém o texto centralizado e legível */
    margin: 0 auto 25px auto;
    text-align: center; 
    color: #333; 
    font-size: 1.1rem; /* Fonte levemente maior */
    line-height: 1.6; 
}

/* ================= RODAPÉ (MAIOR E MAIS VISÍVEL) ================= */
.rodape { 
    margin-top: auto; /* Empurra para o fim se sobrar espaço */
    padding: 30px 20px; 
    text-align: center; 
    color: rgba(255,255,255,0.9); /* Branco mais sólido */
    font-size: 1.1rem; /* Fonte aumentada de 14px para aprox 17px */
    width: 100%;
    background: rgba(0, 0, 0, 0.3); /* Fundo sutil para destacar o texto do papel de parede */
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.rodape span {
    font-weight: 500;
    letter-spacing: 0.5px;
}
/* ================= ÁREA DO CHAT (WHATSAPP STYLE DARK) ================= */
#chat {
    background: #161b22;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    border: 1px solid #30363d;
}

.chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 15px; background: #0d1117;
    border-bottom: 1px solid #30363d;
}

.chat-header img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--verde-tema); }
.chat-name { color: #e6edf3; font-weight: 600; font-size: 15px; }
.chat-status { color: var(--verde-tema); font-size: 12px; }

#chat-messages {
    padding: 20px;
    min-height: 300px;
    /* REMOVIDO: max-height e overflow-y fixa */
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: auto; /* Deixa o conteúdo empurrar o fundo do container */
}

.usuario {
    align-self: flex-end;
    background: #c8e6c9;
    color: #1b5e20;
    padding: 12px 18px;
    border-radius: 18px 18px 0 18px;
    max-width: 80%;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Bolha do Bot - Estrutura de Linha */
.msg-bot-wrapper {
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    gap: 15px;
    width: 100%; /* Permite que o wrapper use a largura total do chat */
    max-width: 95%; /* Evita que cole na borda direita, mas dá bastante espaço */
    margin-bottom: 25px;
}

.bot-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: 2px solid var(--verde-tema);
    background: white;
    flex-shrink: 0; /* Impede o avatar de amassar em telas pequenas */
    object-fit: cover;
}

.bot-bubble {
    background: var(--azul-bot);
    color: #0d47a1;
    /* Aumenta o respiro interno significativamente */
    padding: 10px; 
    border-radius: 20px 20px 20px 0;
    border-left: 6px solid #1565c0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    width: 100%;
    /* Melhora a leitura do texto */
    line-height: 1.6;
    font-size: 1rem;
}
/* Ajuste específico para as listas dentro da bolha */
.bot-bubble ul {
    margin: 10px 0;
    padding-left: 25px; /* Evita que os tópicos fiquem grudados na esquerda */
}

.bot-bubble li {
    margin-bottom: 8px; /* Espaço entre um sintoma e outro */
}

/* ================= CAMPO DE ENTRADA ================= */
.input-area {
    display: flex; gap: 10px; background: var(--white);
    padding: 10px; border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

input[type="text"] {
    flex: 1; padding: 12px; border: 1px solid #ddd;
    border-radius: 10px; outline: none; font-size: 1rem;
}

input[type="text"]:disabled { background: #f5f5f5; cursor: not-allowed; }

#btn-diagnosticar {
    background: var(--verde-tema); color: var(--white);
    border: none; padding: 0 20px; border-radius: 10px;
    font-weight: bold; cursor: pointer; transition: 0.2s;
}

#btn-diagnosticar:hover { background: var(--verde-escuro); }

/* ================= GUIA (MENU LATERAL) ================= */
#guia-menu {
    position: fixed; inset: auto auto 90px 20px;
    width: 380px; max-width: 90vw;
    background: var(--white); border-radius: 18px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    z-index: 2000; display: flex; flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hidden { display: none !important; opacity: 0; transform: translateY(20px); }

.guia-header {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    color: var(--white); padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 3px solid #ffd700;
}

.guia-title { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

.close-btn {
    background: rgba(255,255,255,0.2); border: none; color: var(--white);
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-weight: bold;
}

.guia-body { padding: 20px; overflow-y: auto; max-height: 70vh; flex: 1; }

/* Links de Contato no Guia */
.guia-footer-links { margin-top: 15px; }
.contact-link {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px; margin: 8px 0; border-radius: 10px; text-decoration: none;
    font-weight: bold; border: 1px solid var(--verde-tema); color: var(--verde-tema);
    background: #f1f8e9; transition: 0.2s;
}

.contact-link.whatsapp { background: #e8f5e9; border-color: #4caf50; }
.contact-link:hover { background: var(--verde-tema); color: var(--white); }

/* Elementos Dinâmicos do Guia (injetados pelo JS) */
.item-guia {
    background: #f9f9f9; border: 1px solid #eee; border-left: 4px solid var(--verde-escuro);
    padding: 10px 15px; margin-bottom: 8px; border-radius: 8px; cursor: pointer; transition: 0.2s;
}
.item-guia:hover { background: #f1f8e9; transform: translateX(3px); }
.item-guia strong { color: var(--verde-escuro); display: block; }
.item-guia span { color: #666; font-size: 0.85rem; }

/* Divisor e Aviso */
.divider { border: 0; border-top: 1px solid #eee; margin: 15px 0; }
.explanation-box { background: #fff3e0; border: 1px solid #ffe0b2; padding: 12px; border-radius: 8px; font-size: 0.85rem; color: #e65100; line-height: 1.4; }

/* ================= RODAPÉ E SPLASH ================= */
.rodape { margin: 20px 0; text-align: center; color: rgba(255,255,255,0.7); font-size: 14px; width: 100%; }

#splash {
    position: fixed; inset: 0; background: linear-gradient(135deg, #0b3d2e, #145c43);
    display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 99999;
}
.logo-splash { width: 150px; margin-bottom: 20px; animation: pulse 2s infinite ease-in-out; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } }
.texto-splash { color: var(--white); font-size: 18px; letter-spacing: 1px; }
/* Container do Card */
/* ================= CARD DE DIAGNÓSTICO ================= */

.doenca-card{
    background:#f8f8f8;
    border-radius:25px;
    overflow:hidden;
    border:1px solid #d8d8d8;
    box-shadow:0 10px 25px rgba(0,0,0,.15);
    padding:10px;
    
}

/* CABEÇALHO */
.card-header-agro{
    background:#ececec;
    padding:18px 25px;
}

.card-header-agro h2{
    margin:0;
    font-size:2rem;
    font-weight:700;
    color:#333;
}

.card-header-agro small{
    display:block;
    margin-top:8px;
    font-size:1rem;
    color:#555;
    font-style:italic;
}

/* IMAGEM */
.imagem-doenca-agro{
    width:100%;
    display:block;
    max-height:450px;
    object-fit:cover;
}

/* CONTEÚDO */
.card-content-agro{
    padding:0;
}

/* SEÇÕES */
.info-item{
    padding:20px 25px;
    border-top:1px solid #ddd;
    margin:0 !important;
}

.info-item strong{
    display:block;
    margin-bottom:10px;
    font-size:1.3rem;
    color:#333;
}

.info-item p{
    margin:0;
    color:#444;
    line-height:1.8;
    font-size:1rem;
}

/* DUAS COLUNAS */
.duas-colunas{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:50px;
    padding:25px;
    border-top:1px solid #ddd;
}

.col strong{
    display:block;
    margin-bottom:15px;
    font-size:1.3rem;
}

.col ul{
    margin:0;
    padding-left:25px;
}

.col li{
    margin-bottom:10px;
    line-height:1.8;
    color:#444;
}

/* AVISO */
.aviso-responsabilidade{
    margin:25px;
    padding:20px;
    border-radius:18px;
    background:#fff3f3;
    border:3px solid #f5b0b0;
}

.aviso-responsabilidade p{
    margin:0;
    color:#b73333;
    font-size:1rem;
    line-height:1.8;
    text-align:justify;
}


  
/* Garante que imagens fiquem dentro do limite e centralizadas */
.imagem-doenca-agro {
    width: 60%;
    max-width: 90%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 300px;
}

/* Grid de sintomas responsivo */
.duas-colunas {
    display: grid;
    /* No notebook, divide em duas colunas com um espaço (gap) grande entre elas */
    grid-template-columns: 1fr 1fr; 
    gap: 30px; 
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.4); /* Fundo sutil para separar as seções */
    border-radius: 12px;
}
.info-item {
    margin-bottom: 20px !important;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Ajustes para Telas Pequenas (Mobile) */

/* ================= RESPONSIVIDADE (MOBILE AJUSTADO) ================= */
@media (max-width: 600px) {
    
    body { padding: 5px; }
    
    .btn-circular { width: 50px; height: 50px; font-size: 24px; }
    .btn-voltar { top: 10px; left: 10px; font-size: 28px; }
    #floating-guia-btn { bottom: 10px; right: 10px; }

    .container {
        width: 95%;
        padding: 20px;
        margin-top: 80px;
    }
    .app-title { font-size: 2.2rem; }
    .rodape { font-size: 0.9rem; padding: 20px; }
    
    #chat-messages { padding: 10px; min-height: 300px; }
    /* ================= AJUSTE RESPONSIVO DO CHAT (MOBILE) ================= */

    /* Faz o container do bot empilhar verticalmente */
  .msg-bot-wrapper{
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.bot-avatar{
    width: 45px;
    height: 45px;
    margin-left: 10px;
}

.bot-bubble{
    width: 100%;
    max-width: 100%;
    border-radius: 18px, 18px, 18px, 0px;
}

   

    /* Opcional: Ajusta a mensagem do usuário para ganhar espaço também */
    .usuario {
        max-width: 90%;
        padding: 10px 15px;
    }

       .card-header h3 {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 10px;
        font-size: 0.9rem;
    }

    .imagem-doenca {
        max-height: 200px; /* Limita altura em celulares para não ocupar a tela toda */
    }

    .input-area { gap: 5px; padding: 8px; }
    input[type="text"] { padding: 10px; font-size: 0.9rem; }
    #btn-diagnosticar { padding: 0 15px; font-size: 0.9rem; }

    #guia-menu { bottom: 70px; left: 5%; width: 90%; max-height: 80vh; }
    .guia-header { padding: 10px 15px; }
    .guia-body { padding: 15px; }
     .duas-colunas {
        flex-direction: column;
    }
  .card-header-agro h2{
        font-size:1.5rem;
    }

    .duas-colunas{
        grid-template-columns:1fr;
        gap:20px;
    }

    .info-item{
        padding:15px;
    }

    .info-item strong,
    .col strong{
        font-size:1.1rem;
    }

    .col li,
    .info-item p{
        font-size:.95rem;
    }

    .imagem-doenca-agro{
        max-height:250px;
    }

    .aviso-responsabilidade{
        margin:15px;
    }
}
