/* OneNav 风格 - 简洁导航页 */
:root {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border: #e5e5e7;
    --icon-bg: #f0f0f5;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --sidebar-width: 220px;
}

[data-theme="dark"] {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;
    --border: #2c2c2e;
    --icon-bg: #2c2c2e;
    --accent: #0a84ff;
    --accent-hover: #409cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    font-size: 14px;
    line-height: 1.5;
}

/* 应用容器 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px 35px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.sidebar-logo .logo-icon {
    width: 150px;
    height: 150px;
    background: var(--icon-bg);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 72px;
}

.sidebar-logo .logo-icon img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.sidebar-logo .logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.nav-item:hover {
    background: var(--icon-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent);
    color: white;
}

.nav-icon {
    font-size: 16px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.nav-count {
    background: var(--icon-bg);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航栏 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: var(--icon-bg);
}

.logo {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 18px;
    width: 320px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

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

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle,
.admin-link {
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.theme-toggle:hover,
.admin-link:hover {
    background: var(--border);
}

/* 网站说明文字 */
.site-description {
    padding: 16px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    word-break: break-word;
    white-space: pre-wrap;
}

.site-description:empty {
    display: none;
}

/* 内容区域 */
.content-area {
    flex: 1;
    padding: 32px 24px;
    max-width: 100%;
    overflow: auto;
}

/* 分类区块 */
.category {
    margin-bottom: 48px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.category-icon {
    font-size: 20px;
}

.category-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.category-count {
    background: var(--accent);
    color: white;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.category-toggle {
    margin-left: auto;
    color: var(--text-secondary);
    transition: transform 0.3s;
    font-size: 12px;
}

.category.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category.collapsed .link-grid {
    display: none;
}

/* 链接网格 - onenav 风格 */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.link-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.link-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.link-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-bg);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s;
}

.link-card:hover .link-icon {
    transform: scale(1.05);
}

.link-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.link-icon .icon-placeholder {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
}

.link-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.link-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

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

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

.no-results-text {
    font-size: 16px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-secondary);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

/* 响应式 */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .search-box {
        width: 100%;
        max-width: 400px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .content-area {
        padding: 20px 16px;
    }
    
    .logo {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .link-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .link-card {
        padding: 16px 12px;
    }

    .link-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
        border-radius: 12px;
    }

    .link-icon img {
        width: 26px;
        height: 26px;
    }

    .link-icon .icon-placeholder {
        font-size: 22px;
    }

    .link-title {
        font-size: 13px;
    }
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* 共享链接复制提示 */
.share-toast {
    position: fixed;
    top: 20px;
    right: -400px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.3s ease;
}

.share-toast.show {
    right: 20px;
}

.share-toast .toast-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.share-toast .toast-content {
    flex: 1;
}

.share-toast .toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.share-toast .toast-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.share-toast .toast-close {
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.share-toast .toast-close:hover {
    opacity: 1;
}

/* 共享链接模态框弹窗 */
.share-link-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: shareFadeIn 0.2s ease;
}

@keyframes shareFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-link-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: shareSlideIn 0.3s ease;
}

@keyframes shareSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.share-link-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.share-link-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.share-link-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.share-link-modal-body {
    padding: 24px;
}

.share-link-path-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.share-link-path-box {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.share-link-path-box input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-color);
    color: var(--text-primary);
    cursor: text;
}

.share-link-path-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.share-link-copy-btn {
    padding: 14px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.share-link-copy-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.share-link-copy-btn:active {
    transform: translateY(0);
}

.share-link-copy-status {
    height: 24px;
    font-size: 13px;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.share-link-copy-status.success {
    color: #10b981;
    font-weight: 500;
}

.share-link-copy-status.warning {
    color: #f59e0b;
    font-weight: 500;
}

.share-link-instructions {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    margin-top: 16px;
}

.instruction-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.instruction-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 2;
}

.instruction-list li {
    margin-bottom: 4px;
}

.instruction-list strong {
    color: var(--text-primary);
    background: var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}
