/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    transition: all 0.3s ease;
    overflow-x: hidden;
}

/* 无障碍访问样式 */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color, #4a90e2);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
    font-size: 14px;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* 网站头部 */
.site-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
}

/* 主题变量 */
:root {
    --primary-color: #4a90e2;
    --sidebar-width: 250px;
    --card-height: 65px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 夜间模式 */
.dark-mode {
    --bg-color: #1a1a1a;
    --sidebar-bg: #2d2d2d;
    --card-bg: #333333;
    --text-color: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --hover-color: #404040;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --nav-item-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    --nav-item-border: rgba(255, 255, 255, 0.1);
}

/* 日间模式 */
.light-mode {
    --bg-color: #f5f5f5;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --hover-color: #f0f0f0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --nav-item-bg: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
    --nav-item-border: rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* 主题切换按钮 */
.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3a7bc8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
}

.theme-toggle:hover::before {
    left: 100%;
}

.theme-toggle i {
    font-size: 14px;
    z-index: 1;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 主容器 */
.container {
    display: flex;
    min-height: 100vh;
}

/* 左侧导航栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 25px 5px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    margin: 0 10px 20px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(74, 144, 226, 0.05) 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(74, 144, 226, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.sidebar-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(74, 144, 226, 0.3);
}

.sidebar-header:hover::before {
    left: 100%;
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(74, 144, 226, 0.1);
    background: linear-gradient(135deg, var(--primary-color), #3a7bc8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.sidebar-header:hover h2 {
    transform: scale(1.02);
    text-shadow: 0 2px 4px rgba(74, 144, 226, 0.2);
}

.nav-list {
    list-style: none;
    padding: 0 10px;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    cursor: pointer;
    border-radius: 8px;
    background: var(--nav-item-bg);
    border: 1px solid var(--nav-item-border);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.nav-link:hover {
    background: linear-gradient(135deg, var(--hover-color) 0%, rgba(74, 144, 226, 0.1) 100%);
    border-color: rgba(74, 144, 226, 0.3);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3a7bc8 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    border-color: var(--primary-color);
    transform: translateX(2px);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: white;
    border-radius: 0 2px 2px 0;
}

.nav-link i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 14px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    overflow-x: hidden;
}

.content-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
}

.search-box {
    position: relative;
    width: 400px;
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* 网站卡片网格 */
.website-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: hidden;
    padding: 5px 0;
}

/* 首页布局 */
.homepage-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category-section {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.category-title {
    display: flex;
    align-items: center;
}

.category-title i {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--primary-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-title h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.view-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary-color), rgba(74, 144, 226, 0.8));
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.2);
    border: none;
    outline: none;
    font-family: inherit;
}

.view-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.9), var(--primary-color));
}

.view-all-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.view-all-btn i {
    font-size: 11px;
    transition: transform 0.3s ease;
}

.view-all-btn:hover i {
    transform: translateX(2px);
}

.category-websites {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    overflow-x: hidden;
    padding: 5px 0;
}

.category-website-slot {
    min-height: var(--card-height);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    background: rgba(0, 0, 0, 0.02);
}

.dark-mode .category-website-slot {
    background: rgba(255, 255, 255, 0.02);
}

/* 网站卡片 - 优化版本 v4 */
.website-card {
    height: var(--card-height);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 12px !important;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    max-width: 100%;
    overflow: hidden;
}

.website-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    border-color: var(--primary-color);
}

.card-icon {
    width: 32px !important;
    height: 32px !important;
    margin-right: 12px !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}



.card-icon img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.website-card:hover .card-icon img {
    transform: scale(1.05);
}



/* 删除不需要的fallback-text样式 */

.card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    font-size: 24px;
    margin-bottom: 10px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .website-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .category-websites {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .website-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-websites {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .search-box {
        width: 250px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .website-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .category-websites {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .content-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .website-grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    .main-content {
        padding: 15px;
    }
    
    .content-header h2 {
        font-size: 20px;
    }
    
    .category-websites {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .homepage-container {
        gap: 20px;
    }
    
    .category-section {
        padding: 15px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .back-to-top i {
        font-size: 16px;
    }
    
    .view-all-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 面包屑导航 */
.breadcrumb {
    margin: 20px 0 10px 0;
    padding: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb li {
    display: flex;
    align-items: center;
}

.breadcrumb-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: var(--text-secondary);
    font-size: 12px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), rgba(74, 144, 226, 0.8));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.9), var(--primary-color));
}

.back-to-top i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-1px);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}

::-webkit-scrollbar-thumb:active {
    background: var(--primary-color);
}
