:root {
    --primary-blue: #0b3c5d;
    --secondary-green: #029539;
    --accent-orange: #ff6600;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --shadow-smooth: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: #ffffff; /* Fundo mantido rigorosamente branco */
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Fundo com formas */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.shape-top-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 150px;
    height: 200px;
    background: linear-gradient(180deg, #0b3c5d 0%, #052c4c 100%);
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.shape-bottom-waves {
    position: absolute;
    bottom: -10px; /* Estendido levemente para baixo para eliminar qualquer sobra branca */
    left: 0;
    width: 100%;
    height: 280px;
}

.shape-bottom-waves svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Cabeçalho da Página Inicial (Index) */
.site-header {
    background-color: transparent;
    padding: 15px 0;
    z-index: 10;
    position: relative;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
}

.app-logo {
    height: 90px;
    max-width: 100%;
    object-fit: contain;
    background: white;
    padding: 6px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.header-nav {
    display: none;
    gap: 25px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-blue);
}

/* Hero Section (Index) */
.hero-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    flex: 1;
    justify-content: center;
    z-index: 10;
}

.hero-text-content {
    text-align: center;
    max-width: 750px;
}

.hero-text-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    line-height: 1.15;
    margin-bottom: 12px;
}

.hero-text-content p {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.btn-primary-action {
    background-color: var(--accent-orange);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 102, 0, 0.35);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-primary-action:hover {
    background-color: #e65c00;
    transform: translateY(-2px);
}

.hero-visual-banner {
    width: 100%;
    max-width: 420px;
}

.card-glass {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 28px;
    border-radius: 20px;
    box-shadow: var(--shadow-smooth);
    text-align: center;
}

.banner-logo {
    height: 90px;
    object-fit: contain;
    margin-bottom: 15px;
}

.card-glass h2, .card-glass h3 {
    font-size: 1.2rem;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.card-glass p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Rodapé */
.site-footer {
    padding: 20px 20px 15px 20px;
    z-index: 10;
    margin-top: auto;
    background-color: transparent;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 15px;
}

.footer-header-text {
    text-align: center;
    margin-bottom: 15px;
}

.footer-header-text h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0b3c5d;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.footer-header-text p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.footer-contact-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.15);
}

.footer-contact-card:hover {
    transform: translateY(-3px);
    background: #ffffff;
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.25);
    border-color: var(--secondary-green);
}

.footer-contact-card .icon-box {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(2, 149, 57, 0.1), rgba(11, 60, 93, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.footer-contact-card:hover .icon-box {
    background: var(--secondary-green);
}

.footer-contact-card:hover .icon-box i {
    color: #ffffff;
}

.footer-contact-card i {
    font-size: 1.1rem;
    color: var(--primary-blue);
    transition: color 0.3s;
}

.contact-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.footer-contact-card span {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    font-weight: 600;
}

.footer-contact-card strong {
    font-size: 0.85rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-bottom-bar {
    padding-top: 10px;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.75);
}

/* ==========================================
   LAYOUT ESPECÍFICO DO QUIZ (CABEÇALHO FIXO E TRANSPARENTE)
   ========================================== */

body.quiz-page > header.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: transparent !important;
    backdrop-filter: blur(8px);
    z-index: 1000;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-quiz-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.quiz-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 170px 20px 20px 20px;
    z-index: 10;
    flex: 1;
    display: flex;
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    overflow-x: hidden;
}

.quiz-wrapper-single {
    max-width: 100vw;
    width: 100%;
    min-width: 0;
    padding: 10px 10px 15px 10px;
}

.btn-close-quiz {
    background: #ffffff;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.btn-close-quiz:hover {
    background-color: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    transform: scale(1.05);
}

.main-quiz-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 35px 50px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: var(--shadow-smooth);
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.quiz-progress-wrapper {
    width: 98%;
    max-width: 100%;
    margin: 10px auto 0 auto !important;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(5px);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.quiz-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-blue), var(--secondary-green));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quiz-scroll-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.quiz-question-title {
    font-size: 1.4rem;
    color: var(--primary-blue);
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 22px;
    font-weight: 700;
    letter-spacing: -0.2px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(11, 60, 93, 0.08);
    word-break: break-word;
}

/* ==========================================
   DIMENSIONAMENTO DE IMAGENS (PC / MOBILE)
   ========================================== */
.quiz-image-wrapper {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.quiz-image-wrapper img,
#question-image,
.imagem,
.result-item img {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    max-height: 220px !important;
    margin: 10px auto;
    border-radius: 12px;
    object-fit: contain !important;
    box-sizing: border-box;
}

.quiz-options-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 15px;
    width: 100%;
}

.quiz-options-grid button,
.options button {
    width: 100%;
    background-color: #ffffff;
    border: 2px solid var(--border-color);
    padding: 16px 24px;
    text-align: left;
    border-radius: 14px;
    font-size: 1.02rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.01);
    font-family: inherit;
    line-height: 1.5;
    word-break: break-word;
}

.quiz-options-grid button:hover,
.options button:hover {
    border-color: var(--primary-blue);
    background-color: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 60, 93, 0.08);
}

.quiz-options-grid button.selected,
.options button.selected {
    background-color: rgba(2, 149, 57, 0.08);
    border-color: var(--secondary-green);
    color: var(--primary-blue);
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(2, 149, 57, 0.15);
}

/* Painel de Resultados */
.result-header-card {
    background: linear-gradient(135deg, rgba(11, 60, 93, 0.05), rgba(2, 149, 57, 0.05));
    border: 1px solid var(--border-color);
    padding: 20px 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.result-title-area h2 {
    color: var(--primary-blue);
    font-size: 1.4rem;
    margin-bottom: 4px;
    font-weight: 700;
}

.result-title-area p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.score-badge-box {
    background: #ffffff;
    padding: 12px 24px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.score-grade {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--secondary-green);
}

.score-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.btn-pdf-export {
    background-color: #dc2626;
    color: white;
    border: none;
    padding: 12px 26px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.answers-summary-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 14px;
}

.result-question {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-blue);
    margin-bottom: 6px;
}

.result-user-ans span.correct {
    color: var(--secondary-green);
    font-weight: 700;
}

.result-user-ans span.wrong {
    color: #dc2626;
    font-weight: 700;
}

.result-correct-ans {
    margin-top: 4px;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.result-correct-ans span {
    color: var(--secondary-green);
    font-weight: 700;
}

.quiz-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    flex-shrink: 0;
    margin-top: auto;
    gap: 15px;
    width: 100%;
}

.btn-secondary-nav {
    background-color: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 28px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary-nav:disabled,
.btn-primary-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-next-custom {
    padding: 12px 32px;
    font-size: 0.92rem;
}

/* Modais e Pop-ups */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 60, 93, 0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 15px;
}

.popup-card {
    background: #ffffff;
    width: 100%;
    max-width: 400px;
    padding: 28px;
    border-radius: 18px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 1px solid var(--border-color);
}

.popup-icon {
    width: 54px;
    height: 54px;
    background: rgba(255, 102, 0, 0.1);
    color: var(--accent-orange);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 16px auto;
}

.popup-content h3 {
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-weight: 700;
}

.popup-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 20px;
}

.popup-btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

.popup-buttons-row {
    display: flex;
    gap: 12px;
}

.popup-btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

.popup-btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

/* ==========================================
   REGRAS DE RESPONSIVIDADE (MOBILE / TABLET)
   ========================================== */

@media (min-width: 768px) {
    .header-nav {
        display: flex;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .app-logo {
        height: 60px;
    }

    .header-container {
        justify-content: space-between;
    }

    .shape-top-left {
        width: 90px;
        height: 120px;
    }

    .shape-bottom-waves {
        height: 300px; /* Altura otimizada para cobrir a base inteira no mobile sem faixa branca */
    }

    .hero-container {
        padding: 10px 15px 30px 15px;
        gap: 15px;
    }

    .hero-text-content h1 {
        font-size: 1.5rem;
        line-height: 1.25;
    }

    .hero-text-content p {
        font-size: 0.9rem;
    }

    .btn-primary-action {
        width: 100%;
        padding: 14px 20px;
    }

    .hero-visual-banner {
        max-width: 100%;
    }

    .footer-links-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .footer-contact-card {
        padding: 10px 14px;
    }

    .footer-header-text h3 {
        font-size: 1.1rem;
    }

    .quiz-wrapper-single {
        max-width: 100vw;
        width: 100%;
        padding: 10px 10px 15px 10px;
    }

    .header-quiz-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 15px !important;
    }

    .quiz-progress-wrapper {
        max-width: 92vw;
        padding: 6px 12px;
    }

    .main-quiz-area {
        padding: 18px 16px;
        border-radius: 16px;
    }

    .quiz-question-title {
        font-size: 1.08rem;
        margin-bottom: 14px;
    }

    .quiz-image-wrapper img,
    #question-image,
    .imagem,
    .result-item img {
        max-height: 160px !important;
        max-width: 100% !important;
        width: auto !important;
    }

    .quiz-options-grid button,
    .options button {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .quiz-nav-buttons {
        gap: 8px;
    }

    .btn-secondary-nav, 
    .btn-next-custom,
    .btn-pdf-export {
        font-size: 0.82rem;
        padding: 10px 14px;
        flex: 1;
        justify-content: center;
    }

    .result-header-card {
        flex-direction: column;
        text-align: center;
        align-items: stretch;
    }

    .result-title-area h2 {
        text-align: center;
    }

    .result-title-area p {
        text-align: center;
    }

    .score-badge-box {
        margin-top: 5px;
    }
}