/* =========================================================================
   CAIXA DE CURSO — v4
   =========================================================================

   Estilo do card usado por /lista-de-cursos (pesquisa_curso_new_v3.php) e
   /cursos-premium (cursos-premium-page.php). Markup em
   temas/wr/caixa-curso-lista-v4.php.

   ---- ESCOPO -------------------------------------------------------------
   Tudo está sob `.wr-cursos-grid` (classe do container #resultados-pesq-curso
   nas duas páginas). Vale para os cards do primeiro carregamento e para os
   injetados por AJAX no scroll infinito e nos filtros.
   NÃO remova esse prefixo: sem ele as regras vazam para o site inteiro.

   ---- INDEPENDÊNCIA DO BOOTSTRAP -----------------------------------------
   O card usa classes próprias `wrct-*`, então nenhuma regra global do site
   (.borda, .details, .meta, .thumb, .single-popular-carusel .details h3 ...)
   o alcança. A grade é CSS Grid própria (seção GRADE abaixo) — as larguras
   percentuais globais de `.caixa-curso` são anuladas. `.single-popular-carusel`
   segue no HTML porque o JS da página conta essa classe para o scroll
   infinito — não remova.

   ---- ESCALA -------------------------------------------------------------
   Medidas derivadas da referência (960px de card no frame de 1024) para um
   card real de ~318px, fator ~0,33.
   ========================================================================= */

/* Rubik já vem do @font-face de css/css_wr_base.php (self-hosted em
   /fonts/Rubik-VariableFont_wght.woff2, peso variável 300–900), que a
   página de teste já carrega — não precisa de link externo. */
.wr-cursos-grid .wrct-col,
.wr-cursos-grid .wrct-col *,
.wr-cursos-grid .wrct-col *::before,
.wr-cursos-grid .wrct-col *::after {
    box-sizing: border-box;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* O glifo do Font Awesome é o `content` do ::before, não do próprio .fa.
   A regra acima (`*::before { font-family: Rubik }`) mira esse pseudo-
   elemento diretamente — regra explícita no ::before vence herança do
   .fa pai, então setar font-family só no .fa (mesmo com !important) não
   bastava: o glifo continuava tentando renderizar em Rubik, que não tem
   esses codepoints, e sumia. Precisa da regra no próprio ::before. */
.wr-cursos-grid .wrct-col .fa,
.wr-cursos-grid .wrct-col .fa::before {
    font-family: FontAwesome !important;
}

/* -------------------------------------------------------------------------
   GRADE — CSS Grid, espelhando .lista_cards_curso do site-corujinhas
   (assets/css/estilo.php): repeat(4, 1fr), gap 16px, padding lateral
   clamp(12px, 2vw, 48px) e a mesma escada de colunas por largura de tela.
   -------------------------------------------------------------------------
   `.wr-cursos-grid` É o container #resultados-pesq-curso. O display:grid
   vence o display:flex do `.row` (Bootstrap) por ordem de cascata — este
   arquivo carrega por último. As larguras percentuais globais de
   `.caixa-curso` (25%/33%/50%/100% com !important) são anuladas abaixo:
   numa célula de grid a largura é do track, não do item.
   ------------------------------------------------------------------------- */
.wr-cursos-grid {
    display: grid;
    /* minmax(0, 1fr) e não 1fr: track 1fr tem min-width:auto, e os textos
       com white-space:nowrap do card empurrariam a grade para além da tela
       (scroll horizontal) */
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    padding-left: clamp(12px, 2vw, 48px);
    padding-right: clamp(12px, 2vw, 48px);
}

/* o clearfix global de .row (::before/::after) viraria item de grade e
   ocuparia a 1ª célula como um card fantasma vazio */
.wr-cursos-grid::before,
.wr-cursos-grid::after {
    content: none;
}

/* anula o sistema antigo de colunas por porcentagem + margens */
.wr-cursos-grid .caixa-curso {
    width: auto !important;
    min-width: 0;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
}

/* filhos que não são card (msg "não encontrado", botão de catálogo do AJAX)
   ocupam a linha inteira da grade */
.wr-cursos-grid > *:not(.caixa-curso) {
    grid-column: 1 / -1;
}

/* -------------------------------------------------------------------------
   CONTAINER
   ------------------------------------------------------------------------- */
.wr-cursos-grid .wrct-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(16, 40, 70, .10), 0 2px 6px rgba(16, 40, 70, .06);
}

/* -------------------------------------------------------------------------
   IMAGEM SUPERIOR
   -------------------------------------------------------------------------
   Como na referência: o topo do card é um painel decorativo com fundo
   esverdeado suave (blobs + pontilhado), e a imagem do curso fica encaixada
   numa moldura escura levemente inclinada, estilo tablet/quadro.
   ------------------------------------------------------------------------- */
.wr-cursos-grid .wrct-thumb {
    position: relative;
    /* proporção da referência (960 x 615), ajustada para 16/9 */
    aspect-ratio: 16 / 9;
    border: 1px solid #dfe9c9;
    border-bottom: none;
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    /* sem overflow:hidden — a pill verde pendura 6px abaixo desta área
       (bottom:-6px) e seria cortada; moldura e enfeites são inset e não
       vazam, e os cantos do card já são cortados pelo overflow do .wrct-card */
    background:
        radial-gradient(closest-side at 10% 85%, rgba(105, 151, 44, .14), transparent),
        radial-gradient(closest-side at 92% 20%, rgba(105, 151, 44, .10), transparent),
        linear-gradient(135deg, #f8faf3 0%, #eff4e5 55%, #e9f0dc 100%);
}

/* patch de bolinhas do canto superior esquerdo */
.wr-cursos-grid .wrct-thumb::before {
    content: "";
    position: absolute;
    left: 3%;
    top: 8%;
    width: 20%;
    height: 38%;
    background-image: radial-gradient(rgba(20, 140, 75, .20) 1.2px, transparent 1.7px);
    background-size: 9px 9px;
    z-index: 0;
    pointer-events: none;
}

/* a moldura inclinada (o "quadro"): o próprio link vira o tablet */
.wr-cursos-grid .wrct-thumb-link {
    position: absolute;
    left: 6%;
    right: 8%;
    top: 8%;
    bottom: 14%;
    z-index: 1;
    display: block;
    /* efeito 3D: perspective + rotateY trazem o lado direito do tablet
       para a frente, rotateX inclina o topo, rotate mantém a leve torção */
    transform: perspective(900px) rotateY(14deg) rotateX(13deg) rotate(-2deg);
    background: #41464e;
    /* espessura da moldura */
    padding: 7px 9px;
    border-radius: 10px;
    /* aro claro externo + sombra projetada no fundo */
    box-shadow: 0 0 0 2px #c3c7cc, 0 12px 22px rgba(30, 40, 50, .22);
    transition: transform .25s ease;
}

.wr-cursos-grid .wrct-card:hover .wrct-thumb-link {
    transform: perspective(900px) rotateY(8deg) rotateX(7deg) rotate(-1deg) scale(1.015);
}

.wr-cursos-grid .wrct-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 0;
    background: #fff;
}

/* fallback p/ navegador sem aspect-ratio */
@supports not (aspect-ratio: 16 / 10) {
    .wr-cursos-grid .wrct-thumb {
        height: 0;
        padding-bottom: 62.5%;
    }
}

/* botão redondo do carrinho, sobre a imagem */
.wr-cursos-grid .wrct-cart {
    position: absolute;
    top: 20px;
    right: 16px;
    z-index: 3;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 0;
    border-radius: 50%;
    color: #148c4b;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(16, 40, 70, .18);
    transition: transform .2s ease, box-shadow .2s ease;
}

.wr-cursos-grid .wrct-cart svg {
    width: 19px;
    height: 19px;
    display: block;
}

.wr-cursos-grid .wrct-cart:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(16, 40, 70, .24);
}

/* faixa verde arredondada, encostada na base da imagem */
.wr-cursos-grid .wrct-badge {
    position: absolute;
    left: 10px;
    bottom: -6px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    max-width: calc(100% - 20px);
    padding: 4px 2px;
    background: #588123;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(9, 60, 32, .22);
    width: 100%;
    justify-content: space-around;
}

.wr-cursos-grid .wrct-badge-item {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.wr-cursos-grid a.wrct-badge-item:hover .wrct-badge-txt {
    text-decoration: underline;
}

.wr-cursos-grid .wrct-badge-ico {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .22);
    border-radius: 50%;
    color: #fff;
}

.wr-cursos-grid .wrct-badge-ico svg {
    width: 11px;
    height: 11px;
    display: block;
}

.wr-cursos-grid .wrct-badge-clock {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    display: inline-flex;
    color: #fff;
}

.wr-cursos-grid .wrct-badge-clock svg {
    width: 14px;
    height: 14px;
    display: block;
}

.wr-cursos-grid .wrct-badge-txt {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wr-cursos-grid .wrct-badge-sep {
    flex: 0 0 auto;
    width: 1px;
    height: 12px;
    margin: 0 3px;
    background: rgba(255, 255, 255, .45);
}

/* -------------------------------------------------------------------------
   CONTEÚDO
   ------------------------------------------------------------------------- */
.wr-cursos-grid .wrct-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 15px 12px 12px;
    border: 1px solid #e3e3e3;
    border-radius: inherit;
    border-top-right-radius: 0;
    border-top-left-radius: 0;
}

/* --- título --- */
.wr-cursos-grid .wrct-title {
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -.2px;
    color: #15263d;
    /* 3 linhas fixas mantêm todos os cards da grade alinhados */
    min-height: 57px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wr-cursos-grid .wrct-title a {
    color: #111a0b;
    text-decoration: none;
}

.wr-cursos-grid .wrct-title a:hover {
    color: #588123;
}

/* --- linha decorativa verde --- */
.wr-cursos-grid .wrct-rule {
    display: block;
    width: 45px;
    height: 3px;
    margin-top: 15px;
    background: #5cc08d;
    border-radius: 2px;
}

/* --- avaliações + preço --- */
.wr-cursos-grid .wrct-info {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    margin-top: 17px;
}

.wr-cursos-grid .wrct-rating {
    /* mesmo flex-grow do .wrct-price: os dois dividem o espaço em partes
       iguais, então o divisor (.wrct-vsep) fica centralizado entre eles —
       estrelas grudadas na borda esquerda da sua metade, preço na direita
       da dele. min-width:0 deixa encolher (não quebra linha) em vez de
       empurrar o preço pra baixo num card muito estreito. */
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
}

.wr-cursos-grid .wrct-stars {
    display: flex;
    align-items: center;
    gap: 3px;
}

.wr-cursos-grid .wrct-star {
    font-size: 16px;
    line-height: 1;
    color: #f6b023;
}

.wr-cursos-grid .wrct-rating-txt {
    margin: 7px 0 0;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    color: #595959;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wr-cursos-grid .wrct-vsep {
    flex: 0 0 auto;
    width: 1px;
    height: 36px;
    margin: 0 14px;
    background: #e3e6ea;
}

.wr-cursos-grid .wrct-price {
    /* mesma flex-basis 0 do .wrct-rating: divide o espaço meio a meio,
       divisor centralizado. justify-content:flex-end gruda o conteúdo
       (ícone + valor) na borda direita da sua metade. */
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.wr-cursos-grid .wrct-price-ico {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    margin-right: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e6f4ec;
    border-radius: 50%;
    color: #4e731f;
}

.wr-cursos-grid .wrct-price-ico svg {
    width: 14px;
    height: 14px;
    display: block;
}

.wr-cursos-grid .wrct-price-vals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 0;
}

.wr-cursos-grid .wrct-price-old {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    color: #d32f2f;
    text-decoration: line-through;
    white-space: nowrap;
}

.wr-cursos-grid .wrct-price-txt {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    color: #4e731f;
}

/* --- "Certificado Incluso" (só em cursos premium) --- */
.wr-cursos-grid .wrct-cert-incluso {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #0b7a37;
    text-transform: uppercase;
}

.wr-cursos-grid .wrct-cert-incluso-ico {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    display: inline-flex;
    color: #0b7a37;
}

.wr-cursos-grid .wrct-cert-incluso-ico svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* --- botão MATRICULAR --- */
.wr-cursos-grid .wrct-btn {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    margin: 15px 0 0;
    padding: 2px 7px;
    width: auto;
    background: linear-gradient(90deg, #db640d 0%, #ee6c0e 100%);
    border: 0;
    border-radius: 10px;
    color: #fff;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: .8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(238, 108, 14, .28);
    transition: filter .2s ease, transform .2s ease;
}

.wr-cursos-grid .wrct-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.wr-cursos-grid .wrct-btn-ico {
    display: inline-flex;
    margin-right: 12px;
    color: #fff;
}

.wr-cursos-grid .wrct-btn-ico svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* --- botão "Carregar mais" (injetado por ajax/pesquisaCursosGratisNew_v4.ajax.php
   e ajax/pesquisaCursosPremium_v2.ajax.php no fim do scroll infinito) --- */
.wr-cursos-grid .wrct-loadmore-wrap {
    display: flex;
    justify-content: center;
    margin: 26px 0 10px;
}

.wr-cursos-grid .wrct-loadmore-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 26px;
    background: #fff;
    border: 2px solid #588123;
    border-radius: 999px;
    color: #588123;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.wr-cursos-grid .wrct-loadmore-btn:hover {
    background: #588123;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.wr-cursos-grid .wrct-loadmore-ico {
    display: inline-flex;
    flex: 0 0 auto;
}

.wr-cursos-grid .wrct-loadmore-ico svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* --- fim da lista: "você já viu todos os cursos" + solicitar novo curso
   (injetado por ajax/pesquisaCursosGratisNew_v4.ajax.php e
   ajax/pesquisaCursosPremium_v2.ajax.php quando o lote devolvido vem
   menor que $max, ou seja, não há mais o que carregar) --- */
.wr-cursos-grid .wrct-endlist {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 560px;
    margin: 30px auto 10px;
    padding: 0;
}

.wr-cursos-grid .wrct-endlist-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: #148c4b;
}

.wr-cursos-grid .wrct-endlist-ico svg {
    width: 28px;
    height: 28px;
    display: block;
}

.wr-cursos-grid .wrct-endlist-tit {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 800;
    color: #15263d;
}

.wr-cursos-grid .wrct-endlist-sub {
    margin: 0 0 22px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    color: #5c6672;
}

.wr-cursos-grid .wrct-endlist-btn {
    /* mesmo botão laranja do MATRICULAR, ocupando a largura toda */
    width: 100%;
    margin: 0;
    font-weight: 500;
    font-family: 'Rubik';
}

/* #cursosnaoencontrados a{ color:#3c6800 !important } e
   #cursosnaoencontrados a:hover{ color:#61a900 !important } em
   css_wr_base.php (ID + !important) ganhariam do .wrct-endlist-btn acima;
   precisa do ID aqui também pra vencer por especificidade, nos dois
   estados. */
#cursosnaoencontrados .wrct-endlist-btn,
#cursosnaoencontrados .wrct-endlist-btn:hover {
    color: #fff !important;
}

/* -------------------------------------------------------------------------
   RESPONSIVO — mesma escada de colunas do .lista_cards_curso (corujinhas)
   ------------------------------------------------------------------------- */
@media (max-width: 500px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

@media (min-width: 501px) and (max-width: 800px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 801px) and (max-width: 1000px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1001px) and (max-width: 1300px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1920px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 2560px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

@media (min-width: 3840px) {
    .wr-cursos-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}
