/* css/style.css */
:root {
    --primary: #1a237e;
    --primary-light: #283593;
    --secondary: #0d47a1;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #e65100;
    --info: #01579b;
    --light: #e8eaf6;
    --lighter: #f5f5f5;
    --dark: #1a1a2e;
    --gray: #757575;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--light);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-content h1 {
    color: var(--primary);
    font-size: 2.2rem;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--gray);
    font-size: 1rem;
}

.status-ia {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--lighter);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-indicator {
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

/* Busca */
.busca-section {
    background: var(--light);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group label {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.05rem;
}

.input-grande {
    padding: 15px 20px;
    font-size: 1.1rem;
    border: 2px solid #dce1e8;
    border-radius: var(--radius);
    transition: var(--transition);
    width: 100%;
}

.input-grande:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(13, 71, 161, 0.1);
}

.botoes-busca {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primario, .btn-secundario {
    padding: 12px 30px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primario {
    background: var(--secondary);
    color: white;
}

.btn-primario:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 71, 161, 0.3);
}

.btn-secundario {
    background: var(--gray);
    color: white;
}

.btn-secundario:hover {
    background: #5d5d5d;
    transform: translateY(-2px);
}

/* Perguntas */
.perguntas-section {
    background: var(--lighter);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.perguntas-section h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

.perguntas-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.pergunta-item {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.pergunta-item label {
    display: block;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 5px;
}

.obrigatorio {
    color: var(--danger);
    font-weight: 700;
}

.pergunta-item input,
.pergunta-item select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dce1e8;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.pergunta-item input:focus,
.pergunta-item select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.1);
}

.pergunta-info {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 4px;
}

/* Loading */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    background: var(--lighter);
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.spinner {
    border: 4px solid var(--light);
    border-top: 4px solid var(--secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-sub {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Resultado */
.resultado-section {
    background: #e3f2fd;
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    border: 2px solid var(--secondary);
    animation: slideIn 0.5s ease;
}

.resultado-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
}

.resultado-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.badge-fonte {
    padding: 5px 15px;
    background: var(--light);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

.badge-confianca {
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
}

.frase-gerada {
    background: var(--lighter);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.frase-gerada h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

.frase-gerada p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--dark);
}

.acoes-resultado {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.acoes-resultado button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
}

.acoes-resultado button:hover {
    transform: scale(1.05);
}

.btn-aprovar {
    background: var(--success);
    color: white;
}

.btn-rejeitar {
    background: var(--danger);
    color: white;
}

.btn-copiar {
    background: var(--info);
    color: white;
}

.btn-editar {
    background: var(--warning);
    color: white;
}

.feedback-qualidade {
    margin-top: 20px;
    padding: 20px;
    background: var(--lighter);
    border-radius: var(--radius);
}

.estrelas {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    font-size: 2rem;
    cursor: pointer;
}

.estrela {
    transition: var(--transition);
    color: #bdbdbd;
}

.estrela-selecionada {
    color: #fdd835;
}

.estrela:hover {
    transform: scale(1.2);
}

/* Dashboard */
.dashboard-section {
    background: var(--lighter);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.dashboard-section h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 5px;
}

/* Histórico */
.historico-section {
    background: var(--lighter);
    padding: 25px;
    border-radius: var(--radius);
}

.historico-section h3 {
    color: var(--primary);
    margin-bottom: 20px;
}

.item-historico {
    background: white;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
    cursor: pointer;
    transition: var(--transition);
}

.item-historico:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.historico-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.historico-data {
    color: var(--gray);
    font-size: 0.8rem;
}

.sem-historico {
    color: var(--gray);
    text-align: center;
    padding: 20px;
}

/* Footer */
footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--light);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-content p {
    color: var(--gray);
    font-size: 0.9rem;
}

.footer-actions {
    display: flex;
    gap: 10px;
}

.btn-exportar, .btn-atualizar {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-exportar {
    background: var(--success);
    color: white;
}

.btn-atualizar {
    background: var(--info);
    color: white;
}

.btn-exportar:hover, .btn-atualizar:hover {
    transform: scale(1.05);
}

/* Mensagens */
#mensagem, #erro {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--radius);
    font-weight: 500;
    z-index: 1000;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.mensagem-sucesso {
    background: var(--success);
    color: white;
}

.mensagem-erro {
    background: var(--danger);
    color: white;
}

.mensagem-info {
    background: var(--info);
    color: white;
}

/* Editor */
.editor-frase {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--secondary);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.botoes-edicao {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.botoes-edicao button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-content h1 {
        font-size: 1.6rem;
    }
    
    .perguntas-container {
        grid-template-columns: 1fr;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .acoes-resultado {
        flex-direction: column;
    }
    
    .acoes-resultado button {
        width: 100%;
        justify-content: center;
    }
    
    .resultado-header {
        flex-direction: column;
        align-items: flex-start;
    }
}