/* === К А Т А Л О Г === */

.page-header {
    width: 100%;
    text-align: left;
    padding: 0 2px;
}

.page-header h1 {
    margin-bottom: 4px;
}

.page-header .hint {
    font-size: 13px;
}

/* === П О И С К === */

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: var(--bg-secondary);
    height: 44px;
    padding: 0 14px;
    transition: border-color 0.2s ease;
    position: relative;
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box span {
    display: flex;
    align-items: center;
}

.search-box img {
    width: 18px;
    height: 18px;
    opacity: 0.5;
}

.search-box input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

/* === SORT BAR === */

.sort-bar {
    margin: 12px 0;
}

.sort-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.sort-select:focus {
    border-color: var(--accent);
}

.sort-select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px;
}

/* === AUTOCOMPLETE DROPDOWN === */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.autocomplete-item .game-name {
    color: var(--text-primary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.autocomplete-item .game-views {
    color: var(--text-secondary);
    font-size: 12px;
}

/* === К А Т Е Г О Р И И === */

.category-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-filter-bar::-webkit-scrollbar {
    display: none;
}

.category-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 20px;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-base);
    border: none;
    flex-shrink: 0;
}

.category-chip:hover {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

.category-chip:active {
    transform: scale(0.95);
}

/* Active category chip */
.category-chip.active {
    background-color: var(--accent);
    color: #000000;
    font-weight: 600;
}

.category-chip.active:active {
    background-color: var(--accent);
    opacity: 0.9;
}

/* === G A M E S   G R I D === */

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    padding: 0;
}

/* === S K E L E T O N === */

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.skeleton-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-poster {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-elevated) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-text {
    height: 16px;
    margin: 12px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-elevated) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-card:nth-child(odd) .skeleton-text {
    width: 70%;
}

.skeleton-card:nth-child(even) .skeleton-text {
    width: 50%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === L O A D   M O R E === */

.load-more-trigger {
    width: 100%;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.load-more-trigger.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === E M P T Y   S T A T E === */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    width: 100%;
    gap: 16px;
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-state .empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.empty-state .hint {
    font-size: 14px;
    max-width: 280px;
    line-height: 1.5;
}

/* === G A M E   C A R D === */

.games-grid .card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition-base);
    text-decoration: none;
}

.games-grid .card:active {
    transform: scale(0.95);
}

.games-grid .card .image-box {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background-color: var(--bg-secondary);
    box-shadow: var(--shadow-md);
}

.games-grid .card .image-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.games-grid .card:active .image-box::after {
    opacity: 1;
}

.games-grid .main-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.games-grid .card-badge {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2;
}

.games-grid .rating-badge {
    top: 8px;
    left: 8px;
    background-color: rgba(255, 159, 10, 0.9);
    color: #000;
}

.games-grid .rating-badge.zero {
    background-color: rgba(255, 69, 58, 0.9);
    color: #fff;
}

.games-grid .accounts-badge {
    bottom: 8px;
    right: 8px;
    background-color: rgba(36, 129, 204, 0.9);
    color: #fff;
}

.games-grid .accounts-badge.zero {
    background-color: rgba(255, 69, 58, 0.9);
    color: #fff;
}

.games-grid .icons {
    width: 10px;
    height: 10px;
}

.games-grid .card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 4px;
}

.games-grid .card-info h2 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
    margin: 0;
}

.games-grid .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.games-grid .views {
    font-size: 11px;
    color: var(--text-secondary);
}
