@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap');

/* --- PALETA DE CORES PASTEL --- */
:root {
    --primary-color: #5d7f9a;
    --primary-hover: #4a667d;
    --secondary-color: #7d8da1;
    --secondary-hover: #6b7a8f;
    --success-color: #6aaa96;
    --danger-color: #e57373;
    --light-color: #fdfaf6;
    --dark-color: #3f3d56;
    --background-color: #ffffff;
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* --- ESTILO BASE GLOBAL (COM CORREÇÃO) --- */
html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit; /* Garante que padding e borda não aumentem o tamanho total do elemento */
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    margin: 0;
    padding: 20px;
}

.app-container {
    background-color: var(--background-color);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 700px;
    text-align: center;
    margin: 0 auto; /* Centraliza o contêiner em telas maiores */
}

.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* --- CABEÇALHO --- */
.app-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.header-left a, .header-right a, .header-right button {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--secondary-color);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: color 0.2s;
}
.header-left a:hover, .header-right a:hover, .header-right button:hover {
    color: var(--primary-color);
}
.header-right .username {
    font-weight: 700;
    color: var(--dark-color);
    cursor: default;
}

/* --- TELAS DE LOGIN, CADASTRO E PERFIL --- */
.app-logo, .app-logo-small { height: 120px; margin-bottom: 20px; }
.app-logo-small { height: 80px; }
.form-title { font-size: 2rem; font-weight: 700; color: var(--primary-color); margin-bottom: 25px; }
.form-input { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 1rem; }
.form-switch { margin-top: 20px; font-size: 0.9rem; }
.form-switch a { color: var(--primary-color); font-weight: 700; text-decoration: none; cursor: pointer; }
.form-switch a:hover { text-decoration: underline; }
.form-label { display: block; text-align: left; font-weight: 500; margin-bottom: 5px; font-size: 0.9rem; }

/* --- TELA INICIAL --- */
#initial-screen .app-subtitle { font-size: 1.2rem; color: var(--secondary-color); margin-bottom: 20px; }
.category-container { display: flex; flex-direction: row; justify-content: center; gap: 25px; margin-top: 10px; margin-bottom: 30px; flex-wrap: wrap; }
.category-card { border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 25px; width: 250px; text-align: center; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.category-card:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); }
.category-card h4 { font-size: 1.4rem; font-weight: 700; color: var(--primary-color); margin-top: 0; margin-bottom: 10px; }
.category-card p { font-size: 0.95rem; color: var(--secondary-color); line-height: 1.5; margin-bottom: 0; }
.separator { border: 0; height: 1px; background: var(--border-color); margin: 30px 0; }
#random-quiz-container .app-subtitle.small { font-size: 0.9rem; margin-bottom: 15px; margin-top: 0; }

/* --- TELA DO QUIZ --- */
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
#question-text { font-size: 1.3rem; font-weight: 500; margin-bottom: 25px; line-height: 1.5; text-align: justify; }
#options-container { margin-top: 20px; margin-bottom: 20px; text-align: left; }
.option { display: flex; align-items: center; margin-bottom: 15px; background-color: #f7f9fc; padding: 15px; border-radius: var(--border-radius); border: 1px solid var(--border-color); cursor: pointer; transition: background-color 0.2s, border-color 0.2s; }
.option:hover { background-color: #eef2f7; }
.option input[type="radio"] { margin-right: 15px; width: 18px; height: 18px; flex-shrink: 0; }
.option label { font-size: 1.1rem; flex-grow: 1; cursor: pointer; }
.feedback { font-size: 1.2rem; font-weight: 500; margin-top: 20px; min-height: 25px; }
.feedback.correct { color: var(--success-color); }
.feedback.incorrect { color: var(--danger-color); }

/* --- OUTRAS TELAS --- */
#results-screen .result-title, #progress-screen .form-title, #profile-screen .form-title { font-size: 2rem; }
.score { font-size: 1.8rem; margin-bottom: 30px; }
.progress-container { margin-top: 20px; width: 100%; max-height: 450px; overflow-y: auto; }
#progress-table { width: 100%; border-collapse: collapse; }
#progress-table th, #progress-table td { border-bottom: 1px solid var(--border-color); padding: 12px 8px; text-align: left; }
#progress-table th { font-weight: 700; color: var(--primary-color); position: sticky; top: 0; background-color: var(--background-color); }
#progress-table tbody tr:hover { background-color: var(--light-color); }
.danger-zone { border: 2px solid var(--danger-color); border-radius: var(--border-radius); padding: 20px; margin-top: 30px; margin-bottom: 30px; }
.danger-zone-title { color: var(--danger-color); margin-top: 0; font-weight: 700; }
.danger-zone p { font-size: 0.9rem; line-height: 1.5; }

/* --- BOTÕES --- */
.btn { padding: 12px 25px; font-size: 1rem; font-weight: 500; border: none; border-radius: var(--border-radius); cursor: pointer; transition: all 0.2s; }
.btn:disabled { background-color: #e9ecef; color: var(--secondary-color); cursor: not-allowed; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
.button-group { margin-top: 30px; display: flex; justify-content: center; gap: 15px; }
.button-group .btn { width: auto; }
.btn-primary { background-color: var(--primary-color); color: white; width: 100%; }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }
.btn-success { background-color: var(--success-color); color: white; }
.btn-secondary { background-color: var(--secondary-color); color: white; width: 100%;}
.btn-secondary:hover:not(:disabled) { background-color: var(--secondary-hover); }
.btn-secondary-outline { background-color: transparent; color: var(--secondary-color); border: 2px solid var(--secondary-color); }
.btn-secondary-outline:hover:not(:disabled) { background-color: var(--secondary-color); color: white; }
.btn-special { background: linear-gradient(45deg, #8360c3, #2ebf91); color: white; font-weight: 700; width: 100%; }
.btn-special:hover:not(:disabled) { background: linear-gradient(45deg, #7151ac, #25a27c); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2); }
.btn-tertiary { background-color: transparent; color: var(--secondary-color); border: none; padding: 5px 10px; font-size: 0.9rem; font-weight: 500; width: auto; }
.btn-tertiary:hover:not(:disabled) { background-color: #f1f1f1; transform: none; box-shadow: none; }
.btn-danger { background-color: var(--danger-color); color: white; width: 100%; }
.btn-danger:hover:not(:disabled) { background-color: #b22222; }

/* --- CRÉDITOS E CONTADORES --- */
.creator-credit, .visitor-counter { margin-top: 20px; font-size: 0.8rem; color: var(--secondary-color); text-align: center; }
.visitor-counter { margin-top: 10px; }
.back-button-container { text-align: left; margin-bottom: 20px; }
.quiz-list-container { display: flex; flex-direction: column; gap: 15px; max-height: 400px; overflow-y: auto; padding-right: 10px; }
.cookie-banner { position: fixed; bottom: 0; left: 0; width: 100%; background-color: var(--dark-color); color: white; padding: 15px 30px; box-sizing: border-box; display: none; justify-content: space-between; align-items: center; z-index: 1000; flex-wrap: wrap; gap: 15px; }
.cookie-banner p { margin: 0; flex-grow: 1; font-size: 0.9rem; line-height: 1.4; }
.cookie-banner .btn { width: auto; flex-shrink: 0; padding: 8px 20px; }


/*
==============================================
--- ESTILOS PARA RESPONSIVIDADE (SMARTPHONES) ---
==============================================
*/
@media (max-width: 768px) {

    body {
        padding: 0;
        align-items: flex-start;
    }

    .app-container {
        padding: 20px 15px;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }

    .app-header {
        position: static;
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        background-color: var(--background-color);
        border-bottom: 1px solid var(--border-color);
    }

    .header-left, .header-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
        width: 100%;
    }
    
    .app-logo {
        height: 100px;
        margin-top: 15px;
    }
    
    .category-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .category-card {
        width: 100%; 
    }
    
    .quiz-header {
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
    }

    .quiz-header .btn-tertiary {
        font-size: 0.8rem;
        padding: 5px;
    }

    .button-group {
        flex-direction: column;
        align-items: stretch; 
        gap: 10px;
    }

    .button-group .btn {
        width: 100%;
    }
    
    #progress-table th, #progress-table td {
        padding: 8px 4px;
        font-size: 0.9rem;
    }
}
