/* ═══════════════════════════════════════════════════════════
   🎮 PS4 Game Store — PlayStation Store Style
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ps-blue: #006FCD;
    --ps-blue-dark: #003E74;
    --ps-blue-light: #0094FF;
    --bg-deep: #000000;
    --bg-primary: #0D0D0D;
    --bg-card: #1A1A1A;
    --bg-card-hover: #252525;
    --bg-surface: #141414;
    --text-white: #FFFFFF;
    --text-light: #E0E0E0;
    --text-muted: #888888;
    --text-dim: #555555;
    --gold: #FFB800;
    --green: #00C853;
    --red: #FF3B30;
    --purple: #A855F7;
    --radius: 8px;
    --card-radius: 4px;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-white);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    overflow-x: hidden;
}

/* ═══ Top Navigation ═══ */
.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    height: 64px;
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid #222;
    position: sticky;
    top: 0;
    z-index: 500;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: var(--text-white);
    background: var(--ps-blue);
}

.nav-stat {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* ═══ Hero Banner ═══ */
.hero {
    position: relative;
    height: 500px;
    overflow: hidden;
    margin-bottom: 32px;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.4);
    transform: scale(1.1);
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(transparent, var(--bg-deep));
}

.hero-content {
    position: absolute;
    bottom: 60px;
    right: 60px;
    z-index: 10;
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    background: var(--gold);
    color: #000;
    font-size: 13px;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.hero-title {
    font-size: 48px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 12px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.hero-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-light);
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hero-btn {
    background: var(--ps-blue);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 40px;
    cursor: pointer;
    transition: all 0.2s;
}

.hero-btn:hover,
.hero-btn:focus {
    background: var(--ps-blue-light);
    outline: 3px solid rgba(255, 255, 255, 0.4);
    transform: scale(1.03);
}

/* ═══ Category Rows (PS Store style) ═══ */
.game-rows {
    padding: 0 40px;
}

.row-section {
    margin-bottom: 40px;
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.row-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-white);
}

.row-more {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.row-more:hover {
    color: var(--ps-blue-light);
}

.row-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.row-scroll::-webkit-scrollbar {
    height: 4px;
}

.row-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.row-scroll::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* ═══ Game Card (PS Store Style) ═══ */
.game-card {
    flex-shrink: 0;
    width: 220px;
    cursor: pointer;
    transition: transform 0.2s;
    scroll-snap-align: start;
}

.game-card:hover,
.game-card:focus {
    transform: scale(1.05);
    outline: none;
}

.game-card:focus .card-poster {
    outline: 3px solid var(--ps-blue-light);
}

.card-poster {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: var(--card-radius);
    display: block;
    background: var(--bg-card);
    transition: outline 0.2s;
}

.card-title {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-sub {
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.card-sub .pkg-count {
    color: var(--green);
    font-weight: 700;
}

/* ═══ Browse Grid ═══ */
.genre-strip {
    display: flex;
    gap: 8px;
    padding: 16px 40px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.genre-pill {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

.genre-pill:hover,
.genre-pill:focus {
    color: var(--text-white);
    border-color: var(--ps-blue);
}

.genre-pill.active {
    background: var(--ps-blue);
    border-color: var(--ps-blue);
    color: white;
}

.sort-bar {
    padding: 0 40px 16px;
}

.sort-bar select {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 15px;
    padding: 10px 16px;
    cursor: pointer;
    outline: none;
}

.sort-bar select:focus {
    border-color: var(--ps-blue);
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 0 40px;
}

.browse-grid .game-card {
    width: auto;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 32px 40px;
}

.page-btn {
    background: var(--ps-blue);
    border: none;
    border-radius: var(--card-radius);
    color: white;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover,
.page-btn:focus {
    background: var(--ps-blue-light);
    outline: 2px solid white;
}

.page-btn:disabled {
    background: #333;
    cursor: default;
    outline: none;
}

.page-num {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
}

/* ═══ Search ═══ */
.search-section {
    padding: 40px;
}

.search-container {
    max-width: 700px;
    margin: 0 auto 32px;
}

.search-field {
    width: 100%;
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: var(--radius);
    color: var(--text-white);
    font-size: 22px;
    font-weight: 500;
    padding: 18px 24px;
    outline: none;
    transition: border-color 0.3s;
}

.search-field:focus {
    border-color: var(--ps-blue);
    box-shadow: 0 0 30px rgba(0, 111, 205, 0.2);
}

/* ═══ Detail Overlay ═══ */
.detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    overflow-y: auto;
    padding: 40px;
}

.detail-overlay.open {
    display: flex;
}

.detail-panel {
    background: var(--bg-primary);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Detail Header with bg image */
.detail-hero {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.detail-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    filter: brightness(0.35);
}

.detail-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(transparent, var(--bg-primary));
}

.detail-hero-content {
    position: absolute;
    bottom: 24px;
    right: 24px;
    left: 24px;
    z-index: 5;
    display: flex;
    gap: 20px;
    align-items: flex-end;
}

.detail-poster {
    width: 140px;
    border-radius: var(--card-radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.detail-title-area {
    flex: 1;
}

.detail-title {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 8px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dtag {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.dtag.gold {
    color: var(--gold);
    border: 1px solid var(--gold);
    background: rgba(255, 184, 0, 0.1);
}

.detail-close {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 22px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.detail-close:hover,
.detail-close:focus {
    background: var(--red);
    outline: 2px solid white;
}

/* Detail Body */
.detail-body {
    padding: 24px;
}

.detail-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 24px;
    max-height: 100px;
    overflow: hidden;
}

/* PKG List */
.pkg-list-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--green);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pkg-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: var(--card-radius);
    padding: 12px 16px;
    margin-bottom: 6px;
    transition: border-color 0.2s;
}

.pkg-row:hover {
    border-color: var(--green);
}

.pkg-row-info {
    flex: 1;
    min-width: 0;
}

.pkg-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pkg-row-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.install-btn {
    background: var(--green);
    border: none;
    border-radius: var(--card-radius);
    color: white;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 24px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.install-btn:hover,
.install-btn:focus {
    background: #00E676;
    outline: 2px solid white;
    transform: scale(1.05);
}

.install-btn.sent {
    background: var(--ps-blue);
}

.install-btn.fail {
    background: var(--red);
}

/* Videos in detail */
.vid-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: var(--card-radius);
    padding: 10px 16px;
    margin-bottom: 6px;
}

.vid-row a {
    color: var(--ps-blue-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.vid-row a:hover {
    text-decoration: underline;
}

/* ═══ Toast ═══ */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ps-blue);
    color: white;
    padding: 14px 32px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    z-index: 2000;
    transition: transform 0.3s;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* ═══ Empty / Loading states ═══ */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-dim);
    font-size: 20px;
}

.empty-state .big-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}