/**
 * GoFrag Search Results Page v1.0.0
 * Тёмная тема, зелёные акценты — YOOtheme Vision Black Green
 */

/* ============================================
   ШАПКА: заголовок + поиск + сортировка
   ============================================ */

#gf-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

.gf-results__header {
    margin-bottom: 20px;
}

.gf-results__title {
    font-size: 22px;
    font-weight: 700;
    color: #eee;
    margin: 0 0 16px 0;
}

.gf-results__controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* --- Поле поиска --- */
.gf-results__search-wrap {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 500px;
}

.gf-results__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #4CAF50;
    pointer-events: none;
    opacity: 0.7;
}

input.gf-results__search-input {
    width: 100% !important;
    height: 42px !important;
    padding: 0 16px 0 42px !important;
    background: #1a1a1a !important;
    border: 1px solid rgba(76, 175, 80, 0.35) !important;
    border-radius: 8px !important;
    color: #e0e0e0 !important;
    font-family: inherit;
    font-size: 15px !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin: 0 !important;
    box-shadow: none !important;
    -webkit-appearance: none;
}

input.gf-results__search-input::placeholder {
    color: #777 !important;
}

input.gf-results__search-input:focus {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2) !important;
}

/* --- Сортировка --- */
.gf-results__sort {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.gf-results__sort-btn {
    padding: 8px 16px;
    border: 1px solid #444;
    border-radius: 6px;
    background: transparent;
    color: #999;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.gf-results__sort-btn:hover {
    color: #e0e0e0;
    border-color: #666;
}

.gf-results__sort-btn.active {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.4);
    color: #66BB6A;
}

/* --- Счётчик --- */
.gf-results__count {
    font-size: 13px;
    color: #777;
    margin-bottom: 16px;
    min-height: 20px;
}

/* ============================================
   СЕТКА КАРТОЧЕК
   ============================================ */

.gf-results__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ============================================
   КАРТОЧКА ИГРЫ
   ============================================ */

a.gf-card {
    display: block !important;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none !important;
    color: #e0e0e0 !important;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

a.gf-card:hover {
    border-color: rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    text-decoration: none !important;
    color: #e0e0e0 !important;
}

/* --- Постер --- */
.gf-card__poster-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #141414;
    overflow: hidden;
}

.gf-card__poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

a.gf-card:hover .gf-card__poster {
    transform: scale(1.03);
}

.gf-card__poster--empty {
    width: 100%;
    height: 100%;
    background: #2a2a2a;
}

/* --- Тело карточки --- */
.gf-card__body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gf-card__title {
    font-size: 14px;
    font-weight: 600;
    color: #eee;
    line-height: 1.3;
    /* Обрезка до 2 строк */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gf-card__meta {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Звёзды --- */
.gf-card__stars {
    display: flex;
    gap: 2px;
    margin-top: 2px;
    position: relative;
    cursor: default;
}

.gf-card__star {
    width: 13px;
    height: 13px;
}

.gf-card__star--on {
    color: #4CAF50;
}

.gf-card__star--off {
    color: #3a3a3a;
}

/* Tooltip */
.gf-card__stars[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: #111;
    color: #e0e0e0;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.gf-card__stars[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   ПОКАЗАТЬ ЕЩЁ
   ============================================ */

.gf-results__more-wrap {
    text-align: center;
    margin-top: 24px;
}

.gf-results__more-btn {
    padding: 12px 40px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    color: #66BB6A;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.gf-results__more-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

/* ============================================
   ЗАГРУЗКА / ПУСТО / ОШИБКА
   ============================================ */

.gf-results__loading {
    text-align: center;
    padding: 32px 16px;
    color: #888;
    font-size: 14px;
}

.gf-results__spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #444;
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: gf-results-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

.gf-results__empty {
    text-align: center;
    padding: 60px 20px;
}

.gf-results__empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.gf-results__empty-text {
    font-size: 18px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 8px;
}

.gf-results__empty-hint {
    font-size: 14px;
    color: #777;
}

.gf-results__error {
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
    font-size: 14px;
}

/* ============================================
   АДАПТИВ
   ============================================ */

@media (max-width: 1024px) {
    .gf-results__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .gf-results__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gf-results__controls {
        flex-direction: column;
        align-items: stretch;
    }

    .gf-results__search-wrap {
        max-width: none;
    }

    .gf-results__sort {
        justify-content: center;
    }

    .gf-results__title {
        font-size: 18px;
    }

    .gf-card__body {
        padding: 8px 10px 10px;
    }

    .gf-card__title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .gf-results__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gf-results__sort-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}
