/* === Variables === */
:root {
    --bg: #0a0e1a;
    --bg-card: #141b2d;
    --bg-input: #1e2942;
    --text: #e4e6eb;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    --accent: #5b8def;
    --accent-hover: #7ba5f5;
    --accent-glow: rgba(91, 141, 239, 0.4);
    --accent-bright: #93c5fd;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --purple: #a78bfa;
    --pink: #ec4899;
    --border: #1e2942;
    --radius: 16px;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 12px 25px -6px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 35px 60px -15px rgba(0, 0, 0, 0.6);

    --status-backlog: #94a3b8;
    --status-playing: #5b8def;
    --status-completed: #10b981;
    --status-abandoned: #ef4444;
    --status-wishlist: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: #0a0e1a;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(91, 141, 239, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(236, 72, 153, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(91, 141, 239, 0.02) 2px,
            rgba(91, 141, 239, 0.02) 4px
        );
    pointer-events: none;
    z-index: 1;
}

body > * {
    position: relative;
    z-index: 2;
}

a { color: var(--accent); text-decoration: none; transition: all 0.3s; }
a:hover { color: var(--accent-hover); }

/* === Navbar === */
.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 2.5rem;
    background: rgba(20, 27, 45, 0.95);
    backdrop-filter: blur(30px) saturate(180%);
    border-bottom: 2px solid rgba(91, 141, 239, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(91, 141, 239, 0.1);
}

.nav-brand a {
    font-size: 1.75rem;
    font-weight: 900;
    background: linear-gradient(135deg, #5b8def 0%, #a78bfa 50%, #ec4899 100%);
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    text-transform: uppercase;
    filter: drop-shadow(0 0 20px rgba(91, 141, 239, 0.3));
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

.nav-link {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    color: var(--text);
    transition: all 0.3s;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(91, 141, 239, 0.2), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover, .nav-link.active {
    background: rgba(91, 141, 239, 0.15);
    color: var(--text-white);
    box-shadow: 0 0 20px rgba(91, 141, 239, 0.2);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(91, 141, 239, 0.2) 0%, rgba(167, 139, 250, 0.1) 100%);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-username {
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* === Container === */
.container { max-width: 1600px; margin: 0 auto; padding: 2.5rem; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover { transform: translateY(-3px) scale(1.02); }
.btn:active { transform: translateY(-1px) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, #5b8def 0%, #a78bfa 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(91, 141, 239, 0.4), 0 4px 12px rgba(167, 139, 250, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
    box-shadow: 0 12px 32px rgba(91, 141, 239, 0.5), 0 6px 16px rgba(167, 139, 250, 0.3);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline {
    background: transparent;
    border: 3px solid var(--accent);
    color: var(--accent);
    font-weight: 700;
}
.btn-outline:hover {
    border-color: var(--accent-bright);
    color: var(--accent-bright);
    background: rgba(91, 141, 239, 0.1);
    box-shadow: 0 0 30px rgba(91, 141, 239, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.btn-sm { padding: 0.625rem 1.25rem; font-size: 0.875rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
    background: var(--bg-input);
    color: var(--text);
    padding: 0.75rem;
    min-width: 3rem;
    justify-content: center;
    border: 2px solid rgba(91, 141, 239, 0.2);
}
.btn-icon.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

/* === Forms === */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(30, 41, 66, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(91, 141, 239, 0.2);
    border-radius: 14px;
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(30, 41, 66, 0.9);
    box-shadow: 0 0 0 4px rgba(91, 141, 239, 0.15), 0 8px 24px rgba(91, 141, 239, 0.2);
    transform: translateY(-2px);
}
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

.form-row { display: flex; gap: 1.5rem; }
.form-row-inline { display: flex; gap: 1rem; }
.form-row-inline .form-group { flex: 1; }

/* === Alerts === */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-left: 5px solid;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: var(--danger);
}
.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: var(--success);
}
.alert-info {
    background: rgba(91, 141, 239, 0.15);
    color: #93c5fd;
    border-color: var(--accent);
}

/* === Auth pages === */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
    padding: 2rem;
}

.auth-card {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.95) 0%, rgba(30, 41, 66, 0.9) 100%);
    backdrop-filter: blur(20px);
    padding: 4rem;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    box-shadow:
        0 0 0 1px rgba(91, 141, 239, 0.2),
        0 30px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(91, 141, 239, 0.15);
    border: 2px solid rgba(91, 141, 239, 0.1);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(91, 141, 239, 0.1) 0%, transparent 70%);
    animation: auth-pulse 4s ease-in-out infinite;
}

@keyframes auth-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.5; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 0.8; }
}

.auth-card > * {
    position: relative;
    z-index: 1;
}

.auth-card h1 {
    text-align: center;
    font-size: 2.75rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #5b8def 0%, #a78bfa 50%, #ec4899 100%);
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    filter: drop-shadow(0 0 30px rgba(91, 141, 239, 0.4));
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
}

.auth-info {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.7;
}

.auth-switch {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 1rem;
}

.auth-switch a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
}

/* === Page header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* === Filters bar === */
.filters-bar {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
    align-items: center;
}

.filters-bar .filter-group { flex: 1; min-width: 200px; }
.filters-bar .filter-group:first-child { flex: 2; }
.filters-bar .filter-group:last-child { flex: 0; display: flex; gap: 0.75rem; min-width: auto; }

/* === Game grid === */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
}

.game-card {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: var(--text);
    border: 2px solid rgba(91, 141, 239, 0.1);
    position: relative;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(91, 141, 239, 0.1) 0%, rgba(167, 139, 250, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s;
    z-index: 1;
}

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

.game-card:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.6),
        0 0 0 2px rgba(91, 141, 239, 0.5),
        0 0 40px rgba(91, 141, 239, 0.3);
    border-color: rgba(91, 141, 239, 0.8);
    color: var(--text);
}

.game-cover {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: linear-gradient(135deg, #1e2942 0%, #0f1420 100%);
}
.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}
.game-card:hover .game-cover img {
    transform: scale(1.15);
}

.badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(15px) saturate(180%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 10;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.status-backlog { background: rgba(148, 163, 184, 0.95); color: white; }
.status-playing { background: rgba(91, 141, 239, 0.95); color: white; box-shadow: 0 4px 12px rgba(91, 141, 239, 0.5); }
.status-completed { background: rgba(16, 185, 129, 0.95); color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5); }
.status-abandoned { background: rgba(239, 68, 68, 0.95); color: white; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5); }
.status-wishlist { background: rgba(245, 158, 11, 0.95); color: white; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5); }

.game-info { padding: 1.25rem; position: relative; z-index: 2; }
.game-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 0.625rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.game-platform {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.game-rating {
    font-size: 0.85rem;
    color: var(--warning);
    margin-left: 0.625rem;
    font-weight: 700;
}

/* === Game list view === */
.games-list { display: flex; flex-direction: column; gap: 1.25rem; }

.games-list .game-card {
    display: flex;
    flex-direction: row;
}

.games-list .game-cover {
    width: 90px;
    aspect-ratio: auto;
    height: 120px;
    flex-shrink: 0;
}

.games-list .game-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.games-list .badge { position: static; }

/* === Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    border: 2px solid rgba(91, 141, 239, 0.15);
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(91, 141, 239, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(91, 141, 239, 0.2);
    border-color: rgba(91, 141, 239, 0.4);
}

.stat-card-primary {
    background: linear-gradient(135deg, rgba(91, 141, 239, 0.2) 0%, rgba(167, 139, 250, 0.1) 100%);
    border-color: rgba(91, 141, 239, 0.3);
}
.stat-number {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}
.stat-label {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.dashboard-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.dashboard-section {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 2px solid rgba(91, 141, 239, 0.1);
    box-shadow: var(--shadow);
}
.dashboard-section h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-bar-row { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.25rem; }
.stat-bar-label {
    width: 130px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    text-align: right;
    flex-shrink: 0;
}
.stat-bar-track {
    flex: 1;
    height: 12px;
    background: rgba(30, 41, 66, 0.8);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(91, 141, 239, 0.2);
}
.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b8def 0%, #a78bfa 100%);
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(91, 141, 239, 0.5);
    position: relative;
}
.stat-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}
.stat-bar-count {
    width: 50px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-white);
}

.recent-games-list { display: flex; flex-direction: column; gap: 1rem; }

.recent-game-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem;
    border-radius: 14px;
    transition: all 0.3s;
    color: var(--text);
    border: 2px solid transparent;
}

.recent-game-item:hover {
    background: rgba(91, 141, 239, 0.08);
    border-color: rgba(91, 141, 239, 0.3);
    color: var(--text);
    transform: translateX(8px);
}
.recent-game-item img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(91, 141, 239, 0.2);
}
.recent-game-item strong {
    display: block;
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 700;
}
.recent-game-item span {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 600;
}

/* === Game detail === */
.detail-layout { display: flex; gap: 3rem; }
.detail-cover { flex-shrink: 0; width: 350px; }
.detail-cover img {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(91, 141, 239, 0.2);
    border: 3px solid rgba(91, 141, 239, 0.2);
}
.detail-info { flex: 1; }
.detail-info h1 {
    color: var(--text-white);
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    line-height: 1.1;
}
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: var(--text-light);
}
.detail-meta strong {
    color: var(--text);
    font-weight: 700;
}
.detail-platforms { margin-bottom: 2rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.badge-platform {
    background: rgba(91, 141, 239, 0.15);
    backdrop-filter: blur(10px);
    color: var(--accent-bright);
    padding: 0.75rem 1.5rem;
    border-radius: 24px;
    font-size: 0.95rem;
    font-weight: 700;
    position: static;
    border: 2px solid rgba(91, 141, 239, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-description {
    margin-bottom: 2.5rem;
    color: var(--text);
    line-height: 1.8;
    font-size: 1.05rem;
}
.detail-form { margin-top: 2rem; }
.save-status { margin-left: 1rem; font-size: 1rem; font-weight: 700; }
.save-status.success { color: var(--success); }
.save-status.error { color: var(--danger); }

/* === Add game === */
.add-game-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 2.5rem; }
.search-section, .form-section {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 2px solid rgba(91, 141, 239, 0.1);
    box-shadow: var(--shadow);
}
.search-section h2, .form-section h2 {
    color: var(--text-white);
    margin-bottom: 2rem;
    font-size: 1.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-results { max-height: 600px; overflow-y: auto; }

.search-result {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.search-result:hover {
    background: rgba(91, 141, 239, 0.08);
    border-color: rgba(91, 141, 239, 0.3);
    transform: translateX(8px);
}
.search-result-cover {
    width: 70px;
    height: 95px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(91, 141, 239, 0.2);
}
.search-result-info { display: flex; flex-direction: column; justify-content: center; }
.search-result-info strong {
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}
.search-result-info span { color: var(--text-light); font-size: 0.875rem; font-weight: 600; }

.game-cover-preview { width: 220px; flex-shrink: 0; }
.game-cover-preview img {
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(91, 141, 239, 0.2);
}
.form-fields { flex: 1; }

/* === Import === */
.import-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 2.5rem; }
.import-card {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 2px solid rgba(91, 141, 239, 0.1);
    box-shadow: var(--shadow);
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
}
.import-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(91, 141, 239, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}
.import-card:hover::before {
    opacity: 1;
}
.import-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(91, 141, 239, 0.2);
    border-color: rgba(91, 141, 239, 0.3);
}
.import-card > * {
    position: relative;
    z-index: 1;
}
.import-card h2 {
    color: var(--text-white);
    margin-bottom: 1rem;
    font-size: 1.75rem;
    font-weight: 800;
}
.import-card p {
    color: var(--text);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
}
.import-card-manual {
    border: 3px dashed rgba(91, 141, 239, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(91, 141, 239, 0.03);
}
.import-help { margin-top: 1.5rem; font-size: 0.95rem; color: var(--text-light); }
.import-help summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    padding: 0.75rem;
    border-radius: 10px;
    transition: all 0.2s;
}
.import-help summary:hover {
    background: rgba(91, 141, 239, 0.15);
}
.import-help ol { padding-left: 1.75rem; margin-top: 1rem; line-height: 1.9; }

/* === Settings === */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 2.5rem; }
.settings-card {
    background: linear-gradient(135deg, rgba(20, 27, 45, 0.9) 0%, rgba(30, 41, 66, 0.8) 100%);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    border: 2px solid rgba(91, 141, 239, 0.1);
    box-shadow: var(--shadow);
}
.settings-card h2 {
    color: var(--text-white);
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.connected-list { display: flex; flex-direction: column; gap: 1rem; }
.connected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: rgba(30, 41, 66, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    border: 2px solid rgba(91, 141, 239, 0.15);
}
.connected-name { color: var(--text-white); font-weight: 700; font-size: 1rem; }
.connected-id { color: var(--text-light); font-size: 0.875rem; font-weight: 600; }
.connected-status {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.api-config-list { list-style: none; }
.api-config-list li {
    padding: 1rem 0;
    border-bottom: 2px solid rgba(91, 141, 239, 0.1);
    font-size: 1rem;
}
.api-config-list code {
    background: var(--bg-input);
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid rgba(91, 141, 239, 0.2);
    font-weight: 600;
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* === Empty/loading states === */
.empty-state {
    text-align: center;
    padding: 5rem;
    color: var(--text-light);
    font-size: 1.25rem;
    font-weight: 600;
}
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-light);
    font-size: 1.25rem;
    font-weight: 600;
}

/* === Mobile === */
@media (max-width: 768px) {
    .container { padding: 1.25rem; }
    .page-header h1 { font-size: 2rem; }

    .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: rgba(20, 27, 45, 0.98); padding: 1rem; border-bottom: 2px solid rgba(91, 141, 239, 0.2); backdrop-filter: blur(30px); }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }
    .nav-user .nav-username { display: none; }

    .filters-bar { flex-direction: column; }
    .filters-bar .filter-group { min-width: 100%; }

    .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.25rem; }

    .dashboard-sections { grid-template-columns: 1fr; }
    .detail-layout { flex-direction: column; }
    .detail-cover { width: 220px; }
    .detail-info h1 { font-size: 2rem; }
    .add-game-layout { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .settings-grid { grid-template-columns: 1fr; }
    .import-grid { grid-template-columns: 1fr; }

    .auth-card { padding: 2.5rem 1.5rem; }
    .auth-card h1 { font-size: 2rem; }
}

/* === Onboarding === */
.onboarding-welcome {
    background: linear-gradient(135deg, rgba(91, 141, 239, 0.12) 0%, rgba(167, 139, 250, 0.08) 100%);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 4rem;
    margin-bottom: 4rem;
    border: 3px solid rgba(91, 141, 239, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 60px rgba(91, 141, 239, 0.2);
    position: relative;
    overflow: hidden;
}

.onboarding-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(91, 141, 239, 0.15) 0%, transparent 70%);
    animation: rotate-slow 20s linear infinite;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.onboarding-welcome > * {
    position: relative;
    z-index: 1;
}

.onboarding-welcome h2 {
    color: var(--text-white);
    margin-bottom: 1rem;
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.onboarding-welcome > p {
    color: var(--text);
    margin-bottom: 3.5rem;
    font-size: 1.25rem;
    line-height: 1.7;
}

.onboarding-steps {
    display: grid;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.onboarding-step {
    display: flex;
    gap: 2rem;
    padding: 2.5rem;
    background: rgba(20, 27, 45, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px solid rgba(91, 141, 239, 0.15);
    transition: all 0.4s;
}

.onboarding-step:hover {
    transform: translateY(-4px);
    border-color: rgba(91, 141, 239, 0.4);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(91, 141, 239, 0.2);
}

.step-number {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #5b8def 0%, #a78bfa 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.75rem;
    box-shadow: 0 8px 24px rgba(91, 141, 239, 0.5);
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.step-content {
    flex: 1;
}

.step-content h3 {
    color: var(--text-white);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.step-content p {
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-size: 1.05rem;
}

.onboarding-tips {
    background: rgba(20, 27, 45, 0.5);
    backdrop-filter: blur(10px);
    border-left: 5px solid var(--accent);
    padding: 2rem 2.5rem;
    border-radius: 16px;
}

.onboarding-tips h4 {
    color: var(--text-white);
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.onboarding-tips ul {
    list-style: none;
    padding: 0;
}

.onboarding-tips li {
    color: var(--text);
    margin-bottom: 1rem;
    padding-left: 2.5rem;
    position: relative;
    line-height: 1.7;
    font-size: 1.05rem;
}

.onboarding-tips li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 900;
    font-size: 1.5rem;
}

.onboarding-tips a {
    color: var(--accent-bright);
    text-decoration: underline;
    font-weight: 700;
}

@media (min-width: 768px) {
    .onboarding-steps {
        grid-template-columns: repeat(3, 1fr);
    }

    .onboarding-step {
        flex-direction: column;
        text-align: center;
    }

    .step-number {
        margin: 0 auto;
    }
}

/* === Onboarding Completion Indicators === */
.step-check {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 28px;
    height: 28px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    border: 4px solid var(--bg);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.6);
}

.step-complete-badge {
    display: inline-block;
    color: var(--success);
    font-size: 1.05rem;
    margin-left: 1rem;
    font-weight: 700;
}

.text-muted {
    color: var(--text-light);
    font-size: 1rem;
    font-style: italic;
}

/* === Onboarding Sub-steps === */
.onboarding-substeps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 2rem 0;
}

.substep {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: rgba(30, 41, 66, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border-left: 4px solid var(--border);
    transition: all 0.3s;
}

.substep:hover {
    background: rgba(30, 41, 66, 0.6);
    transform: translateX(8px);
}

.substep-complete {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
}

.substep-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.25rem;
    background: var(--bg-input);
    color: var(--text-light);
    flex-shrink: 0;
    border: 2px solid rgba(91, 141, 239, 0.2);
}

.substep-complete .substep-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.substep-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.substep-text strong {
    color: var(--text-white);
    font-size: 1.05rem;
    font-weight: 700;
}

.substep-status {
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.substep-status-pending {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 41, 66, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #5b8def 0%, #a78bfa 100%);
    border-radius: 10px;
    border: 2px solid rgba(20, 27, 45, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7ba5f5 0%, #b8a4f7 100%);
}
