/**
 * Copyright © ProPlayerFC. All rights reserved.
 * Home Feed - marketplace de campeonatos
 * Reutiliza tokens visuais do projeto, compatível com tournament-card existente
 */

/* Base: box-sizing para evitar overflow */
.proplayerfc-home-feed,
.proplayerfc-home-feed * {
    box-sizing: border-box;
}

.proplayerfc-home-feed {
    --feed-gray-50: #f9fafb;
    --feed-gray-100: #f3f4f6;
    --feed-gray-200: #e5e7eb;
    --feed-gray-300: #d1d5db;
    --feed-gray-400: #9ca3af;
    --feed-gray-500: #6b7280;
    --feed-gray-700: #1f2937;
    --feed-green: #059669;
    --feed-green-dark: #047857;
    padding: 24px 0;
    max-width: 1200px;
    margin: 0 auto;
    display: block !important;
    visibility: visible !important;
}

/* Barra de busca em destaque - garantir visibilidade e input ao lado do botão */
.proplayerfc-home-search {
    margin-bottom: 24px !important;
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
}

.proplayerfc-home-search .home-search-form {
    width: 100% !important;
    max-width: 920px !important;
    margin: 0 auto 20px !important;
}

.proplayerfc-home-search .home-search-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
}

/* Input texto - Buscar por nome do campeonato ou gamertag do admin */
.proplayerfc-home-search .home-search-input,
.proplayerfc-home-search .proplayerfc-search-input,
.proplayerfc-home-search input[type="search"],
.proplayerfc-home-search input[type="text"][name="q"],
.proplayerfc-home-search input[name="q"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 1 1 auto !important;
    min-width: 180px !important;
    width: auto !important;
    padding: 14px 20px !important;
    font-size: 16px !important;
    border: 2px solid var(--feed-gray-300) !important;
    border-radius: 12px !important;
    transition: border-color 0.2s !important;
    background: #ffffff !important;
    color: #1f2937 !important;
}

.proplayerfc-home-search .home-search-input:focus,
.proplayerfc-home-search .proplayerfc-search-input:focus,
.proplayerfc-home-search input[name="q"]:focus {
    outline: none !important;
    border-color: var(--feed-green) !important;
}

.proplayerfc-home-search .home-search-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 24px !important;
    background: linear-gradient(135deg, #111111 0%, #000000 100%) !important;
    color: #ffffff !important;
    border: 2px solid rgba(0, 0, 0, 0.65) !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    flex-shrink: 0 !important;
}

.proplayerfc-home-search .home-search-btn:hover {
    background: linear-gradient(135deg, #222222 0%, #111111 100%) !important;
    color: #ffffff !important;
}

.proplayerfc-home-search .home-create-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 24px !important;
    background: linear-gradient(135deg, var(--feed-green) 0%, var(--feed-green-dark) 100%) !important;
    color: #ffffff !important;
    border: 2px solid rgba(5, 150, 105, 0.38) !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    box-shadow: 0 12px 24px rgba(5, 150, 105, 0.2) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    flex-shrink: 0 !important;
}

.proplayerfc-home-search .home-create-btn:hover {
    color: #ffffff !important;
    filter: brightness(1.03) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 16px 28px rgba(5, 150, 105, 0.24) !important;
}

/* Filtros rápidos */
.proplayerfc-home-quick-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.proplayerfc-home-quick-filters .quick-filters-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--feed-gray-700);
}

.proplayerfc-home-quick-filters .quick-filters-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.proplayerfc-home-quick-filters .quick-filter-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--feed-gray-100);
    color: var(--feed-gray-700);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.proplayerfc-home-quick-filters .quick-filter-link:hover {
    background: var(--feed-gray-200);
    color: var(--feed-green-dark);
}

/* Seções de campeonatos */
.home-tournament-section {
    margin-bottom: 40px;
}

.home-tournament-section--open {
    margin-bottom: 48px;
}

.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.home-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--feed-gray-700);
    margin: 0;
}

.home-section-title i {
    color: var(--feed-green);
}

.home-section-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--feed-green);
    text-decoration: none;
    transition: color 0.2s;
}

.home-section-link:hover {
    color: var(--feed-green-dark);
}

/* Grid de cards - usa tournament-card.css (mesma estilização do profile) */
.proplayerfc-home-feed .tournaments-list {
    margin-bottom: 0;
}

/* Mobile - sem sobreposição, responsivo, sem float, sem corte */
@media (max-width: 768px) {
    .proplayerfc-home-feed {
        padding: 16px 16px 24px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .proplayerfc-home-search {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-bottom: 20px;
    }

    .proplayerfc-home-search .home-search-form {
        margin-bottom: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .proplayerfc-home-search .home-search-wrapper {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .proplayerfc-home-search .home-search-input,
    .proplayerfc-home-search .proplayerfc-search-input,
    .proplayerfc-home-search input[name="q"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-width: 0 !important;
        flex: 1 1 180px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .proplayerfc-home-search .home-search-btn {
        flex: 1 1 auto !important;
        min-width: 120px !important;
        max-width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .proplayerfc-home-search .home-create-btn {
        flex: 1 1 auto !important;
        min-width: 180px !important;
        max-width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    .proplayerfc-home-quick-filters {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 24px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .proplayerfc-home-quick-filters .quick-filters-label {
        margin-bottom: 4px;
    }

    .proplayerfc-home-quick-filters .quick-filters-links {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .proplayerfc-home-quick-filters .quick-filter-link {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .home-tournament-section {
        width: 100%;
        max-width: 100%;
        margin-bottom: 32px;
        box-sizing: border-box;
        overflow: visible;
    }

    .home-section-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 16px;
        gap: 12px;
        width: 100%;
    }

    .home-section-title {
        font-size: 18px;
        flex-wrap: wrap;
        word-break: break-word;
    }

    .home-section-link {
        flex-shrink: 0;
    }

}

/* Telas muito pequenas (320px+) */
@media (max-width: 480px) {
    .proplayerfc-home-feed {
        padding: 12px 12px 20px;
    }

    .proplayerfc-home-feed .tournament-card__header {
        padding: 12px 12px;
    }

    .proplayerfc-home-feed .tournament-logo {
        width: 48px;
        height: 48px;
    }

    .home-section-title {
        font-size: 16px;
    }
}
