:root {
    --primary-color: #ea4c89;
    --secondary-color: #6e6d7a;
    --accent-color: #0d0c22;
    --light-color: #f8f8f8;
    --dark-color: #0d0c22;
    --text-color: #3d3d4e;
    --border-color: #e7e7e9;
    --hover-color: #f3f3f4;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --recommend-color: #ea4c89;
    --recommend-text: #ffffff;
    --nav-width: 220px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--light-color);
    line-height: 1.6;
    display: flex;
}

/* 左侧分类导航栏 */
.category-nav {
    width: var(--nav-width);
    height: 100vh;
    position: sticky;
    top: 0;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 5px var(--shadow-color);
    padding: 20px 0;
    overflow-y: auto;
    z-index: 10;
}

.nav-header {
    padding: 0 20px 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.nav-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

#category-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--hover-color);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-link i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.nav-recommend {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--recommend-color);
    margin-left: 5px;
}

/* 主容器 */
.container {
    flex: 1;
    padding: 20px;
    max-width: calc(100% - var(--nav-width));
}

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

header h1 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.8rem;
    font-weight: 700;
}

.search-box {
    display: flex;
    margin: 15px 0;
    position: relative;
}

.search-box input {
    width: 300px;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--hover-color);
    transition: all 0.3s ease;
}

.search-box input:focus {
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(234, 76, 137, 0.1);
    outline: none;
}

.search-box button {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 16px;
}

.actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.action-btn:hover {
    background-color: #c13369;
}

/* 书签样式 */
#bookmarks-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category {
    margin-bottom: 20px;
}

.category h2 {
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-color);
    font-size: 1.3rem;
    font-weight: 700;
}

/* 站长推荐分类特殊样式 */
.category h2:first-child {
    color: var(--recommend-color);
    border-bottom-color: var(--recommend-color);
}

.links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.card:hover .card-actions {
    opacity: 1;
}

.thumbnail {
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 比例 */
    background-color: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .thumbnail img {
    transform: scale(1.05);
}

.card-content {
    padding: 15px;
    display: flex;
    align-items: center;
    position: relative;
}

.icon {
    font-size: 20px;
    color: var(--primary-color);
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
    border-radius: 50%;
    margin-right: 12px;
}

.title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-color);
    text-align: left;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.delete-btn {
    background-color: rgba(255, 255, 255, 0.8);
    color: #f24667;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.delete-btn:hover {
    background-color: #f24667;
    color: white;
}

.rec-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--recommend-color);
    color: var(--recommend-text);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 5;
}

/* 推荐卡片特殊样式 */
.card.recommended {
    box-shadow: 0 5px 15px rgba(234, 76, 137, 0.15);
}

.card.recommended:hover {
    box-shadow: 0 10px 25px rgba(234, 76, 137, 0.25);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 12, 34, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px var(--shadow-color);
    position: relative;
}

.close {
    position: absolute;
    right: 25px;
    top: 20px;
    color: var(--secondary-color);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--accent-color);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(234, 76, 137, 0.1);
    outline: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group input {
    width: auto;
    margin-right: 10px;
}

.checkbox-group label {
    margin-bottom: 0;
}

/* 导入提示样式 */
.import-tips {
    margin: 15px 0;
    padding: 12px 15px;
    background-color: rgba(234, 76, 137, 0.1);
    border-radius: 8px;
    list-style-position: inside;
}

.import-tips li {
    margin-bottom: 8px;
}

.import-tips li:last-child {
    margin-bottom: 0;
}

.import-tips strong {
    color: var(--primary-color);
}

/* 深色主题适配 */
body.dark-theme .import-tips {
    background-color: rgba(234, 76, 137, 0.2);
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
    width: 100%;
}

.btn-submit:hover {
    background-color: #c13369;
}

/* 返回顶部和直达底部按钮 */
.scroll-btn {
    position: fixed;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(234, 76, 137, 0.3);
}

.scroll-btn.visible {
    opacity: 0.9;
}

.scroll-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

#scroll-to-top {
    bottom: 100px;
}

#scroll-to-bottom {
    bottom: 30px;
}

/* 页脚样式 */
footer {
    margin-top: 60px;
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 60px 0;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* 深色主题 */
body.dark-theme {
    background-color: var(--dark-color);
    color: #f5f5f5;
}

body.dark-theme .category-nav {
    background-color: #1b1a2a;
    border-right-color: #2d2c41;
}

body.dark-theme .nav-link {
    color: #f5f5f5;
}

body.dark-theme .nav-link:hover, 
body.dark-theme .nav-link.active {
    background-color: #2d2c41;
}

body.dark-theme header {
    border-bottom-color: #2d2c41;
}

body.dark-theme .card {
    background-color: #1b1a2a;
    border-color: #2d2c41;
}

body.dark-theme .thumbnail {
    background-color: #2d2c41;
}

body.dark-theme .icon {
    background-color: #2d2c41;
}

body.dark-theme .title {
    color: #f5f5f5;
}

body.dark-theme .category h2 {
    border-bottom-color: #2d2c41;
    color: #f5f5f5;
}

body.dark-theme .modal-content {
    background-color: #1b1a2a;
    color: #f5f5f5;
}

body.dark-theme .form-group input,
body.dark-theme .form-group select {
    background-color: #2d2c41;
    border-color: #3d3c51;
    color: #f5f5f5;
}

body.dark-theme .close {
    color: #f5f5f5;
}

body.dark-theme .delete-btn {
    background-color: rgba(27, 26, 42, 0.8);
}

body.dark-theme footer {
    border-top-color: #2d2c41;
    color: #aaa;
}

body.dark-theme .search-box input {
    background-color: #2d2c41;
    color: #f5f5f5;
    border-color: #3d3c51;
}

/* 加载中动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 992px) {
    .container {
        max-width: calc(100% - 60px);
    }
    
    .category-nav {
        width: 60px;
        overflow: hidden;
    }
    
    .nav-header h3, .nav-link span {
        display: none;
    }
    
    .nav-link {
        padding: 15px;
        text-align: center;
    }
    
    .nav-link i {
        margin: 0;
        font-size: 1.2rem;
    }
    
    .category-nav:hover {
        width: var(--nav-width);
        overflow-y: auto;
    }
    
    .category-nav:hover .nav-header h3,
    .category-nav:hover .nav-link span {
        display: inline-block;
    }
    
    .category-nav:hover .nav-link {
        text-align: left;
        padding: 10px 20px;
    }
    
    .category-nav:hover .nav-link i {
        margin-right: 8px;
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .links {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .modal-content {
        width: 90%;
        margin: 15% auto;
    }
    
    .action-btn {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 576px) {
    body {
        flex-direction: column;
    }
    
    .category-nav {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px 0;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .nav-header {
        display: none;
    }
    
    #category-nav-list {
        display: flex;
        padding: 5px;
    }
    
    .nav-item {
        margin: 0 5px;
    }
    
    .nav-link {
        padding: 8px 12px;
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
    }
    
    .nav-link:hover, .nav-link.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary-color);
    }
    
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .action-btn {
        margin-top: 10px;
    }
    
    .links {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .scroll-btn {
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

/* 导出按钮和选项 */
.export-options {
    margin: 20px 0;
}

.btn-export {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px;
    margin-bottom: 5px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--accent-color);
    justify-content: flex-start;
    text-align: left;
}

.btn-export i {
    font-size: 1.4rem;
    margin-right: 15px;
    width: 24px;
    color: var(--primary-color);
}

.btn-export:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.export-options small {
    display: block;
    margin-top: 5px;
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 0.85rem;
    padding-left: 5px;
}

.export-info {
    margin-top: 15px;
    padding: 12px;
    background-color: rgba(234, 76, 137, 0.1);
    border-radius: 8px;
    color: var(--accent-color);
}

.export-info i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* 深色主题适配 */
body.dark-theme .btn-export {
    background-color: #2d2c41;
    border-color: #3d3c51;
    color: #f5f5f5;
}

body.dark-theme .btn-export:hover {
    background-color: #3d3c51;
}

body.dark-theme .export-info {
    background-color: rgba(234, 76, 137, 0.2);
    color: #f5f5f5;
}