/* 玻璃拟物风格导航系统 - 核心样式 */

:root {
    --glass-blur: 20px;
    --glass-opacity: 0.25;
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --primary-color: #3b82f6;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    --glass-opacity: 0.15;
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #f3f4f6;
    --text-secondary: #9ca3af;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-color);
    background-attachment: fixed;
}

/* 玻璃拟物卡片 */
.glass {
    background: rgba(255, 255, 255, var(--glass-opacity));
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* 主布局 */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

/* 左侧菜单 */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 24px;
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.2);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* 分类列表 */
.category-list {
    list-style: none;
}

.category-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
}

.category-item i {
    width: 20px;
    text-align: center;
}

/* 右侧内容 */
.main-content {
    flex: 1;
    padding: 24px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-toggle button {
    padding: 8px 12px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-toggle button.active,
.view-toggle button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 网站卡片网格 */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.site-card {
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

.site-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.site-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    overflow: hidden;
}

.site-card-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.site-card-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-card-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 列表视图 */
.sites-list {
    display: none;
}

.sites-list.active {
    display: block;
}

.sites-grid.hidden {
    display: none;
}

.site-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
}

.site-list-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-list-item img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.site-list-info {
    flex: 1;
}

.site-list-info h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.site-list-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 主题切换 */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
}

/* 响应式设计 */
@media (max-width: 991px) {
    .sidebar {
        width: 240px;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 767px) {
    .container {
        flex-direction: column;
        padding: 60px 16px 16px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        transition: left 0.3s ease;
        border-radius: 0;
        padding-top: 60px;
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .site-card {
        padding: 16px;
    }

    .main-content {
        padding: 16px;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .overlay.active {
        display: block;
    }
}

/* 用户菜单 */
.user-menu {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.user-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.user-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 消息提示 */
.toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
