/* ============================================================================
   joomsport-players.css - Mogiana FC (VERSÃO CORRIGIDA - IMAGENS FUNCIONANDO)
============================================================================ */

/* CONTAINER PRINCIPAL - FAIXA AZUL PONTA A PONTA */
.mg-players-container {
    padding: 20px 0;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    position: relative;
    overflow: hidden;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    left: 0;
    right: 0;
    box-sizing: border-box;
}

.mg-players-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23ffffff" fill-opacity="0.03"><circle cx="30" cy="30" r="4"/></g></g></svg>');
    pointer-events: none;
}

/* TÍTULO DA CATEGORIA */
.mg-categoria-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    padding: 0 20px;
}

.mg-categoria-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #fbbf24;
    margin: 10px auto 0;
    border-radius: 2px;
}

/* CONTAINER DO SLIDER */
.mg-players-slider-container {
    max-width: 2000px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    padding: 0 20px;
}

/* GRID/SLIDER */
.mg-players-grid,
.mg-players-slider {
    display: flex;
    gap: 20px;
    transition: transform 0.6s ease-in-out;
    padding: 10px 0;
    will-change: transform;
    flex-wrap: nowrap;
}

/* CARD DO JOGADOR */
.mg-player-card {
    flex: 0 0 auto;
    width: 195px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    position: relative;
    border: 2px solid transparent;
    animation: fadeInUp 0.6s ease forwards;
}

.mg-player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
    border-color: #fbbf24;
}

/* ============================================================================
   SEÇÃO CRÍTICA - CONTAINER DA IMAGEM (CORRIGIDO)
============================================================================ */
.mg-player-image {
    width: 100%;
    height: 260px;
    position: relative;
    overflow: hidden;
    /* Fundo padrão transparente - SERÁ SOBRESCRITO SE NÃO HOUVER IMAGEM */
    background: transparent;
}

/* QUANDO TEM IMAGEM (classe adicionada dinamicamente) */
.mg-player-image.has-image {
    background: transparent !important;
}

.mg-player-image.has-image::before {
    content: none !important;
}

/* QUANDO NÃO TEM IMAGEM (classe adicionada dinamicamente) */
.mg-player-image.no-image {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ============================================================================
   IMAGEM DO JOGADOR - REGRAS GARANTIDAS
============================================================================ */
.mg-player-image img.mg-player-photo {
    /* REGRAS BASE - SEMPRE APLICADAS */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
    position: relative !important;
    z-index: 2 !important;
    transition: transform 0.4s ease !important;
}

/* Hover na imagem */
.mg-player-card:hover .mg-player-image img.mg-player-photo {
    transform: scale(1.05) !important;
}

/* ============================================================================
   PLACEHOLDER (SÓ APARECE QUANDO NÃO TEM IMAGEM)
============================================================================ */
.player-placeholder {
    display: none; /* Escondido por padrão */
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: rgba(255, 255, 255, 0.7);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Mostrar placeholder APENAS quando não tem imagem */
.mg-player-image.no-image .player-placeholder {
    display: flex !important;
}

/* Esconder placeholder quando tem imagem */
.mg-player-image.has-image .player-placeholder {
    display: none !important;
}

/* ============================================================================
   NÚMERO DA CAMISA
============================================================================ */
.mg-player-number {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
    color: #ffffff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 3px 8px rgba(30, 58, 138, 0.4);
    z-index: 3;
    border: 2px solid #ffffff;
}

/* ============================================================================
   INFORMAÇÕES DO JOGADOR
============================================================================ */
.mg-player-info {
    padding: 13px;
    text-align: center;
    background: #ffffff;
}

.mg-player-name {
    font-size: 16px;
    font-weight: 800;
    color: #1e3a8a;
    margin: 0 0 5px 0;
    line-height: 1.2;
    min-height: 19px;
}

.mg-player-position {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 14px;
}

.mg-player-position.mg-position-empty {
    color: #9ca3af;
    font-style: italic;
    font-weight: normal;
    text-transform: none;
}

.mg-player-link {
    display: inline-block;
    margin-top: 8px;
    color: #1e3a8a;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.3s ease;
}

.mg-player-link:hover {
    color: #fbbf24;
}

/* ============================================================================
   CONTROLES DO SLIDER
============================================================================ */
.mg-slider-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding: 0 20px;
}

.mg-slider-prev,
.mg-slider-next {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #ffffff;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-slider-prev:hover,
.mg-slider-next:hover {
    background: #ffffff;
    color: #1e3a8a;
    transform: scale(1.1);
}

/* ============================================================================
   MENSAGEM QUANDO NÃO HÁ JOGADORES
============================================================================ */
.mg-no-players {
    text-align: center;
    padding: 40px 20px;
    color: #ffffff;
    font-size: 18px;
}

.mg-no-players p {
    margin: 0;
}

/* ============================================================================
   ANIMAÇÕES
============================================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   RESPONSIVIDADE
============================================================================ */
@media (max-width: 1200px) {
    .mg-player-card {
        width: 180px;
    }
    
    .mg-player-image {
        height: 240px;
    }
}

@media (max-width: 992px) {
    .mg-player-card {
        width: 160px;
    }
    
    .mg-player-image {
        height: 200px;
    }
    
    .mg-categoria-title {
        font-size: 1.7rem;
    }
}

@media (max-width: 768px) {
    .mg-players-container {
        padding: 15px 0;
    }
    
    .mg-categoria-title {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .mg-player-card {
        width: 150px;
    }
    
    .mg-player-image {
        height: 180px;
    }
    
    .mg-player-info {
        padding: 10px;
    }
    
    .mg-player-name {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .mg-player-card {
        width: 140px;
    }
    
    .mg-player-image {
        height: 160px;
    }
    
    .mg-categoria-title {
        font-size: 1.3rem;
        padding: 0 15px;
    }
    
    .mg-players-slider-container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .mg-player-card {
        width: 130px;
    }
    
    .mg-player-image {
        height: 150px;
    }
    
    .mg-player-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
        bottom: 8px;
        right: 8px;
    }
}

/* ============================================================================
   CORREÇÕES DE EMERGÊNCIA (IMPORTANTE!)
   Estas regras garantem que as imagens apareçam independentemente de outros estilos
============================================================================ */

/* 1. REMOVER QUALQUER ESTILO QUE OCULTE IMAGENS */
.mg-player-image * {
    box-sizing: border-box !important;
}

/* 2. GARANTIR QUE IMAGENS NUNCA SEJAM ESCONDIDAS */
img.mg-player-photo:not([src=""]) {
    min-height: 50px !important;
    min-width: 50px !important;
}

/* 3. SOBRESCREVER ESTILOS DE FUNDO CONFLITANTES */
.mg-player-image[style*="background"]:has(img.mg-player-photo[src*=".jpg"]),
.mg-player-image[style*="background"]:has(img.mg-player-photo[src*=".png"]),
.mg-player-image[style*="background"]:has(img.mg-player-photo[src*=".jpeg"]) {
    background: transparent !important;
    background-image: none !important;
}

/* 4. PREVENIR QUE PSEUDO-ELEMENTOS CUBRAM AS IMAGENS */
.mg-player-image.has-image::before,
.mg-player-image.has-image::after {
    content: none !important;
    display: none !important;
}

/* 5. GARANTIR VISIBILIDADE MESMO COM ERROS DE CARREGAMENTO */
.mg-player-image img.mg-player-photo {
    -webkit-backface-visibility: visible !important;
    backface-visibility: visible !important;
    -webkit-transform-style: preserve-3d !important;
    transform-style: preserve-3d !important;
}

/* 6. CORREÇÃO PARA FIREFOX */
@-moz-document url-prefix() {
    .mg-player-image img.mg-player-photo {
        image-rendering: -moz-crisp-edges !important;
    }
}

/* 7. CORREÇÃO PARA DISPOSITIVOS MÓVEIS */
@media (hover: none) and (pointer: coarse) {
    .mg-player-image img.mg-player-photo {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }
}

/* 8. GARANTIR QUE O PLACEHOLDER NÃO INTERFIRA */
.mg-player-image:has(img.mg-player-photo[src]:not([src=""])) .player-placeholder {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 9. REMOVER BORDAS CONFLITANTES */
.mg-player-image img {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* 10. ÚLTIMA GARANTIA - FORÇAR DISPLAY */
.mg-player-image:has(> img.mg-player-photo) {
    display: block !important;
}

.mg-player-image:has(> img.mg-player-photo) > img.mg-player-photo {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
}

/* ============================================================================
   REMOÇÃO DEFINITIVA DO PROBLEMA mg-no-photo
============================================================================ */

/* 1. SOBRESCREVER QUALQUER ESTILO DA CLASSE mg-no-photo */
.mg-player-image.mg-no-photo {
    background: transparent !important;
    background-image: none !important;
}

/* 2. QUANDO TEM IMAGEM (classe adicionada pelo JavaScript) */
.mg-player-image.has-image {
    background: transparent !important;
}

.mg-player-image.has-image img.mg-player-photo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 3. QUANDO NÃO TEM IMAGEM (classe adicionada pelo JavaScript) */
.mg-player-image.no-image {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%) !important;
}

.mg-player-image.no-image .player-placeholder {
    display: flex !important;
}

/* 4. GARANTIA FINAL: Se tem src válido, mostra imagem! */
.mg-player-image img[src*=".jpg"],
.mg-player-image img[src*=".jpeg"],
.mg-player-image img[src*=".png"],
.mg-player-image img[src*=".webp"] {
    display: block !important;
    visibility: visible !important;
}