/* ==========================================================================
   css/atividades.css
   Tela "Atividades" — missões + atividades para imprimir
   ========================================================================== */

/* ============================================================
   TELA
   ============================================================ */

.tela-atividades {
    min-height: 100dvh;

    background-image: url('../assets/fundos/fundo-cartas.png');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding-bottom: 32px;
}

/* ============================================================
   BANNER
   ============================================================ */

.at-banner-img {
    width: 100%;
    max-width: 480px;
    height: auto;
    display: block;
    flex-shrink: 0;
}

@media (min-width: 600px) {
    .at-banner-img { max-width: 680px; }
}

@media (min-width: 960px) {
    .at-banner-img { max-width: 900px; }
}

/* ============================================================
   SUBTÍTULO
   ============================================================ */

.at-subtitulo {
    margin: 6px 0 10px;
    padding: 0 16px;

    font-size: 0.88rem;
    font-weight: 700;
    color: rgba(255, 249, 220, 0.88);
    text-align: center;
    text-shadow: 0 1px 4px rgba(30, 18, 6, 0.5);
}

/* ============================================================
   ABAS
   ============================================================ */

.at-abas {
    display: flex;
    gap: 6px;
    padding: 0 16px;
    width: 100%;
    max-width: 480px;
}

@media (min-width: 600px) {
    .at-abas { max-width: 680px; }
}

@media (min-width: 960px) {
    .at-abas { max-width: 900px; }
}

.at-aba {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 12px 12px 0 0;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.35);
    color: #7a5a3a;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.at-aba--ativa {
    background: rgba(255, 255, 255, 0.9);
    color: #d97c14;
    cursor: default;
}

.at-aba--desabilitada {
    opacity: 0.48;
    cursor: not-allowed;
}

/* ============================================================
   PAINEL DE CONTEÚDO
   ============================================================ */

.at-painel {
    display: none;
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0 0 16px 16px;
}

.at-painel--ativo {
    display: block;
}

@media (min-width: 600px) {
    .at-painel { max-width: 680px; }
}

@media (min-width: 960px) {
    .at-painel { max-width: 900px; }
}

/* ============================================================
   GRADE DE CARDS
   ============================================================ */

.at-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 14px 16px;
}

@media (min-width: 600px) {
    .at-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (min-width: 960px) {
    .at-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 16px;
    }
}

/* ============================================================
   CARD DE ATIVIDADE
   ============================================================ */

.at-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.at-card-imagem-wrap {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.at-card-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

.at-card--bloqueada {
    cursor: default;
}

.at-card--bloqueada:focus-visible {
    outline: 3px solid rgba(106, 183, 255, 0.7);
    outline-offset: 2px;
    border-radius: 12px;
}

.at-card--bloqueada .at-card-img {
    opacity: 0.32;
    filter: grayscale(80%) brightness(0.78);
}

.at-card-bloqueio {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.at-card-bloqueio-img {
    width: 44%;
    max-width: 68px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

/* ============================================================
   BOTÃO "VER MISSÃO" / "VER ATIVIDADES"
   — visual e largura de .btn-ui + .btn-ver-missao / .btn-ver-atividade (componentes.css)
   — esta regra controla apenas estrutura no card
   ============================================================ */

.at-btn-missao {
    width: 100%;
}

/* ============================================================
   FEEDBACK INLINE
   ============================================================ */

.at-feedback {
    min-height: 1.4em;
    margin: 6px 16px 0;
    padding: 4px 14px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: transparent;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}

.at-feedback--ativo {
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.28);
}

/* ============================================================
   BOTÃO VOLTAR
   — visual herdado de .btn-secundario (componentes.css)
   — esta regra controla apenas o espaçamento
   ============================================================ */

.at-btn-voltar {
    margin: 12px 16px 0;
}

/* ============================================================
   MODAL DE MISSÃO
   ============================================================ */

#at-overlay-missao .rp-card {
    position: relative;

    width: min(94vw, 440px);
    max-width: min(94vw, 440px);

    padding: 0;
    overflow: hidden;
    overflow-y: auto;

    background-color: #fdf4e3;
    background-image: url('../assets/fundos/fundo-popup.png');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;

    border: 2px solid rgba(245, 166, 35, 0.95);
    border-radius: 20px;
}

/* Banner no topo do modal de missão */
.rp-banner-topo {
    width: 100%;
    height: auto;
    display: block;
    max-height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Botão ✕ do modal de missão */
.rp-missao-fechar {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;

    width: 44px;
    height: 44px;

    border: none;
    border-radius: 50%;

    background: rgba(255, 249, 237, 0.9);
    color: #6b4a1e;

    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.rp-missao-fechar:hover {
    background: rgba(232, 204, 138, 0.55);
}

.rp-missao-fechar:focus-visible {
    outline: 3px solid #6ab7ff;
    outline-offset: 2px;
}

/* Container central do conteúdo da missão */
.rp-missao-conteudo {
    padding: 12px 16px 18px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Imagem da afirmação "Agora é sua vez de praticar!" */
.rp-afirmacao-img {
    width: 100%;
    max-width: 320px;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Linha com personagem + texto da missão */
.rp-missao-principal {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rp-missao-personagem {
    width: 80px;
    min-width: 64px;
    max-width: 96px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.rp-missao-texto {
    flex: 1;
    min-width: 0;
    font-size: 0.96rem;
    line-height: 1.6;
    color: #4a3420;
    margin: 0;
    padding-top: 4px;
    white-space: pre-line;
}

/* Botão de áudio — versão em largura total */
.rp-btn-audio--full {
    width: 100%;
}

/* Botões de ação do modal: apenas layout, visual de .btn-principal/.btn-secundario */
.rp-btn-principal {
    width: 100%;
}

.rp-btn-secundario {
    width: 100%;
}

/* Landscape: modal mais compacto */
@media (orientation: landscape) and (max-height: 560px) {
    #at-overlay-missao .rp-card {
        width: min(94vw, 480px);
        max-width: min(94vw, 480px);
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
    }

    .rp-banner-topo {
        max-height: 46px;
    }

    .rp-missao-conteudo {
        padding: 8px 12px 14px;
        gap: 8px;
    }

    .rp-afirmacao-img {
        max-width: 240px;
    }

    .rp-missao-personagem {
        width: 58px;
        min-width: 48px;
    }

    .rp-missao-texto {
        font-size: 0.86rem;
        line-height: 1.44;
    }
}

/* ============================================================
   MODAL "PARA IMPRIMIR" — visualizador passo a passo
   ============================================================ */

.modal-atividades-card {
    position: relative;

    width: min(94vw, 430px);
    max-height: 92dvh;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 16px 14px 18px;
    border-radius: 22px;

    background: rgba(255, 249, 237, 0.98);
    border: 2px solid #e8cc8a;
    box-shadow: 0 22px 46px rgba(35, 22, 8, 0.36);

    overflow-y: auto;
}

.btn-fechar-atividades {
    position: absolute;
    top: 8px;
    right: 10px;

    width: 44px;
    height: 44px;

    border: 1px solid rgba(180, 140, 80, 0.32);
    border-radius: 50%;

    background: rgba(255, 249, 237, 0.95);
    color: #6b4a1e;

    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn-fechar-atividades:hover {
    background: rgba(232, 204, 138, 0.5);
}

.btn-fechar-atividades:focus-visible {
    outline: 3px solid #6ab7ff;
    outline-offset: 2px;
}

.atividade-contador {
    margin: 4px 36px 12px;

    color: #7a5524;
    font-size: 0.86rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.atividade-preview-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.atividade-preview-img {
    width: 100%;
    max-width: 360px;
    max-height: 58dvh;
    display: block;
    object-fit: contain;
    border-radius: 14px;
    background: #ffffff;
    padding: 6px;
    box-shadow: 0 12px 26px rgba(35, 22, 8, 0.25);
}

.atividade-navegacao {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 4px 0 12px;
}

/* .btn-imprimir-atividade — visual herdado de .btn-ui + .btn-imprimir-atividade (componentes.css) */

@media (orientation: landscape) and (max-height: 520px) {
    .modal-atividades-card {
        width: min(94vw, 620px);
        padding: 12px;
    }

    .atividade-preview-img {
        max-width: 280px;
        max-height: 48dvh;
    }

    .btn-imprimir-atividade {
        min-height: 42px;
        font-size: 0.84rem;
    }
}
