/* 侧边栏组件样式 */

/* CSS变量 - Steam风格纯黑底配色 */
:root {
    --sidebar-bg-primary: #000000;
    --sidebar-bg-secondary: #0a0a0a;
    --sidebar-bg-hover: #1a1a1a;
    --sidebar-bg-active: #2a2a2a;
    
    --sidebar-text-primary: #c7d5e0;
    --sidebar-text-secondary: #8f98a0;
    --sidebar-text-muted: #66707b;
    
    --sidebar-accent: #7D2BA8;
    --sidebar-gold: #cdaa5e;
    
    --sidebar-border: #1a1a1a;
}

/* 左侧边栏 */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

/* 桌面端显示逻辑 */
@media (min-width: 769px) {
    body.ai-chat-page .sidebar {
        transform: translateX(-100%);
    }
    
    body:not(.ai-chat-page) .sidebar {
        transform: translateX(0);
    }
    
    body.ai-chat-page .sidebar.active,
    body.ai-chat-page .sidebar.show {
        transform: translateX(0);
    }
}

/* 移动端统一行为 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 2000;
    }
    
    .sidebar.active,
    body.ai-chat-page .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg-secondary);
}

.sidebar-header .header-actions {
    display: flex;
    gap: 3px;
}

.sidebar-header .header-actions .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 2px;
    border: 1px solid var(--sidebar-border);
    background: transparent;
    color: var(--sidebar-text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .header-actions .icon-btn:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--sidebar-text-primary);
}

.logo i {
    font-size: 1.4rem;
}

/* 侧边栏导航 */
.sidebar-nav {
    flex: 1;
    padding: 4px 0;
}

.nav-list {
    list-style: none;
}

/* Steam风格：紧凑列表 */
.nav-list-grid {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 4px;
}

.nav-list-grid .nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    color: var(--sidebar-text-primary);
    text-decoration: none;
    border-radius: 2px;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 400;
    transition: background 0.1s;
    min-height: 24px;
}

.nav-link:hover {
    background: var(--sidebar-bg-hover);
}

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

.nav-link > span:first-child {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 计数：纯数字右对齐 */
.nav-subcount {
    color: var(--sidebar-text-secondary);
    font-size: 11px;
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--sidebar-border);
    background: var(--sidebar-bg-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: var(--sidebar-bg-primary);
    border-radius: 2px;
    border: 1px solid var(--sidebar-border);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--sidebar-bg-active);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-primary);
    font-weight: 600;
    font-size: 13px;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.username {
    font-weight: 600;
    font-size: 14px;
    color: var(--sidebar-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-gold-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-gold {
    font-size: 12px;
    color: var(--sidebar-gold);
    font-variant-numeric: tabular-nums;
}

/* 金币刷新按钮 */
.gold-refresh-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    border-radius: 2px;
    cursor: pointer;
    color: var(--sidebar-text-secondary);
    font-size: 10px;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.gold-refresh-btn:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-primary);
}

.gold-refresh-btn.loading i {
    animation: gold-refresh-spin 1s linear infinite;
}

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

/* 用户操作按钮 */
.user-actions {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recharge-btn,
.login-btn,
.signin-btn,
.live-video-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 2px;
    font-weight: 500;
    font-size: 13px;
    border: 1px solid var(--sidebar-border);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    gap: 5px;
    min-height: 26px;
}

.recharge-btn {
    background: transparent;
    color: var(--sidebar-gold);
    border-color: var(--sidebar-border);
}

.recharge-btn:hover {
    background: var(--sidebar-bg-hover);
    border-color: var(--sidebar-gold);
}

.login-btn,
.signin-btn {
    background: transparent;
    color: var(--sidebar-text-primary);
    border-color: var(--sidebar-border);
}

.login-btn:hover,
.signin-btn:hover {
    background: var(--sidebar-bg-hover);
    border-color: var(--sidebar-accent);
}

.live-video-btn {
    background: transparent;
    color: var(--sidebar-accent);
    border-color: var(--sidebar-border);
}

.live-video-btn:hover {
    background: var(--sidebar-bg-hover);
    border-color: var(--sidebar-accent);
}

/* 下载按钮区域 */
.download-section {
    padding: 4px;
    border-top: 1px solid var(--sidebar-border);
}

.download-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-top: 3px;
}

.download-buttons .nav-link {
    background: #2a2a2a;
    border: 2px solid #3a3a3a;
    color: #c7d5e0;
    padding: 8px 10px;
    font-size: 12px;
    gap: 5px;
    min-height: 32px;
    font-weight: 600;
}

.download-buttons .nav-link:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
    color: #ffffff;
}

/* 内部顺序 */
.sidebar-header { order: 10; }
.sidebar-nav { order: 20; }
.download-section { order: 30; }
.sidebar-footer { order: 40; }

@media (max-width: 768px) {
    .download-section { order: 15; }
    
    .nav-list-grid {
        padding: 0 6px;
    }
}