/* ========================================
   CSS 变量 - 主题定义
   ======================================== */
:root {
    /* 亮色主题 - 桌上的新鲜三文鱼 */
    --bg-primary: #FFF6E5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fff0d6;
    --text-primary: #3E454C;
    --text-secondary: #5a636c;
    --text-muted: #8a949e;
    --border-color: #e8ddd0;
    --shadow-sm: 0 1px 3px rgba(62, 69, 76, 0.08);
    --shadow-md: 0 4px 8px rgba(62, 69, 76, 0.12);
    --shadow-lg: 0 10px 20px rgba(62, 69, 76, 0.15);
    --accent-color: #2185C5;
    --accent-light: #7ECEFD;
    --accent-secondary: #FF7F66;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    /* 暗色主题 - 静谧都市 */
    --bg-primary: #31353D;
    --bg-secondary: #1C1D21;
    --bg-card: #1C1D21;
    --bg-card-hover: #3a3f48;
    --text-primary: #EEEFF7;
    --text-secondary: #b8bcc8;
    --text-muted: #7a8090;
    --border-color: #445878;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.45);
    --accent-color: #92CDCF;
    --accent-light: #b5e0e2;
    --accent-secondary: #445878;
}

/* ========================================
   基础样式重置
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ========================================
   容器布局
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   头部样式
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background-color: var(--bg-card-hover);
    color: var(--accent-color);
    transform: scale(1.05);
}

.theme-toggle .icon {
    width: 20px;
    height: 20px;
}

.theme-toggle .moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon {
    display: block;
}

/* ========================================
   搜索框样式
   ======================================== */
.search-box {
    position: relative;
    margin-bottom: 40px;
}

.search-box input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ========================================
   导航内容区域
   ======================================== */
.nav-content {
    flex: 1;
}

/* 分类标题 */
.category {
    margin-bottom: 32px;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    border-radius: 2px;
}

/* 网站卡片网格 */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

/* 网站卡片 */
.site-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.site-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.site-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background-color: var(--bg-primary);
    padding: 4px;
}

.site-icon.emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
}

/* Iconify 图标样式 */
.site-icon.iconify-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-primary);
    background: transparent;
    padding: 0;
}

.site-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 无搜索结果 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 1rem;
}

/* ========================================
   页脚样式
   ======================================== */
.footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ========================================
   响应式设计 - 平板
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .header {
        margin-bottom: 24px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .search-box {
        margin-bottom: 32px;
    }

    .search-box input {
        padding: 14px 16px 14px 48px;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .site-card {
        padding: 12px 14px;
    }

    .category {
        margin-bottom: 24px;
    }
}

/* ========================================
   响应式设计 - 手机
   ======================================== */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 16px 12px;
    }

    .header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
    }

    .search-box {
        margin-bottom: 24px;
    }

    .search-box input {
        padding: 12px 14px 12px 44px;
        font-size: 0.95rem;
    }

    .search-icon {
        left: 14px;
        width: 18px;
        height: 18px;
    }

    .sites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .site-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .site-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    .site-name {
        font-size: 0.85rem;
    }

    .category-title {
        font-size: 1rem;
    }

    .footer {
        margin-top: 32px;
        padding-top: 20px;
    }
}

/* ========================================
   动画效果
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category {
    animation: fadeIn 0.4s ease forwards;
}

.category:nth-child(1) {
    animation-delay: 0.05s;
}

.category:nth-child(2) {
    animation-delay: 0.1s;
}

.category:nth-child(3) {
    animation-delay: 0.15s;
}

.category:nth-child(4) {
    animation-delay: 0.2s;
}

.category:nth-child(5) {
    animation-delay: 0.25s;
}

/* 暗黑模式过渡动画 */
body,
.header,
.search-box input,
.site-card,
.theme-toggle,
.footer {
    transition: background-color var(--transition-normal),
        border-color var(--transition-normal),
        color var(--transition-normal),
        box-shadow var(--transition-normal);
}