/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.points-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #1a1a2e;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.points-icon {
    font-size: 1.2rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

#userName {
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-logout {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 68, 68, 0.4);
    border-color: #ff4444;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-section {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #a8a8a8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.tab-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px 3px 0 0;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.game-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}

.game-card-content {
    padding: 1.25rem;
}

.game-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.game-card-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffd700;
}

.price.owned {
    color: #4ade80;
}

.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-play:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-play.owned {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.btn-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.modal-game-image {
    width: 100%;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.modal-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

.modal-info p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.price-tag {
    font-size: 2rem;
    font-weight: 800;
    color: #ffd700;
    margin-bottom: 1.5rem;
}

.game-iframe-container {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-iframe-container iframe {
    width: 100%;
    height: 300px;
    border: none;
}

.btn-purchase {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-purchase:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

.btn-purchase:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.toast.error {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.6);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.6);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0.5rem 1rem;
    }

    .logo-img {
        height: 32px;
    }

    .user-section {
        gap: 0.75rem;
    }

    .points-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    #userName {
        display: none;
    }

    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .main-content {
        padding: 1rem;
    }

    .welcome-section h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tabs {
        gap: 0.5rem;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal-body {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .modal-game-image {
        height: 200px;
        object-fit: cover;
    }

    .modal-info h2 {
        font-size: 1.4rem;
    }

    .price-tag {
        font-size: 1.5rem;
    }

    .game-iframe-container iframe {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .user-section {
        width: 100%;
        justify-content: space-between;
    }

    .welcome-section h1 {
        font-size: 1.5rem;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
    }
}