/*
 * 电玩管家 - 桌面端科技风 v2.0
 * 2025-12-05
 */

/* ===== CSS 变量 ===== */
:root {
    --bg-dark: #0a0e17;
    --bg-card: #111827;
    --bg-hover: #1f2937;
    --border: #1e3a5f;
    --accent: #00d4ff;
    --accent-glow: rgba(0, 212, 255, 0.3);
    --accent-secondary: #7c3aed;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient-cyber: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
}

/* ===== 全局 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    min-height: 100vh;
}

/* 科技感背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, rgba(0, 212, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ===== 顶部导航 ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(17, 24, 39, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    z-index: 100;
    gap: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Logo */
.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.version-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    background: var(--gradient-cyber);
    border-radius: 12px;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 搜索框 */
.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.header-search input::placeholder {
    color: var(--text-secondary);
}

.header-search::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* 快捷按钮 */
.quick-access-buttons {
    display: flex;
    gap: 8px;
}

.quick-access-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-access-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.quick-access-btn .count {
    color: var(--accent);
    font-weight: 600;
}

/* 用户区域 */
#wp-auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-link-primary {
    padding: 8px 18px;
    background: var(--gradient-cyber);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.header-link-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

#wp-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.save-center-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--accent-secondary);
    border-radius: 8px;
    color: var(--accent-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.save-center-btn:hover {
    background: rgba(124, 58, 237, 0.15);
    transform: translateY(-1px);
}

/* ===== 主内容区 ===== */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 侧边栏 ===== */
.app-sidebar {
    width: 240px;
    background: rgba(17, 24, 39, 0.8);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 4px;
}

.console-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.console-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.console-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border);
}

.console-tab.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.console-tab .icon {
    font-size: 1.1rem;
}

/* ===== 游戏内容区 ===== */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

.game-library {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.library-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.library-filters {
    display: flex;
    gap: 10px;
}

.filter-select {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== 游戏网格 ===== */
.game-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.game-grid::-webkit-scrollbar {
    width: 6px;
}

.game-grid::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.game-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.game-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.game-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* ===== 游戏卡片 ===== */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.15);
}

.game-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.8) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s;
}

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

.game-cover {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-dark);
    overflow: hidden;
}

.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .game-cover img {
    transform: scale(1.05);
}

.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    color: var(--accent);
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.2);
}

.game-info {
    padding: 12px;
}

.game-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-meta {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.game-console {
    color: var(--accent);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    z-index: 10000;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s;
    max-width: 280px;
    backdrop-filter: blur(10px);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.toast-error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.toast-warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--error);
    color: white;
}

.modal-body {
    padding: 20px;
}

/* ===== 按钮 ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient-cyber);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
}

/* ===== 空状态 ===== */
.no-games {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* ===== 加载动画 ===== */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== 隐藏移动端元素 ===== */
.mobile-layout,
.mobile-ui {
    display: none !important;
}
