/* 暗黑风格滚动条样式 */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

:root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2d2d2d;
    --accent-primary: #bb86fc;
    --accent-secondary: #03dac6;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-disabled: #6c6c6c;
    --error: #cf6679;
    --success: #4caf50;
    --warning: #ff9800;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding-top: 80px; /* 根据 header 实际高度调整 */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

/* 固定 header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--bg-primary);
    padding: 20px;
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between; /* 左右分布 */
    align-items: center; /* 垂直居中 */
}

.logo {
    display: flex;
    align-items: center; /* 垂直居中 */
    gap: 10px; /* 图标和文字之间的间距 */
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-primary);
}

.logo img {
    width: 32px;
    height: 32px;
}

/* 用户信息区域 */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: var(--text-primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
}

.user-nickname {
    font-weight: bold;
    color: var(--text-primary);
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-button {
    padding: 12px 25px;
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #a26bc7;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    transition:
        transform 0.3s,
        box-shadow 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.game-icon {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background-color: var(--bg-tertiary);
}

.game-info {
    padding: 15px;
}

.game-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-intro {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
    height: 60px;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.game-actions {
    display: flex;
    gap: 10px;
}

.action-button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s;
}

.install-button {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
}

.install-button:hover {
    background-color: #a26bc7;
}

.update-button {
    background-color: var(--accent-secondary);
    color: var(--bg-primary);
}

.update-button:hover {
    background-color: #02bfb2;
}

.uninstall-button {
    background-color: var(--warning);
    color: var(--bg-primary);
}

.uninstall-button:hover {
    background-color: #e68a00;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    background-color: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease-out;
    z-index: 1000;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 20px;
}

.notification-message {
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-disabled);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* 用户信息卡片的基础样式 */
.user-info-card {
    position: absolute;
    top: 60px;
    right: 20px;
    max-width: 350px;
    background-color: #2d2d2d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 20px;
    opacity: 0;
    transform: translateY(-20px);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    pointer-events: none; /* 隐藏时禁用交互 */
    z-index: 1000;
}

/* 显示状态 */
.user-info-card.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto; /* 显示时启用交互 */
}

/* 可选：添加缩放动画 */
.user-info-card.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.user-info-header .user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    flex: 1;
}

.user-details .user-nickname {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
}

.membership-status {
    font-size: 14px;
    color: #4caf50;
}

.user-info-body {
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: #b3b3b3;
}

.user-info-footer {
    text-align: center;
}

.logout-button {
    width: 100%;
    padding: 10px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.logout-button:hover {
    background-color: #d32f2f;
}

#share-link-container {
    flex: 1;
}

#share-link {
    width: 100%;
    padding: 5px;
    font-size: 14px;
    border: 1px solid #626262;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: white;
}

#exchangeCodeInput{
    padding: 5px;
    font-size: 14px;
    border: 1px solid #626262;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: white;
}

#exchangeCodeInput:focus {
    outline: none;
}

#share-link:focus {
    outline: none;
}

.exchange-code-button {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 15px;
}

.renew-membership-button {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 15px;
}

.exchange-code-button:hover {
    background-color: #d32f2f;
}

.renew-membership-button:hover {
    background-color: #d32f2f;
}

.exchange-code-container {
    display: flex; /* 启用 Flexbox 布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 10px; /* 元素之间的间距 */
    width: 100%; /* 占满父容器宽度 */
}

.exchange-code-container label {
    white-space: nowrap; /* 防止文字换行 */
    flex-shrink: 0; /* 防止 label 被压缩 */
}

.exchange-code-container input {
    flex-grow: 1; /* 占据剩余空间 */
    min-width: 0; /* 允许 input 被压缩 */
}

.exchange-code-container button {
    flex-shrink: 0; /* 防止 button 被压缩 */
    white-space: nowrap; /* 防止文字换行 */
}

/* 模态窗口基础样式 */
.modal {
    display: none; /* 默认隐藏 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
    opacity: 0; /* 初始透明度 */
    transition: opacity 0.3s ease; /* 仅背景淡入淡出 */
}

.modal.show {
    display: flex;
    opacity: 1; /* 背景淡入 */
}

/* 模态内容动画 */
.modal-content {
    background-color: #282828;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    height: 400px;
    max-height: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0; /* 初始透明度 */
    transform: scale(0.8); /* 初始缩放 */
    transition:
        opacity 0.3s ease,
        transform 0.3s ease; /* 内容动画 */
}

.modal.show .modal-content {
    opacity: 1; /* 内容淡入 */
    transform: scale(1); /* 内容恢复正常大小 */
}

/* 可选：添加弹跳动画 */
@keyframes modalContentPopIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.modal.show .modal-content.animate {
    animation: modalContentPopIn 0.4s ease forwards;
}

.close {
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 自适应列宽 */
    gap: 15px;
    margin-top: 20px;
    max-height: calc(100% - 60px); /* 减去 padding 和标题高度 */
    overflow-y: auto; /* 启用垂直滚动条 */
}

/* 滚动条样式 */
.product-list::-webkit-scrollbar {
    width: 8px;
}

.product-list::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 4px;
}

.product-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.product-list::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.product-card:hover {
    transform: scale(1.05);
}

.product-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.product-card p {
    margin: 5px 0;
    font-size: 14px;
    color: #fff;
}

.play-time-reward-container {
    display: flex; /* 启用 Flexbox 布局 */
    align-items: center; /* 垂直居中对齐 */
    gap: 10px; /* 元素之间的间距 */
    width: 100%; /* 占满父容器宽度 */
}

.play-time-reward-container label {
    white-space: nowrap; /* 防止文字换行 */
    flex-shrink: 0; /* 防止 label 被压缩 */
}

.play-time-reward-container input {
    flex-grow: 1; /* 占据剩余空间 */
    min-width: 0; /* 允许 input 被压缩 */
}

.play-time-reward-container button {
    flex-shrink: 0; /* 防止 button 被压缩 */
    white-space: nowrap; /* 防止文字换行 */
}

#card-play-reward{
    padding: 5px;
    font-size: 14px;
    border: 1px solid #626262;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: white;
}

#card-play-reward:focus {
    outline: none;
}