/* =====================================================================
 * search.css  (v1.2.0)
 *
 *  - .rcx-search-wrap (input + dropdown)
 *  - .rcx-search-dropdown (suggestions list)
 *  - public game page (/games/<slug>)
 * ===================================================================== */

/* ---------- Shared search wrapper ---------- */

.rcx-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 560px;
}

.rcx-search-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary, #f1f5f9);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    padding: 10px 36px 10px 38px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
}
.rcx-search-input::placeholder { color: rgba(148, 163, 184, 0.75); }
.rcx-search-input:focus {
    border-color: var(--accent-primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background: rgba(15, 23, 42, 0.85);
}

.rcx-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.85);
    pointer-events: none;
    font-size: 16px;
    line-height: 1;
}

.rcx-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(148, 163, 184, 0.75);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    display: none;
    font-size: 14px;
}
.rcx-search-clear:hover { color: var(--text-primary, #f1f5f9); background: rgba(148, 163, 184, 0.1); }
.rcx-search-wrap.has-text .rcx-search-clear { display: inline-flex; }

.rcx-search--compact { max-width: 320px; }
.rcx-search--compact .rcx-search-input { padding: 7px 32px 7px 34px; font-size: 13px; border-radius: 8px; }
.rcx-search--compact .rcx-search-icon  { left: 10px; font-size: 14px; }
.rcx-search--compact .rcx-search-clear { right: 6px; }

.rcx-search--hero { max-width: 720px; margin: 0 auto; }
.rcx-search--hero .rcx-search-input {
    padding: 16px 42px 16px 48px;
    font-size: 17px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.rcx-search--hero .rcx-search-icon { left: 18px; font-size: 20px; }
.rcx-search--hero .rcx-search-clear { right: 14px; font-size: 18px; }

/* ---------- Dropdown ---------- */

.rcx-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.5);
    z-index: 1300;
    overflow: hidden;
    display: none;
    max-height: 480px;
    overflow-y: auto;
}
.rcx-search-wrap.is-open .rcx-search-dropdown { display: block; }

.rcx-suggest {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary, #f1f5f9);
    border-bottom: 1px solid rgba(51, 65, 85, 0.45);
    transition: background 0.12s;
}
.rcx-suggest:last-child { border-bottom: none; }
.rcx-suggest:hover,
.rcx-suggest.is-focused { background: rgba(59, 130, 246, 0.12); }

.rcx-suggest-img {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    object-fit: cover;
    background: #0f172a;
}
.rcx-suggest--runner .rcx-suggest-img { border-radius: 50%; }
.rcx-suggest-img.is-missing { opacity: 0.45; }

.rcx-suggest-body { flex: 1; min-width: 0; }
.rcx-suggest-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcx-suggest-sub {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rcx-suggest-label mark {
    background: rgba(245, 158, 11, 0.25);
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

.rcx-suggest-chip {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary, #94a3b8);
}
.rcx-suggest--runner .rcx-suggest-chip { background: rgba(124, 58, 237, 0.18); color: #c4b5fd; }
.rcx-suggest--game   .rcx-suggest-chip { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }

.rcx-suggest-empty,
.rcx-suggest-loading {
    padding: 16px 16px;
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
    text-align: center;
}

/* ---------- Public game page (/games/<slug>) ---------- */

body.games-public-page { background: var(--bg-dark, #0f172a); }

.games-public-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

.game-hero {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 28px;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    align-items: start;
}
@media (max-width: 720px) {
    .game-hero { grid-template-columns: 130px 1fr; gap: 16px; padding: 16px; }
}
@media (max-width: 480px) {
    .game-hero { grid-template-columns: 1fr; }
}

.game-hero-poster {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.game-hero-poster::before {
    content: '🎮';
    position: absolute;
    font-size: 48px;
    opacity: 0.4;
    pointer-events: none;
}
.game-hero-poster img {
    position: relative;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.game-hero-poster img.poster-missing { display: none; }

.game-hero-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-hero-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    line-height: 1.15;
    color: var(--text-primary, #f1f5f9);
    letter-spacing: -0.01em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
@media (max-width: 720px) { .game-hero-title { font-size: 22px; } }

.game-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}
.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 5px 11px;
    background: rgba(148, 163, 184, 0.13);
    color: var(--text-secondary, #94a3b8);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
}
.meta-chip i { font-size: 13px; opacity: 0.8; }
.meta-chip--year     { color: #fbbf24; background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.25); }
.meta-chip--genre    { color: #60a5fa; background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.25); }
.meta-chip--platform { color: #a78bfa; background: rgba(167, 139, 250, 0.1); border-color: rgba(167, 139, 250, 0.25); }

.game-hero-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin: 4px 0 0;
}
.total-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
}
.total-num {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.total-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #94a3b8);
    margin-top: 5px;
}

.game-hero-service {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed rgba(148, 163, 184, 0.15);
}
.svc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    padding: 2px 0;
}
.svc-chip i { font-size: 12px; opacity: 0.7; }
.svc-chip em { font-style: normal; color: var(--text-primary, #f1f5f9); font-weight: 600; }
.svc-chip code {
    font-size: 11px;
    color: var(--accent-primary, #3b82f6);
    background: rgba(59, 130, 246, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Menlo, monospace;
}

.game-section {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 22px;
}
.game-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.game-section-head h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary, #f1f5f9);
}
.game-section-head h2 i { color: var(--accent-primary, #3b82f6); }

.day-toggle {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    overflow: hidden;
}
.day-btn {
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    border: none;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.day-btn + .day-btn { border-left: 1px solid var(--border-color, #334155); }
.day-btn:hover { color: var(--text-primary, #f1f5f9); background: rgba(59, 130, 246, 0.08); }
.day-btn.is-active { color: #fff; background: var(--accent-primary, #3b82f6); }

.game-categories { display: grid; gap: 14px; }
.cat-block {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    padding: 14px 16px;
}
.cat-block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.cat-name { font-size: 15px; font-weight: 700; color: var(--text-primary, #f1f5f9); }
.cat-count { font-size: 12px; color: var(--text-secondary, #94a3b8); }

.cat-runners {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.cat-runner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(30, 41, 59, 0.65);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}
.cat-runner-row:hover { border-color: var(--accent-primary, #3b82f6); background: rgba(59, 130, 246, 0.08); }
.cat-runner-row .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #0f172a;
    object-fit: cover;
    flex-shrink: 0;
}
.cat-runner-row .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.cat-runner-row .pb {
    font-size: 12px;
    color: #10b981;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cat-runner-row .rank-pill {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

.game-activity { display: grid; gap: 8px; }
.act-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border-color, #334155);
    border-radius: 9px;
}
.act-row .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #0f172a;
    object-fit: cover;
    flex-shrink: 0;
}
.act-row .body { min-width: 0; }
.act-row .line1 {
    font-size: 13px;
    color: var(--text-primary, #f1f5f9);
    line-height: 1.3;
}
.act-row .line1 .runner-link {
    color: var(--text-primary, #f1f5f9);
    font-weight: 700;
    text-decoration: none;
}
.act-row .line1 .runner-link:hover { color: var(--accent-primary, #3b82f6); }
.act-row .line1 .category { color: var(--text-secondary, #94a3b8); }
.act-row .line2 {
    margin-top: 3px;
    font-size: 12px;
    font-weight: 700;
}
.act-row .date {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.loading-row {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
    font-style: italic;
}

/* Hero block on homepage */
.rcx-hero-search-block {
    max-width: 760px;
    margin: 0 auto 24px;
    padding: 0 16px;
}
.rcx-hero-search-block .hero-search-title {
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 560px) {
    .rcx-search--compact { max-width: none; flex: 1; }
}

/* --- Avatar placeholder (matches navbar/runner cards) --- */
.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    color: rgba(148, 163, 184, 0.7);
}
.avatar-placeholder i {
    font-size: 28px;
    line-height: 1;
}
.cat-runner-row .avatar.avatar-placeholder i { font-size: 24px; }
.act-row .avatar.avatar-placeholder i { font-size: 28px; }

/* --- Hover-lift for clickable activity rows --- */
a.act-row {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
a.act-row:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary, #3b82f6);
    background: rgba(59, 130, 246, 0.07);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(59, 130, 246, 0.18) inset;
}
a.act-row:hover .runner-link { color: var(--accent-primary, #3b82f6); }
