@php
    $games = \App\Models\Game::where('individual_zone_id', $individualZone->id)->get();
@endphp

<div class="club-cards-row">
    @foreach($games as $game)
        <div class="club-card" style="background: {{ $game->background_color ?? '#f8f8f8' }};">
            <div class="club-card-icon">
                @if($game->icon)
                    <img src="{{ asset('storage/' . $game->icon) }}" alt="{{ $game->main_title }} icon">
                @else
                    <!-- fallback SVG icon -->
                    <svg width="40" height="40" fill="none" stroke="#34507B" stroke-width="2" viewBox="0 0 24 24">
                        <circle cx="12" cy="12" r="10"/>
                    </svg>
                @endif
            </div>
            <div class="club-card-title">{{ strtoupper($game->main_title) }}<br>SECTION</div>
            <div class="club-card-desc">
                {{ Str::words($game->description, 50) }}
            </div>
            {{-- <div class="game-section-desc">{{ Str::words($game->description, 50) }}</div> --}}
            <a href="{{ route('individualGame', $game->id) }}" class="game-section-join">JOIN</a>
        </div>
    @endforeach
</div>

<style>
.club-cards-row {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 100px;
}
.club-card {
    flex: 1 1 210px;
    max-width: 240px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.2rem 1.2rem 1.5rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    min-height: 320px;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
    background: #f8f8f8;
}
.club-card:hover {
    box-shadow: 0 6px 24px rgba(52,80,123,0.13);
    transform: translateY(-4px) scale(1.03);
}
.club-card-icon {
    margin-bottom: 1.2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.club-card-icon img, .club-card-icon svg {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.club-card-title {
    font-family: Poppins, Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #34507B;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}
.club-card-desc {
    font-size: 0.95rem;
    color: #555;
    text-align: center;
    margin-bottom: 1.2rem;
    margin-top: 0.2rem;
    min-height: 60px;
}
.club-card-join {
    color: #34507B;
    font-weight: 600;
    text-decoration: underline;
    font-size: 1rem;
    margin-top: auto;
    transition: color 0.2s;
}
.club-card-join:hover {
    color: #F3881B;
}
/* Enhanced responsive styles */
@media (max-width: 1200px) {
    .club-cards-row {
        gap: 1.8rem;
        margin: 1.8rem 0;
        padding: 0 80px;
    }
    .club-card {
        flex: 1 1 200px;
        max-width: 230px;
        min-width: 190px;
        padding: 2rem 1.1rem 1.4rem 1.1rem;
        min-height: 300px;
    }
    .club-card-icon {
        margin-bottom: 1.1rem;
        width: 42px;
        height: 42px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 38px;
        height: 38px;
    }
    .club-card-title {
        font-size: 1.05rem;
    }
    .club-card-desc {
        font-size: 0.9rem;
        margin-bottom: 1.1rem;
    }
    .game-section-join {
        font-size: 17px;
    }
}

@media (max-width: 992px) {
    .club-cards-row {
        gap: 1.5rem;
        margin: 1.6rem 0;
        padding: 0 60px;
    }
    .club-card {
        flex: 1 1 190px;
        max-width: 220px;
        min-width: 180px;
        padding: 1.8rem 1rem 1.3rem 1rem;
        min-height: 280px;
    }
    .club-card-icon {
        margin-bottom: 1rem;
        width: 40px;
        height: 40px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 36px;
        height: 36px;
    }
    .club-card-title {
        font-size: 1rem;
    }
    .club-card-desc {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    .game-section-join {
        font-size: 16px;
    }
}

@media (max-width: 900px) {
    .club-cards-row {
        flex-wrap: wrap;
        gap: 1.2rem;
        padding: 0 40px;
    }
    .club-card {
        min-width: 180px;
        max-width: 100%;
        padding: 1.6rem 0.9rem 1.2rem 0.9rem;
        min-height: 260px;
    }
    .club-card-icon {
        margin-bottom: 0.9rem;
        width: 38px;
        height: 38px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 34px;
        height: 34px;
    }
    .club-card-title {
        font-size: 0.95rem;
    }
    .club-card-desc {
        font-size: 0.8rem;
        margin-bottom: 0.9rem;
    }
    .game-section-join {
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    .club-cards-row {
        gap: 1rem;
        margin: 1.4rem 0;
        padding: 0 30px;
    }
    .club-card {
        padding: 1.4rem 0.8rem 1.1rem 0.8rem;
        min-height: 240px;
    }
    .club-card-icon {
        margin-bottom: 0.8rem;
        width: 36px;
        height: 36px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 32px;
        height: 32px;
    }
    .club-card-title {
        font-size: 0.9rem;
    }
    .club-card-desc {
        font-size: 0.75rem;
        margin-bottom: 0.8rem;
    }
    .game-section-join {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .club-cards-row {
        flex-direction: column;
        gap: 1rem;
        padding: 0 20px;
    }
    .club-card {
        min-width: unset;
        max-width: 100%;
        padding: 1.2rem 0.7rem 1rem 0.7rem;
        min-height: 220px;
    }
    .club-card-icon {
        margin-bottom: 0.7rem;
        width: 34px;
        height: 34px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 30px;
        height: 30px;
    }
    .club-card-title {
        font-size: 0.85rem;
    }
    .club-card-desc {
        font-size: 0.7rem;
        margin-bottom: 0.7rem;
    }
    .game-section-join {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .club-cards-row {
        gap: 0.8rem;
        margin: 1.2rem 0;
        padding: 0 15px;
    }
    .club-card {
        padding: 1rem 0.6rem 0.9rem 0.6rem;
        min-height: 200px;
    }
    .club-card-icon {
        margin-bottom: 0.6rem;
        width: 32px;
        height: 32px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 28px;
        height: 28px;
    }
    .club-card-title {
        font-size: 0.8rem;
    }
    .club-card-desc {
        font-size: 0.65rem;
        margin-bottom: 0.6rem;
    }
    .game-section-join {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .club-cards-row {
        gap: 0.6rem;
        margin: 1rem 0;
        padding: 0 10px;
    }
    .club-card {
        padding: 0.8rem 0.5rem 0.8rem 0.5rem;
        min-height: 180px;
    }
    .club-card-icon {
        margin-bottom: 0.5rem;
        width: 30px;
        height: 30px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 26px;
        height: 26px;
    }
    .club-card-title {
        font-size: 0.75rem;
    }
    .club-card-desc {
        font-size: 0.6rem;
        margin-bottom: 0.5rem;
    }
    .game-section-join {
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .club-cards-row {
        gap: 0.5rem;
        margin: 0.8rem 0;
        padding: 0 8px;
    }
    .club-card {
        padding: 0.6rem 0.4rem 0.7rem 0.4rem;
        min-height: 160px;
    }
    .club-card-icon {
        margin-bottom: 0.4rem;
        width: 28px;
        height: 28px;
    }
    .club-card-icon img, .club-card-icon svg {
        width: 24px;
        height: 24px;
    }
    .club-card-title {
        font-size: 0.7rem;
    }
    .club-card-desc {
        font-size: 0.55rem;
        margin-bottom: 0.4rem;
    }
    .game-section-join {
        font-size: 10px;
    }
}
.game-section-join {
    display: inline-block;
    color: #0A4978;
    font-family: Poppins, Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 2px;
    text-decoration: none;
    position: relative;
    margin-bottom: 0.5rem;
    text-align: center;
}
.game-section-join::after {
    content: "";
    display: block;
    margin: 0 auto;
    margin-top: 0.3rem;
    width: 100%;
    max-width: 110px;
    border-bottom: 2px solid #111;
}
</style>