
/* Animação de carregamento simples */
.loader {
    border-top-color: #22d3ee;
    -webkit-animation: spinner 1.5s linear infinite;
    animation: spinner 1.5s linear infinite;
}

@keyframes spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Efeito "acender" para a caixa de prompt quando ativa */
.prompt-box {
    transition: all 0.3s ease;
}

.prompt-box:focus-within {
    border-color: #00E5FF;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

/* Texto do textarea quando focado */
.prompt-box:focus-within textarea {
    color: #E2E8F0;
}

/* Animação de carregamento - Pacotes de dados viajando */
.loading-container {
    position: relative;
    width: 100%;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* A pista (linha horizontal) */
.data-track {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 2px;
    background: rgba(0, 229, 255, 0.2);
    margin-bottom: 20px;
}

/* Container dos pacotes de dados */
.data-packages {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    max-width: 600px;
    height: 20px;
    transform: translateY(-50%);
}

/* Pacote de dados individual (cometa) */
.data-packet {
    position: absolute;
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, 
        rgba(0, 229, 255, 0) 0%,
        rgba(0, 229, 255, 0.8) 30%,
        #00E5FF 50%,
        rgba(0, 229, 255, 0.8) 70%,
        rgba(0, 229, 255, 0) 100%);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.6),
                0 0 20px rgba(0, 229, 255, 0.4),
                0 0 30px rgba(0, 229, 255, 0.2);
    opacity: 0;
    animation: travel-data 2s ease-in-out infinite;
}

/* Delay diferente para cada pacote */
.data-packet:nth-child(1) {
    animation-delay: 0s;
}

.data-packet:nth-child(2) {
    animation-delay: 0.6s;
}

.data-packet:nth-child(3) {
    animation-delay: 1.2s;
}

/* Animação do pacote viajando */
@keyframes travel-data {
    0% {
        left: -10%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        left: 110%;
        opacity: 0;
    }
}

/* Texto de apoio piscando */
.loading-text {
    color: #94A3B8;
    font-size: 0.875rem;
    margin-top: 20px;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* Estilos para a resposta e blocos de código */
#response-text {
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
}

/* Espaçamento entre elementos da resposta */
#response-text p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

#response-text p:last-child {
    margin-bottom: 0;
}

/* Espaçamento em listas */
#response-text ul,
#response-text ol {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

#response-text li {
    margin-bottom: 0.75rem;
    line-height: 1.75;
}

#response-text li:last-child {
    margin-bottom: 0;
}

/* Espaçamento em títulos dentro da resposta */
#response-text h1,
#response-text h2,
#response-text h3,
#response-text h4,
#response-text h5,
#response-text h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

#response-text h1:first-child,
#response-text h2:first-child,
#response-text h3:first-child,
#response-text h4:first-child,
#response-text h5:first-child,
#response-text h6:first-child {
    margin-top: 0;
}

/* Espaçamento em blocos de citação */
#response-text blockquote {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
    padding-left: 1rem;
    border-left: 4px solid rgba(0, 229, 255, 0.3);
}

/* Espaçamento em tabelas */
#response-text table {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    width: 100%;
    border-collapse: collapse;
}

#response-text table th,
#response-text table td {
    padding: 0.5rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Espaçamento em elementos HR */
#response-text hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
    border: none;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

/* Espaçamento em parágrafos que contêm código inline */
#response-text p code {
    margin: 0 0.125rem;
}

/* Código inline (não dentro de pre) */
#response-text code:not(pre code) {
    padding: 0.2rem 0.4rem;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 0.25rem;
    font-size: 0.875em;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Blocos de código específicos */
#response-text pre {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
}

#response-text pre code {
    display: block;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 0.5rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
    word-wrap: normal;
    max-width: 100%;
    box-sizing: border-box;
}

/* Garantir que a caixa de resposta não ultrapasse o container */
#result {
    max-width: 100%;
    overflow: hidden;
}

#result > div {
    max-width: 100%;
    overflow: hidden;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .loader,
    .data-packet,
    .loading-text {
        animation: none !important;
    }

    .data-packet {
        display: none; /* Hide the moving packets */
    }

    .prompt-box {
        transition: none;
    }
}
