/* ==========================================================================
   QuickPlayHub - Category & All-Games Bento Grid Styles (k4.games style)
   ========================================================================== */

:root {
    --k4-bg-dark: #0e0d1f;
    --k4-card-border-radius: 18px;
    --k4-card-large-radius: 22px;
}

body {
    background-color: var(--k4-bg-dark) !important;
}

.k4-category-page-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px 28px 60px;
    box-sizing: border-box;
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #ffffff;
}

/* ─── PAGE HEADER BAR (TITLE + COUNT + SORT) ─── */
.k4-cat-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 16px;
}

.k4-cat-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.k4-cat-main-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.k4-cat-heading-text h1 {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.k4-cat-subtitle {
    font-size: 13.5px;
    color: #9d98be;
    margin: 3px 0 0;
    font-weight: 500;
}

/* Sort Dropdown */
.k4-sort-wrap {
    position: relative;
    display: inline-block;
}

.k4-sort-select {
    appearance: none;
    -webkit-appearance: none;
    background: #191834 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 14px center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    padding: 8px 38px 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: border-color 0.15s, background-color 0.15s;
}

.k4-sort-select:hover,
.k4-sort-select:focus {
    background-color: #211f44;
    border-color: #7b68ee;
    outline: none;
}

/* ─── HORIZONTAL FILTER / PILL BAR ─── */
.k4-cat-pill-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 16px;
    margin-bottom: 24px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.k4-cat-pill-scroll::-webkit-scrollbar {
    display: none;
}

.k4-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #191834;
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #cfcbf0;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.k4-cat-pill img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.k4-cat-pill:hover {
    background: #25234a;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.k4-cat-pill.active {
    background: #7b68ee;
    color: #ffffff;
    border-color: #7b68ee;
    box-shadow: 0 2px 10px rgba(123, 104, 238, 0.35);
}

/* ─── K4 BENTO GRID OF TILES ─── */
.k4-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 160px;
    grid-auto-flow: dense;
    gap: 16px;
    width: 100%;
}

/* Individual Bento Card */
.k4-bento-card {
    position: relative;
    border-radius: var(--k4-card-border-radius);
    overflow: hidden;
    background: #191834;
    text-decoration: none;
    display: block;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s, border-color 0.22s;
}

.k4-bento-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

/* 2x2 Large Card Spans 2 columns and 2 rows */
.k4-bento-card.k4-tile-large {
    grid-column: span 2;
    grid-row: span 2;
    border-radius: var(--k4-card-large-radius);
}

/* Hover Zoom & Glow */
.k4-bento-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(123, 104, 238, 0.35);
    border-color: #7b68ee;
    z-index: 2;
}

.k4-bento-card:hover img {
    transform: scale(1.06);
}

/* Floating Title Pill on Bottom */
.k4-bento-title-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(14, 13, 31, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.k4-bento-card.k4-tile-large .k4-bento-title-badge {
    font-size: 13px;
    padding: 7px 12px;
    bottom: 12px;
    left: 12px;
    right: 12px;
    border-radius: 10px;
}

/* ─── PAGINATION BAR ─── */
.k4-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.k4-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: #191834;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #cfcbf0;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.k4-page-btn:hover {
    background: #25234a;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.k4-page-btn.active {
    background: #7b68ee;
    color: #ffffff;
    border-color: #7b68ee;
    box-shadow: 0 2px 10px rgba(123, 104, 238, 0.35);
}

.k4-page-dots {
    color: #7a7698;
    padding: 0 4px;
    font-weight: 700;
}

/* Empty State */
.k4-empty-category {
    text-align: center;
    padding: 80px 20px;
    background: #181734;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 20px;
}

.k4-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.k4-empty-category h3 {
    font-size: 20px;
    color: #ffffff;
    margin: 0 0 8px;
}

.k4-empty-category p {
    font-size: 14px;
    color: #9d98be;
    margin: 0 0 20px;
}

.k4-btn-explore {
    display: inline-block;
    background: #7b68ee;
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    transition: background 0.15s;
}

.k4-btn-explore:hover {
    background: #6c5ce7;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .k4-category-page-container {
        padding: 16px 14px 40px;
    }
    .k4-bento-grid {
        grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
        grid-auto-rows: 130px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .k4-bento-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 135px;
        gap: 10px;
    }
}
