/**
 * Estilos para o shortcode de providers
 *
 * @package    Fntwork_Super_Downloads_Api
 * @subpackage Fntwork_Super_Downloads_Api/public/css
 */

.super-downloads-providers-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.super-downloads-providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    /*
     * auto: cada linha cresce pelo card mais alto DELA. O alinhamento dentro da
     * linha vem do `align-items: stretch` (padrão do grid) + height:100% no card.
     * Com 1fr todas as linhas herdavam a altura da mais alta da grade inteira.
     */
    grid-auto-rows: auto;
    gap: 20px;
    margin-top: 30px;
}

.provider-card {
    display: flex;
    flex-direction: column;
    /* Ocupa a altura da linha do grid: cards da mesma linha terminam juntos. */
    height: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e1e5e9;
}

.provider-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/*
 * Banner horizontal da marca no lugar do ícone quadrado: o provider tem uma
 * arte larga (viewBox de 3:1 a 6:1), que fica ilegível espremida num quadrado
 * de 120px. A faixa mantém a proporção e centraliza a imagem.
 */
.provider-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    /* altura fixa (104px): aspect-ratio arredondava 1px entre colunas e o
       wordmark do Canva encostava no topo da faixa */
    height: 104px;
    padding: 22px 26px;
    background: linear-gradient(135deg, var(--provider-tint-a, #f8f9fa), var(--provider-tint-b, #eef4ff));
    border-bottom: 1px solid #e1e5e9;
}

/* O tema também estiliza .mp-sd .provider-banner; este seletor mais
   específico garante que o gradiente por provider prevaleça. */
.mp-sd .super-downloads-providers-container .provider-banner,
html[data-theme="dark"] .mp-sd .super-downloads-providers-container .provider-banner {
    background: linear-gradient(135deg, var(--provider-tint-a, #f8f9fa), var(--provider-tint-b, #eef4ff));
}

/* Normaliza a altura óptica dos wordmarks; o tema define max-height:100%
   em .mp-sd, por isso este seletor mais específico. */
.mp-sd .super-downloads-providers-container .provider-banner {
    display: flex;
    flex: 0 0 104px;
    align-items: center;
    justify-content: center;
    height: 104px;
    min-height: 104px;
    max-height: 104px;
}

/* Every logo gets the same optical stage: 38px high and centered. */
.mp-sd .super-downloads-providers-container .provider-banner img,
html[data-theme="dark"] .mp-sd .super-downloads-providers-container .provider-banner img {
    display: block;
    width: 100%;
    height: 38px;
    max-width: 100%;
    max-height: 38px;
    object-fit: contain;
}

/* Artlist's official combination is yellow + black. Its yellow wordmark
   disappears on a pale yellow tint, so use the black version of the mark. */
.mp-sd .super-downloads-providers-container .provider-banner--artlist img {
    filter: brightness(0) saturate(0);
}

/* Flaticon mixes a green isotype with navy typography; a soft edge keeps the
   green mark separated from the pale blue cover. */
.mp-sd .super-downloads-providers-container .provider-banner--flaticon img {
    filter: drop-shadow(0 0 1px rgba(14, 42, 71, 0.45));
}

/* Canva's short wordmark needs a larger stage to read at gallery size. */
.mp-sd .super-downloads-providers-container .provider-banner--canva img {
    height: 52px;
    max-height: 52px;
}

.provider-banner img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.provider-banner--empty {
    color: #9aa0a6;
    font-size: 1.6em;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.provider-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 20px;
}

.provider-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.provider-name {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/*
 * Selo de acesso: "Liberado" quando o usuário logado pode baixar dessa
 * plataforma, "Fora do plano" quando não pode. Visitante deslogado não vê
 * selo (o plugin não tem como afirmar o acesso).
 */
.provider-access {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7em;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.provider-access--on {
    background: #e0f2e9;
    color: #0b7b4b;
}

.provider-access--off {
    background: #f1f1ee;
    color: #6b6f76;
}

.provider-url {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.9em;
    margin-bottom: 15px;
    display: block;
    word-break: break-all;
}

.provider-url:hover {
    text-decoration: underline;
}

.provider-description {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
    /*
     * Folga mínima entre o texto e o botão. O botão usa `margin-top: auto`, que
     * consome só o espaço livre; sem esta margem, texto longo encosta no botão.
     */
    margin: 0 0 0.9rem;
}

/*
 * Categorias de download dentro da descrição (7.36.0).
 *
 * As pílulas vivem no fluxo do texto — não criam bloco novo, então o card não
 * cresce e nenhum vizinho fica com espaço vazio. `inline-block` (e não flex)
 * mantém o texto da pílula na mesma baseline da frase.
 */
.provider-description .sda-cat {
    display: inline-block;
    padding: 0 5px;
    margin: 0 1px;
    border: 1px solid #e3e6ea;
    border-radius: 5px;
    background: #f7f8fa;
    color: #2b3038;
    font-size: 0.85em;
    line-height: 1.45;
    white-space: nowrap;
}

.provider-description .sda-cat i {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--sda-cat-dot, #9aa0a6);
    vertical-align: 1px;
}

.provider-description .sda-cat--locked {
    background: transparent;
    border-style: dashed;
    color: #9096a0;
}

.provider-description .sda-cat--locked i {
    background: #c9ced5;
}

.provider-description .sda-cat__lock {
    width: 9px;
    height: 9px;
    margin-left: 3px;
    vertical-align: -1px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    opacity: 0.7;
}

.no-providers {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

@media (max-width: 768px) {
    .super-downloads-providers-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .super-downloads-providers-container {
        padding: 15px;
    }

    .provider-banner {
        padding: 18px 20px;
    }
}

@media (max-width: 480px) {
    .super-downloads-providers-grid {
        grid-template-columns: 1fr;
    }
}

/* Botao unico do card: abre o repositorio, a pagina do produto ou o acesso */
.provider-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: auto;
    padding: 0.7rem 1.1rem;
    border: 0;
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

/* Card bloqueado: mesmo botao, saida em outline para nao parecer liberado */
.provider-card[data-provider-access="off"] .provider-cta {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.provider-card[data-provider-access="off"] .provider-cta--solid {
    background: #0f172a;
    color: #fff;
}

.provider-cta--outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.provider-cta--outline:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.provider-cta__arrow {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}

.provider-cta:hover .provider-cta__arrow {
    transform: translate(2px, -2px);
}

.provider-cta:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.provider-cta:hover {
    background: #1e293b;
    color: #fff;
}

/* Saída para o card bloqueado: leva ao produto que libera a plataforma */
.provider-unlock {
    display: inline-flex;
    align-items: center;
    margin-top: 0.85rem;
    color: #0066cc;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
}

.provider-unlock:hover {
    text-decoration: underline;
}

/* Ações do card: plataforma + operações liberadas pelo admin. */
.provider-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.provider-actions .provider-cta {
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    box-sizing: border-box;
}

.provider-cta--account {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

/* CTA único que abre o menu de operações. */
.provider-cta--menu {
    justify-content: center;
    gap: 0.35rem;
    border: 0;
}

.provider-cta--menu svg {
    transition: transform 0.16s ease;
}

.provider-cta--menu[aria-expanded="true"] svg {
    transform: rotate(180deg);
}


/* O tema pode estilizar <button> de forma genérica (fundo/borda da marca);
   o CTA sólido do card é a nossa UI e mantém o contraste do design system. */
.super-downloads-providers-container .provider-cta--solid {
	background: #14161a !important;
	border: 0 !important;
	color: #fff !important;
}

.super-downloads-providers-container .provider-cta--solid:hover {
	background: #24272d !important;
}
