/* =============================================================================
   PÁGINA DEDICADA DE LISTAGEM DE TORNEIOS
   Caminho: front/pages/torneios/css/torneios.css
   Regra 1: Não utilizar animações CSS de hover com movimento scale ou shadow
   Regra 2: Não utilizar em momento algum emojis
   ============================================================================= */

/* 1. Foco do Campo de Pesquisa (Estilo Idêntico ao da Página de Campos) */
#torneios-search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
}

/* 2. Filtros de Estado em Formato Pill */
.torneios-filters-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}

.torneios-status-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.torneio-filter-pill {
    padding: 0.65rem 1.25rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted, #475569);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    outline: none;
    line-height: normal;
}

.torneio-filter-pill:hover {
    color: var(--text-main, #0f172a);
    border-color: var(--text-main, #0f172a);
}

.torneio-filter-pill.active {
    background: var(--text-main, #0f172a);
    color: #ffffff;
    border-color: var(--text-main, #0f172a);
}

/* 3. Grelha de Cartões de Torneios */
.torneios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* Forçar a proporção exata da imagem/card (540/675) em todas as resoluções */
.torneios-grid .tournament-fullbleed-card {
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 540 / 675 !important;
    margin: 0 !important;
    cursor: pointer;
    overflow: hidden;
}

.torneios-grid .tournament-fullbleed-bg,
.torneios-grid .tournament-fullbleed-img {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 540 / 675 !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Espaçamento equilibrado do contentor até ao footer quando não há botão carregar mais */
.campos-page-container {
    margin-bottom: 2.5rem;
    padding-bottom: 0;
}

/* 4. Botão Ver Mais (+12 Torneios) - adiciona margem apenas quando existe */
.torneios-ver-mais-wrapper {
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 3.5rem;
}

.btn-ver-mais-torneios {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 2.75rem;
    border-radius: 9999px;
    background-color: var(--text-main, #0f172a);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid var(--text-main, #0f172a);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    outline: none;
    line-height: normal;
}

.btn-ver-mais-torneios:hover {
    background-color: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
}

.btn-ver-mais-torneios svg {
    flex-shrink: 0;
}

/* 5. Estado Vazio */
.torneios-empty-state {
    padding: 4rem 1.5rem;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 4rem;
}

/* 5. Responsividade Mobile & Tablet (< 992px) */
@media (max-width: 991px) {
    .torneios-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem;
    }

    .torneios-grid .tournament-fullbleed-card {
        max-width: 100% !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .torneios-grid .tournament-fullbleed-title {
        font-size: 1.15rem;
    }

    .torneios-grid .tournament-fullbleed-content {
        padding: 1.15rem;
        gap: 0.65rem;
    }

    .torneios-grid .tournament-fullbleed-btn {
        padding: 0.7rem 1rem;
        font-size: 0.825rem;
    }
}

@media (max-width: 768px) {
    .torneios-filters-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.75rem;
    }

    .torneios-filters-header .search-wrapper {
        max-width: 100% !important;
        width: 100%;
    }

    /* Melhora substancial da responsividade dos botões de filtro no mobile */
    .torneios-status-pills {
        width: 100%;
        display: flex;
        gap: 0.45rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding: 0.25rem 0.15rem 0.5rem 0.15rem;
        margin: 0;
        scrollbar-width: none;
    }

    .torneios-status-pills::-webkit-scrollbar {
        display: none;
    }

    .torneio-filter-pill {
        flex-shrink: 0;
        padding: 0.55rem 0.95rem;
        font-size: 0.8125rem;
        font-weight: 600;
        border-radius: 9999px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .campos-page-container {
        margin-bottom: 2.5rem;
        padding-bottom: 0.5rem;
    }

    .torneios-ver-mais-wrapper {
        margin-top: 2rem;
        margin-bottom: 3.5rem;
    }

    .btn-ver-mais-torneios {
        width: 100%;
        max-width: 320px;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Tablets e Ecrãs Médios (de 580px até 768px, incluindo 767.5px): GARANTIR 2 COLUNAS LADO A LADO */
@media (min-width: 580px) and (max-width: 768px) {
    .torneios-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    .torneios-grid .tournament-fullbleed-card {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Apenas ecrãs pequenos / smartphones (< 580px): 1 coluna centrada */
@media (max-width: 579px) {
    .torneios-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }

    .torneios-grid .tournament-fullbleed-card {
        max-width: 380px;
        margin: 0 auto !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 540 / 675 !important;
    }

    .torneio-filter-pill {
        padding: 0.5rem 0.85rem;
        font-size: 0.775rem;
    }
}

@media (max-width: 400px) {
    .torneios-grid .tournament-fullbleed-card {
        max-width: 100%;
    }
}
