/* static/css/style.css */

:root {
    --cor-primaria: #ff6a00;
    --cor-secundaria: #f0f0f0;
    --cor-texto: #333;
    --cor-texto-claro: #fff;
    --cor-sucesso: #28a745;
    --cor-erro: #dc3545;
    --cor-aviso: #ffc107;
    --cor-borda: #ccc;
    --fonte-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --sombra-caixa: 0 2px 5px rgba(0,0,0,0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px; /* Base para unidades REM */
}

body {
    font-family: var(--fonte-principal);
    line-height: 1.6;
    background-color: var(--cor-secundaria);
    color: var(--cor-texto);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Previne barra de rolagem horizontal no body */
}

.container {
    width: 90%;
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: var(--sombra-caixa);
    border-radius: 8px;
}

header {
    background-color: var(--cor-primaria);
    color: var(--cor-texto-claro);
    padding: 1rem 15px;
    text-align: center;
    box-shadow: var(--sombra-caixa);
}
header h1 {
    font-size: 1.7rem;
    word-break: break-word;
}
header nav ul {
    list-style-type: none;
    margin-top: 10px;
}
header nav ul li {
    display: inline-block;
    margin: 5px 10px;
}
header nav ul li a {
    color: var(--cor-texto-claro);
    text-decoration: none;
    font-weight: bold;
    padding: 5px 0;
}

h1, h2, h3 {
    color: var(--cor-primaria);
    margin-bottom: 0.8rem;
    word-break: break-word;
}
h2 {
    border-bottom: 2px solid var(--cor-secundaria);
    padding-bottom: 0.5rem;
    margin-bottom: 1.2rem;
}
p {
    margin-bottom: 1rem;
    word-break: break-word;
}

form {
    margin-bottom: 1.5rem;
    max-width: 100%; /* Garante que o form não estoure */
}
.form-group {
    margin-bottom: 1rem;
}
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    word-break: break-word;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--cor-borda);
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.4;
    max-width: 100%;
}
textarea {
    min-height: 100px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 100%;
}
.btn-primary { background-color: var(--cor-primaria); color: var(--cor-texto-claro); }
.btn-primary:hover { background-color: #e65c00; transform: translateY(-1px); }
.btn-secondary { background-color: #6c757d; color: var(--cor-texto-claro); }
.btn-secondary:hover { background-color: #5a6268; transform: translateY(-1px); }
.btn-warning { background-color: var(--cor-aviso); color: var(--cor-texto); }
.btn-warning:hover { background-color: #e0a800; transform: translateY(-1px); }
.btn-danger { background-color: var(--cor-erro); color: var(--cor-texto-claro); }
.btn-danger:hover { background-color: #c82333; transform: translateY(-1px); }
.btn:disabled { background-color: #ccc; color: #666; cursor: not-allowed; transform: none; opacity: 0.65; }

.alert { padding: 1rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: 4px; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }
.alert-warning { color: #856404; background-color: #fff3cd; border-color: #ffeeba; }
.alert-info { color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb; }

#recording-indicator { display: none; margin: 10px 0; padding: 10px; background-color: var(--cor-erro); color: var(--cor-texto-claro); border-radius: 4px; text-align: center; font-weight: bold; }
#recording-indicator.recording { display: block; animation: blink-animation 1s infinite; }
@keyframes blink-animation { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

fieldset[disabled] { opacity: 0.6; pointer-events: none; }
fieldset {
    border: 1px solid var(--cor-borda);
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    max-width: 100%;
}
legend { font-weight: bold; color: var(--cor-primaria); padding: 0 5px; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
th, td {
    border: 1px solid var(--cor-borda);
    padding: 0.5rem;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}
th { background-color: var(--cor-secundaria); font-weight: bold; }
tr:nth-child(even) { background-color: #f9f9f9; }
td .btn { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.table-responsive-wrapper {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}
.table-responsive-wrapper table {
    /* min-width: 600px; /* Descomente e ajuste se a tabela interna for muito complexa */
}

.question-group {
    margin-bottom: 1.2rem;
    padding: 0.8rem;
    background-color: #fdfdfd;
    border-left: 4px solid var(--cor-primaria);
    max-width: 100%;
}
.question-group p { font-weight: bold; margin-bottom: 0.5rem; }

.question-group .options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem; /* Ajustado para um pouco mais de espaço */
}
.question-group .options label {
    font-weight: normal;
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin-bottom: 0;
}
.question-group .options input[type="radio"],
.question-group .options input[type="checkbox"] {
    margin-right: 0.7rem; /* Aumentado para melhor separação */
    flex-shrink: 0;
    margin-top: 0.25em;
}
.question-group .options input[type="text"],
.question-group .options input[type="number"] {
    width: auto;
    max-width: 200px;
    display: inline-block;
    margin-left: 5px;
    padding: 0.5rem;
}

/* Estilos para a tabela de avaliação (rating-table) */
.rating-table th, .rating-table td {
    white-space: nowrap;
    padding: 0.5rem 0.4rem;
}
.rating-table td label {
    display: inline-block !important;
    margin-right: 8px;
}
.rating-table td input[type="radio"]{
    margin-right: 3px;
}

/* --- MEDIA QUERIES --- */
@media (max-width: 768px) {
    .container {
        width: 95%; /* Ajustado para um pouco menos em telas médias */
        padding: 15px;
        margin: 15px auto;
    }
    header h1 { font-size: 1.5rem; }
    header nav ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    header nav ul li {
        margin: 0;
    }

    .btn { padding: 0.7rem 1.2rem; font-size: 0.9rem; }
    .btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }

    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="tel"], textarea, select {
        padding: 0.7rem;
        font-size: 0.95rem;
    }

    fieldset, .question-group {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Container dos botões de controle da pesquisa */
    .survey-controls {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px; /* Aumentado o gap */
        margin: 20px 0;
    }
    .survey-controls .btn {
        width: 100%;
        max-width: 350px; /* Aumentado um pouco, mas ainda limitado */
        margin-left: auto;  /* Centraliza se for menor que 100% */
        margin-right: auto; /* Centraliza se for menor que 100% */
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }
    .container {
        width: 100%;
        margin: 0;
        padding: 10px;
        border-radius: 0;
        box-shadow: none;
    }
    header { padding: 0.8rem 10px; border-radius: 0; }
    header h1 { font-size: 1.25rem; }

    .btn { font-size: 0.9rem; padding: 0.7rem 1rem; } /* Aumentado padding */
    .btn-lg { font-size: 1rem; padding: 0.8rem 1.2rem; } /* Aumentado padding */

    input, textarea, select { font-size: 1rem !important; } /* Aumentado para melhor leitura */

    .question-group { padding: 0.7rem; }
    .question-group p { font-size: 0.95rem; }
    .question-group .options label { font-size: 0.9rem; }
    .question-group .options input[type="text"],
    .question-group .options input[type="number"] {
        max-width: 100%; /* Deixa ocupar a largura disponível se necessário */
        width: 150px; /* Mas define uma largura base menor */
    }

    th, td { padding: 0.4rem; font-size: 0.85rem; }
    .rating-table th, .rating-table td {
        white-space: normal; /* Permite quebra de texto nas células */
    }
    .survey-controls .btn {
        max-width: 100%; /* Em telas muito pequenas, deixa ocupar tudo */
    }
}

footer {
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    background-color: #333;
    color: #fff;
    font-size: 0.85rem;
}