/* --- ESTILOS GERAIS E LAYOUT --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

#app-assistente-anamnese {
    font-family: 'Roboto', sans-serif;
    color: #333;
    background-color: #f9f9f9;
}

.main-layout {
    display: flex;
    flex-direction: column; 
    flex-wrap: wrap;
    gap: 20px;
}

.coluna {
    flex: 1;
    min-width: 300px;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.coluna h2 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: bold;
    color: #1565c0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.descricao-coluna {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 15px;
    color: #555;
}

/* --- COLUNA 1: SELEÇÃO --- */
.coluna-header {
    flex-shrink: 0;
}

.coluna-body {
    display: flex;
    gap: 20px;
    overflow: hidden;
    flex-grow: 1;
}

#an-quick-nav {
    flex: 0 0 180px;
    overflow-y: auto;
    border-right: 1px solid #eee;
    padding-right: 20px;
}
#an-quick-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: sticky;
    top: 10px;
}
#an-quick-nav a {
    display: block;
    padding: 8px 10px;
    text-decoration: none;
    color: #333;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
}
#an-quick-nav a:hover {
    background-color: #f5f5f5;
}
#an-quick-nav a.active {
    background-color: #e3f2fd;
    color: #1565c0;
    border-left: 3px solid #1565c0;
}

#anamnese-wrapper {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 10px;
    height: 70vh; 
}

.secao-anamnese {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.secao-titulo {
    font-weight: bold;
    color: #333;
    cursor: pointer;
    padding: 12px;
    background-color: #f5f5f5;
    user-select: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.secao-titulo h3 {
    margin: 0;
    font-size: 16px;
}

.limpar-secao-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.limpar-secao-btn:hover {
    background-color: #d1d1d1;
}

.seta-expansao {
    margin-right: 10px;
    transition: transform 0.3s ease;
}
.seta-expansao.recolhido {
    transform: rotate(-90deg);
}

.secao-conteudo {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

.campo-wrapper {
    margin-bottom: 15px;
}
.campo-wrapper.hidden {
    display: none;
}
.campo-wrapper label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 15px;
}

.campo-wrapper input[type="text"], .campo-wrapper textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 15px;
    box-sizing: border-box;
}
.campo-wrapper input.small {
    width: 100px;
}
.hda-template h4 {
    font-size: 15px;
    color: #1565c0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-top: 0;
}

.suggestions-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.suggestion-btn {
    background-color: #e8f0fe;
    color: #1967d2;
    border: 1px solid #d2e3fc;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
}
.suggestion-btn:hover {
    background-color: #d2e3fc;
}

.choice-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.selectable-option {
    background-color: #f1f3f4;
    color: #3c4043;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e0e0e0;
}
.selectable-option:hover {
    background-color: #e8eaed;
}
.selectable-option.active {
    background-color: #1976d2;
    color: white;
    font-weight: 500;
    border-color: #1976d2;
}

.inline-other-input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    width: 150px;
}

.checklist-wrapper { display: flex; flex-direction: column; gap: 5px; }
.check-label { font-weight: normal; }

.toggle-btn {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #555;
}
.toggle-btn:hover {
    background-color: #e9e9e9;
}
.toggle-btn.negative {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #777;
    font-style: italic;
}
.toggle-btn.positive {
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.grupo-is { 
    margin-top: 15px; 
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}
.grupo-is-titulo {
    font-weight: bold;
    color: #333;
    padding: 10px;
    background-color: #fafafa;
    user-select: none;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 5px;
    border: 1px solid #f0f0f0;
}
.grupo-is-titulo.clicavel {
    cursor: pointer;
}
.grupo-is-titulo.clicavel:hover {
    background-color: #f0f0f0;
}
.grupo-is-titulo-texto {
    display: flex;
    align-items: center;
    flex-grow: 1;
}
.grupo-is-titulo h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
}
.btn-negar-todos {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-negar-todos:hover {
    background-color: #d1d1d1;
}

.grupo-is-conteudo {
    padding: 10px 0 0 15px;
    border-left: 2px solid #f5f5f5;
    margin-left: 5px;
}

.add-other-is-btn {
    width: 100%;
    padding: 8px;
    background-color: #f8f9fa;
    border: 1px dashed #bdc1c6;
    color: #1565c0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 15px;
}
.add-other-is-btn:hover {
    background-color: #e8f0fe;
    border-color: #1565c0;
}
.custom-is-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.custom-is-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.custom-is-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}
.remove-custom-is-btn {
    background-color: #fce8e6;
    color: #c5221f;
    border: 1px solid #f28b82;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    text-align: center;
    flex-shrink: 0;
}
.remove-custom-is-btn:hover {
    background-color: #f9d8d6;
}

/* --- COLUNA 2: REVISÃO --- */
#revisao-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* NOVO ESTILO PARA O EMPTY STATE */
.empty-state-placeholder {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    color: #aaa;
    margin: 10px;
}
.empty-state-placeholder svg {
    stroke: #ccc;
    margin-bottom: 15px;
}
.empty-state-placeholder h4 {
    margin: 0;
    font-size: 16px;
    color: #888;
}
.empty-state-placeholder p {
    margin: 5px 0 0 0;
    font-size: 14px;
    max-width: 250px;
}

.revisao-item {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 4px solid transparent;
    transition: border-left 0.3s;
}
.revisao-titulo {
    padding: 10px;
    background-color: #f5f5f5;
    cursor: grab;
    transition: background-color 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.revisao-titulo.clicavel {
    cursor: pointer;
}
.revisao-titulo .titulo-texto::before {
    content: '▼';
    margin-right: 8px;
    font-size: 12px;
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}
.revisao-titulo.recolhido .titulo-texto::before {
    transform: rotate(-90deg);
}
.revisao-titulo h4 {
    margin: 0;
    font-size: 15px;
    flex-grow: 1;
}
.botoes-reordenar {
    display: flex;
    gap: 5px;
}
.btn-mover-cima, .btn-mover-baixo {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    color: #555;
    font-size: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
}
.btn-mover-cima:hover, .btn-mover-baixo:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}
.revisao-preview {
    padding: 10px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    border-top: 1px solid #eee;
}
.revisao-item-placeholder {
    background-color: #e3f2fd;
    border: 2px dashed #1976d2;
    height: 60px;
    margin-bottom: 10px;
    border-radius: 5px;
}

/* --- COLUNA 3: TEXTO FINAL --- */
.texto-final-opcoes {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.opcao-siglas {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
}
.opcao-siglas label {
    font-size: 14px;
    color: #555;
    cursor: pointer;
}
.botoes-acao {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
#botao-copiar, #botao-limpar-tudo, #botao-imprimir, #botao-salvar-txt, #botao-salvar-rascunho, #botao-descartar-rascunho, #botao-copiar-formatado {
    padding: 8px 12px;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
    height: 38px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
#botao-copiar { background-color: #1976d2; }
#botao-copiar:hover { background-color: #1565c0; }

#botao-imprimir { background-color: #6c757d; }
#botao-imprimir:hover { background-color: #5a6268; }

#botao-salvar-txt { background-color: #28a745; }
#botao-salvar-txt:hover { background-color: #218838; }

#botao-limpar-tudo { background-color: #757575; }
#botao-limpar-tudo:hover { background-color: #616161; }

#botao-salvar-rascunho { background-color: #007bff; }
#botao-salvar-rascunho:hover { background-color: #0069d9; }

#botao-descartar-rascunho { background-color: #dc3545; }
#botao-descartar-rascunho:hover { background-color: #c82333; }

#botao-copiar-formatado { background-color: #6f42c1; } /* Roxo */
#botao-copiar-formatado:hover { background-color: #5a32a3; }

#texto-final-gerado {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    flex-grow: 1;
    padding: 10px;
}

/* --- ESTILOS PARA RED FLAGS --- */
.campo-wrapper.red-flag-active .toggle-btn.positive {
    background-color: #fce8e6;
    border-color: #f28b82;
    color: #c5221f;
    font-weight: bold;
}
.revisao-item.red-flag-active {
    border-left: 4px solid #d93025;
}
.revisao-item.red-flag-active .revisao-titulo {
    background-color: #fce8e6;
}

/* --- INDICADOR DE PROGRESSO --- */
#an-quick-nav li.completed a {
    color: #2e7d32;
}
#an-quick-nav li.completed a::before {
    content: '✓ ';
    font-weight: bold;
    color: #28a745;
}

/* --- ESTILOS DE AVISO E GUIA --- */
.aviso-secao {
    font-size: 13px;
    color: #666;
    background-color: #f8f9fa;
    border-left: 3px solid #1565c0;
    padding: 10px 12px;
    margin: 0 0 15px 0;
    line-height: 1.5;
    border-radius: 0 5px 5px 0;
}
.aviso-secao ul {
    padding-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;
}
.aviso-secao li {
    margin-bottom: 4px;
}

.guia-estatico-lista {
    list-style: none;
    padding-left: 5px;
    margin: 0;
}
.guia-estatico-lista li {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    font-size: 15px;
}
.guia-estatico-lista li::before {
    content: '□';
    margin-right: 12px;
    color: #999;
}
.guia-estatico-lista li:last-child {
    border-bottom: none;
}

/* --- ESTILOS PARA CAMPO REPEATER (MEDICAMENTOS) --- */
.repeater-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
.repeater-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}
.repeater-item-fields {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap; 
    gap: 8px;
}
.repeater-item-fields input[type="text"] {
    margin: 0;
    border-color: #ddd;
    font-size: 14px;
}
.repeater-item-fields input.large {
    flex: 2 1 200px; 
}
.repeater-item-fields input.medium {
    flex: 1 1 120px; 
}

.remove-repeater-btn {
    background-color: #fce8e6;
    color: #c5221f;
    border: 1px solid #f28b82;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.2s;
    font-size: 1.2em;
    line-height: 0;
}
.remove-repeater-btn:hover {
    background-color: #f9d8d6;
}
.add-repeater-btn {
    width: 100%;
    padding: 8px;
    background-color: #e8f5e9;
    border: 1px dashed #a5d6a7;
    color: #2e7d32;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 5px;
    transition: background-color 0.2s, border-color 0.2s;
}
.add-repeater-btn:hover {
    background-color: #dcedc8;
    border-color: #81c784;
}

/* --- ESTILOS PARA TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

@keyframes toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

.toast-message {
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toast-in 0.4s ease-out forwards;
}

.toast-message.hide {
    animation: toast-out 0.4s ease-in forwards;
}

.toast-success { background-color: #28a745; }
.toast-info { background-color: #17a2b8; }
.toast-warning { background-color: #ffc107; color: #212529; }