/* --- Estilos Globais e Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #343541;
    color: #ececf1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* --- Ícone do GitHub --- */
.github-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ececf1;
    font-size: 2.5rem;
    transition: color 0.2s ease, transform 0.2s ease;
}
.github-icon:hover {
    color: #10a37f;
    transform: scale(1.1);
}

/* --- Container Principal do Conteúdo --- */
.main-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* --- Título do Projeto --- */
h1 {
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* --- Bloco de Interação (Toggle, Input, Botão) --- */
.interaction-block {
    background-color: #40414f;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --- Toggles (Controle Segmentado) --- */
.toggle-group {
    display: flex;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #565869;
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    cursor: pointer;
    background-color: #40414f;
    color: #ececf1;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.toggle-group input[type="radio"]:checked + label {
    background-color: #565869;
    color: #ffffff;
    font-weight: 600;
}
.toggle-group label:not(:last-child) {
    border-right: 1px solid #565869;
}

/* --- Caixas de Entrada de Texto (user-input e glossary-input) --- */
#user-input,
#glossary-input {
    width: 100%;
    background-color: #343541;
    border: 1px solid #565869;
    border-radius: 8px;
    padding: 15px;
    font-size: 1rem;
    resize: vertical;
    color: #ececf1;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow-y: hidden; 
}
#user-input { min-height: 60px; resize: vertical; }
#glossary-input { min-height: 40px; font-size: 0.9rem; padding: 10px; }

#user-input::placeholder,
#glossary-input::placeholder {
    color: #8e8ea0;
}
#user-input:focus,
#glossary-input:focus {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.3);
}

/* --- Opções de Geração (Container) --- */
.generation-options-container {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px dashed #565869;
}
.generation-options-container.show {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
}
.section-label {
    font-size: 0.9rem;
    color: #8e8ea0;
    font-weight: 500;
    text-align: center;
}
.generation-description {
    font-size: 0.85rem;
    color: #8e8ea0;
    text-align: center;
    line-height: 1.5;
    margin-top: -5px;
    display: none; 
}
.generation-description b { color: #ffffff; font-weight: 600; }

/* --- Caixa de Glossário (Animação) --- */
#glossary-input {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease, margin-top 0.3s ease;
}
#glossary-input.show {
    opacity: 1;
    max-height: 500px; 
    transform: translateY(0);
    margin-top: 5px;
}

/* --- Botão de Ação --- */
.action-button {
    width: 100%;
    padding: 15px;
    background-color: #10a37f;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}
.action-button:hover { background-color: #0f9272; transform: translateY(-2px); }
.action-button:active { transform: translateY(0); }


.main-response-container {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease;
}
.main-response-container.show {
    opacity: 1;
    max-height: 500px;
    margin-top: 15px; 
}
#main-response-output {
    width: 100%;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 1.3rem;
    font-weight: 600;
    color: #ececf1;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: center;
    padding: 15px;
    background-color: #343541;
    border-radius: 8px;
    border: 1px solid #565869;
}
/* Estilo de erro para a caixa de resposta principal */
#main-response-output.error {
    color: #f77; 
    font-size: 1rem;
    font-weight: 500;
}

.details-area { 
    width: 100%;
    background-color: #40414f;
    border: 1px solid #565869;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    
    display: none; 
    
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    flex-direction: column;
    padding: 25px;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.details-area.show { 
    display: flex;
    opacity: 1;
}

/* --- Spinner de Carregamento --- */
.loader {
    display: none;
    width: 45px;
    height: 45px;
    border: 5px solid #565869;
    border-top-color: #10a37f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Wrapper para o conteúdo (botão + detalhes) */
#details-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- Botão "Ver Processo" --- */
.details-button {
    background: none;
    border: 1px solid #565869;
    color: #8e8ea0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: none; 
    align-items: center;
    gap: 8px;
}
.details-button:hover {
    background-color: #565869;
    color: #ececf1;
}
.details-button i {
    transition: transform 0.3s ease;
}
.details-button.open i {
    transform: rotate(180deg);
}

/* --- Área de Detalhes Colapsável --- */
.details-content {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin-top 0.3s ease;
    width: 100%;
}
.details-content.show {
    opacity: 1;
    max-height: 500px;
    margin-top: 20px;
}

/* --- JSON dos Detalhes --- */
#details-output {
    width: 100%;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9rem;
    color: #b4b4c0;
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: #343541;
    border: 1px solid #565869;
    border-radius: 8px;
    padding: 15px;
}

.footer-note {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #8e8ea0; 
    text-align: center;
    max-width: 600px;
    line-height: 1.4;
    opacity: 0.8;
    padding: 0 10px;
}

.footer-note i {
    color: #10a37f; /* Verde do tema para o ícone */
    margin-right: 5px;
}

/* --- Media Queries --- */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .github-icon { font-size: 2rem; top: 15px; right: 15px; }
    .interaction-block, .details-area { padding: 20px; }
    #main-response-output { font-size: 1.15rem; }
    .footer-note {
        font-size: 0.75rem;
        margin-bottom: 20px;
    }
}