/*
 * Game Collection Styles
 * Dark mode with subtle retro gaming aesthetic
 */

:root {
    /* Color palette */
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-elevated: #1a1a24;
    --bg-hover: #22222e;

    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555566;

    --accent-primary: #00d4aa;
    --accent-secondary: #7b68ee;
    --accent-warm: #ff6b6b;
    --accent-gold: #ffd700;
    --accent-info: #5eb3ff;

    --border-color: #2a2a3a;
    --border-glow: rgba(0, 212, 170, 0.3);

    /* Fonts */
    --font-display: 'Press Start 2P', cursive;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Sizing */
    --header-height: 70px;
    --card-width: 180px;
    --card-gap: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Scanline overlay effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    opacity: 0.4;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(18, 18, 26, 0.95) 100%);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.header-inner {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--accent-primary));
}

.logo-text {
    font-family: var(--font-display);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.logo-accent {
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-primary);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.1);
}

.nav-icon {
    font-size: 1rem;
}

.header-stats {
    margin-left: auto;
}

.stat-badge {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Main Content */
.main {
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 60px;
    min-height: 100vh;
}

.view {
    display: none;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 24px;
}

.view.active {
    display: block;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

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

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1rem;
}

.search-clear:hover {
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-select {
    padding: 10px 32px 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    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='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.filter-checkboxes {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.filter-checkbox-label:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-dir-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sort-dir-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sort-dir-btn.asc {
    transform: rotate(180deg);
}

.btn-clear {
    padding: 10px 16px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    color: var(--accent-warm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Results Info */
.results-info {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-width), 1fr));
    gap: var(--card-gap);
}

/* Game Card */
.game-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-medium);
    transform: translateY(0);
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-primary);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 212, 170, 0.15);
}

.game-card-image {
    position: relative;
    aspect-ratio: 3/4;
    background: var(--bg-elevated);
    overflow: hidden;
}

.game-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.game-card:hover .game-card-image img {
    transform: scale(1.05);
}

.game-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
}

/* Game card overlay on hover */
.game-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 50%,
        rgba(0, 0, 0, 0.9) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-medium);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.game-card:hover .game-card-overlay {
    opacity: 1;
}

.game-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.meta-badge.score {
    background: var(--accent-primary);
    color: var(--bg-dark);
}

.meta-badge.score.low {
    background: var(--accent-warm);
}

.meta-badge.hours {
    background: var(--accent-secondary);
    color: white;
}

/* Game card info */
.game-card-info {
    padding: 12px;
}

.game-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    position: relative;
}

.digital-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.9rem;
    color: var(--accent-info);;
    filter: drop-shadow(0 0 2px rgba(94, 179, 255, 0.5));
}

.game-card-platform {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Label badges */
.game-card-labels {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

.label-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Favorite star */
.game-card-favorite {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1.2rem;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.game-card:hover .game-card-favorite,
.game-card.is-favorite .game-card-favorite {
    opacity: 1;
}

.game-card.is-favorite .game-card-favorite {
    color: var(--accent-gold);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
    color: var(--text-secondary);
}

.loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-medium);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#modal-body {
    overflow-y: auto;
    max-height: 90vh;
}

/* Game Detail */
.game-detail {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

.game-detail-cover {
    aspect-ratio: 3/4;
    background: var(--bg-elevated);
    border-radius: 8px;
    overflow: hidden;
}

.game-detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-detail-content {
    padding: 32px 32px 32px 0;
}

.game-detail-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.game-detail-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.game-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.detail-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border-radius: 8px;
}

.detail-stat-icon {
    font-size: 1.2rem;
}

.detail-stat-value {
    font-weight: 600;
}

.detail-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.game-detail-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.game-detail-section {
    margin-bottom: 20px;
}

.game-detail-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.game-detail-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

.game-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-tag {
    padding: 6px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Stats View */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.stats-card.full-width {
    grid-column: 1 / -1;
}

.stats-card-title {
    font-family: var(--font-display);
    font-size: 0.7rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats-bar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-bar-label {
    flex: 0 0 120px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.stats-bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.stats-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bg-dark);
    min-width: fit-content;
}

/* Timeline chart */
.timeline-chart {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 20px 0;
}

.timeline-bar {
    flex: 1;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
    min-width: 4px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.timeline-bar:hover {
    background: var(--accent-secondary);
}

/* Recommend View */
.recommend-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px;
}

.recommend-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--accent-primary);
    text-shadow: 0 0 20px rgba(0, 212, 170, 0.4);
}

.recommend-subtitle {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.recommend-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 32px;
}

.recommend-filter {
    text-align: left;
}

.recommend-filter label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recommend-filter select {
    padding: 10px 32px 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    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='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 160px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding-top: 20px;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.recommend-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    color: var(--bg-dark);
    font-family: var(--font-display);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-medium);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.3);
}

.recommend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 212, 170, 0.4);
}

.recommend-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
}

.recommendation {
    margin-top: 40px;
}

.recommendation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: left;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 24px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recommendation-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 8px;
}

.recommendation-info h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.recommendation-info .platform {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.recommendation-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.recommendation-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recommendation-genres span {
    padding: 4px 10px;
    background: var(--bg-dark);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.no-recommendation {
    padding: 40px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .header-inner {
        gap: 20px;
    }

    .game-detail {
        grid-template-columns: 200px 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --card-width: 140px;
        --card-gap: 12px;
    }

    .header-inner {
        padding: 0 16px;
    }

    .logo-text {
        display: none;
    }

    .nav-link span:not(.nav-icon) {
        display: none;
    }

    .header-stats {
        display: none;
    }

    .filter-bar {
        padding: 16px;
    }

    .search-box {
        max-width: none;
        width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
        min-width: 0;
    }

    .game-detail {
        grid-template-columns: 1fr;
    }

    .game-detail-cover {
        max-width: 200px;
        margin: 24px auto 0;
    }

    .game-detail-content {
        padding: 24px;
    }

    .recommendation-card {
        grid-template-columns: 1fr;
    }

    .recommendation-card img {
        max-width: 150px;
        margin: 0 auto;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}
