/* ============================================
   Hub Mobile-First Improvements
   Better touch targets, responsive layouts
   ============================================ */

/* Base Hub styling (desktop + mobile). The template previously used inline styles. */
.hub-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.hub-view-toggle {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.25rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.view-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.hub-filters {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hub-filters::-webkit-scrollbar {
    display: none;
}

.hub-filters-inner {
    display: inline-flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
}

.filter-btn {
    position: relative;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-size: 0.875rem;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

/* Active state: no bright cyan fill; use subtle glass + accent underline */
.filter-btn.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.filter-btn.active::after {
    content: '';
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.3rem;
    height: 2px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0.55;
}

/* Mobile-first defaults */
@media (max-width: 640px) {
    /* Header */
    .hub-header h1 {
        font-size: 1.75rem !important;
    }
    
    .hub-header p {
        font-size: 1rem !important;
    }
    
    /* Search & Controls */
    .hub-controls {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .hub-search {
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .hub-sort-select {
        width: 100% !important;
    }
    
    .hub-view-toggle {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Filter buttons - scrollable */
    .hub-filters {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        padding: 0.25rem 0 !important;
        margin: 0 -1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .hub-filters::-webkit-scrollbar {
        display: none !important;
    }
    
    .hub-filters-inner {
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
    }
    
    .filter-btn {
        flex-shrink: 0 !important;
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
        white-space: nowrap !important;
    }
    
    /* Game Grid - Single column on mobile */
    .game-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        padding: 0 !important;
    }
    
    /* Game Card - Full width, touch friendly */
    .game-card {
        border-radius: 1rem !important;
    }
    
    .game-card-image {
        height: 180px !important;
    }
    
    .game-card-content {
        padding: 1rem !important;
    }
    
    .game-card-title {
        font-size: 1.125rem !important;
    }
    
    .game-card-description {
        font-size: 0.875rem !important;
        min-height: auto !important;
    }
    
    /* Tags - smaller on mobile */
    .game-tags {
        gap: 0.375rem !important;
        flex-wrap: wrap !important;
    }
    
    .game-tag {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.6875rem !important;
    }
    
    /* Play button - larger touch target */
    .play-btn {
        padding: 0.875rem 1.5rem !important;
        font-size: 0.9375rem !important;
        min-height: 48px !important;
    }
    
    /* Stats row */
    .game-stats {
        font-size: 0.75rem !important;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1023px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    .game-card-image {
        height: 160px !important;
    }
}

/* List view mobile optimizations */
@media (max-width: 640px) {
    .game-grid.list-view {
        grid-template-columns: 1fr !important;
    }
    
    .game-grid.list-view .game-card {
        flex-direction: column !important;
    }
    
    .game-grid.list-view .game-card-image {
        width: 100% !important;
        height: 140px !important;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .game-card:hover {
        transform: none !important;
    }
    
    .game-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s !important;
    }
    
    .filter-btn:hover,
    .view-btn:hover {
        background: transparent !important;
    }
    
    .play-btn:active {
        transform: scale(0.95) !important;
    }
}

/* Safe area padding for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .game-grid {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}
