/* ============================================
   GAME CARDS — modern style
   ============================================ */

/* Grid */
.space-units-archive-items {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.gcard-item {
    width: 100% !important;
    min-width: 0;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}
/* Pārrakstīt Mercury stilus */
.space-units-archive-items .game-item,
.space-units-archive-items .box-20 {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
 
/* Kartīte */
.gcard {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #eaedf0;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: all 0.25s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.gcard:hover {
    border-color: #c4b5fd;
    box-shadow: 0 8px 24px rgba(92,38,152,0.12);
    transform: translateY(-4px);
}

/* Attēls */
.gcard-img {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f3f4f6;
}
.gcard-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.gcard:hover .gcard-img img {
    transform: scale(1.06);
}

/* Play overlay */
.gcard-overlay {
    position: absolute;
    inset: 0;
    background: rgba(92, 38, 152, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.gcard:hover .gcard-overlay {
    background: rgba(92, 38, 152, 0.4);
}
.gcard-play-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s;
}
.gcard:hover .gcard-play-icon {
    opacity: 1;
    transform: scale(1);
}
.gcard-play-icon svg {
    margin-left: 3px;
}

/* Kategorijas badge */
.gcard-cat {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 9px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.6em;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Body */
.gcard-body {
    padding: 12px 14px 4px;
    flex: 1;
}
.gcard-title {
    font-size: 0.88em;
    font-weight: 700;
    color: #151515;
    margin: 0 0 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gcard-vendor {
    font-size: 0.72em;
    font-weight: 600;
    color: #5c2698;
}

/* Footer — poga */
.gcard-footer {
    padding: 0 14px 14px;
}
.gcard-btn {
    display: block;
    padding: 9px 12px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border-radius: 8px;
    font-size: 0.78em;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s;
}
.gcard:hover .gcard-btn {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 3px 10px rgba(16,185,129,0.3);
}

/* Paslēpt veco joslu uzreiz — novērš mirgošanu pirms JS aizstāšanas */
.space-categories-list-box:has(~ .space-units-archive-items),
.space-categories-list-box.gfilter-replacing {
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   FILTER BAR — kategorijas + meklēšana
   ============================================ */
.gfilter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}
.gfilter-cats {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
}
.gfilter-cats::-webkit-scrollbar { display: none; }
.gfilter-cat {
    padding: 8px 18px;
    font-size: 0.85em;
    font-weight: 600;
    color: #7f8c8d;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.gfilter-cat:hover {
    color: #5c2698;
}
.gfilter-cat.active {
    color: #5c2698;
    border-bottom-color: #5c2698;
}

/* Meklēšanas lauks */
.gfilter-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: #f5f6fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.2s;
    min-width: 180px;
}
.gfilter-search:focus-within {
    border-color: #5c2698;
    box-shadow: 0 0 0 3px rgba(92,38,152,0.08);
    background: #fff;
}
.gfilter-search svg {
    color: #bbb;
    flex-shrink: 0;
}
.gfilter-search input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85em;
    color: #2e3246;
    width: 100%;
    height: auto !important;
    box-shadow: none !important;
}
.gfilter-search input::placeholder {
    color: #bbb;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .gfilter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .gfilter-cats {
        flex-wrap: wrap;
        gap: 6px;
    }
    .gfilter-cat {
        padding: 6px 14px;
        font-size: 0.8em;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        margin-bottom: 0;
    }
    .gfilter-cat.active {
        background: #5c2698;
        color: #fff;
        border-color: #5c2698;
    }
    .gfilter-search {
        min-width: 100%;
    }
}

/* ============================================
   SEARCH EMPTY STATE
   ============================================ */
.gfilter-empty {
    text-align: center;
    padding: 48px 20px 40px;
}
.gfilter-empty-icon {
    margin-bottom: 14px;
}
.gfilter-empty-text {
    font-size: 0.95em;
    color: #7f8c8d;
    margin: 0 0 20px;
}
.gfilter-empty-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.gfilter-suggest {
    padding: 7px 16px;
    background: #f5f6fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.82em;
    font-weight: 600;
    color: #2e3246;
    cursor: pointer;
    transition: all 0.2s;
}
.gfilter-suggest:hover {
    background: #5c2698;
    color: #fff;
    border-color: #5c2698;
    transform: translateY(-1px);
}

/* ============================================
   LOAD MORE — rādīt tikai pirmos 25
   ============================================ */
.space-units-archive-items > .gcard-item:nth-child(n+26) {
    display: none;
}
.space-units-archive-items.show-all > .gcard-item:nth-child(n+26) {
    display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media screen and (max-width: 1100px) {
    .space-units-archive-items {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media screen and (max-width: 900px) {
    .space-units-archive-items {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}
@media screen and (max-width: 600px) {
    .space-units-archive-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .gcard-body { padding: 10px 10px 4px; }
    .gcard-title { font-size: 0.82em; }
    .gcard-footer { padding: 0 10px 10px; }
    .gcard-btn { padding: 8px 10px; font-size: 0.75em; }
}
