/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(to bottom, #d4e4e0 0%, #c8dcd7 100%);
    color: #333;
    line-height: 1.6;
}

/* 顶部导航栏 */
.header {
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.search-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    margin: 0 20px;
}

.search-input {
    flex: 1;
    max-width: 300px;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

.search-btn {
    padding: 6px 16px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.search-btn:hover {
    background-color: #f0f0f0;
}

.user-info {
    white-space: nowrap;
    color: #666;
    font-size: 14px;
}

/* 容器布局 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    padding: 20px;
}

/* 左侧边栏 */
.sidebar {
    width: 250px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    padding: 20px;
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #555;
    font-weight: normal;
}

.filter-list,
.category-list {
    list-style: none;
}

.filter-list li,
.category-list li {
    padding: 8px 12px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.category-list li a {
    color: inherit;
    text-decoration: none;
    display: block;
    margin: -8px -12px;
    padding: 8px 12px;
}

.filter-list li:hover,
.category-list li:hover {
    background-color: rgba(77, 163, 216, 0.1);
}

.filter-list li.active,
.category-list li.active {
    background-color: rgba(77, 163, 216, 0.2);
    font-weight: bold;
}

/* 主内容区 */
.main-content {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    padding: 20px;
}

.page-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

/* 过滤按钮 */
.filter-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background-color: #4a7c8e;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

.filter-btn.active {
    background-color: #3d6a7a;
}

.filter-btn:hover {
    background-color: #3d6a7a;
}

/* 书籍网格 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 书籍卡片 */
.book-card {
    background-color: white;
    border-radius: 5px;
    padding: 15px;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.book-card:hover {
    transform: translateY(-5px);
    text-decoration: none;
    color: inherit;
}

.book-cover {
    width: 100%;
    height: 280px;
    background-color: #f0f0f0;
    border-radius: 3px;
    margin-bottom: 12px;
    display: block;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-cover.placeholder {
    background-color: #e8f4f8;
    color: #666;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.book-cover-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    width: 100%;
    padding: 20px;
}

.book-series {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.book-title {
    font-size: 14px;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.4;
    min-height: 40px;
    width: 100%;
}

.book-category {
    font-size: 12px;
    color: #28a745;
    margin-bottom: 8px;
    width: 100%;
}

.book-category[onclick] {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.book-category[onclick]:hover {
    color: #1e7e34;
    text-decoration: underline;
    text-decoration-style: solid;
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.book-rating a {
    text-decoration: none;
    color: inherit;
    display: contents;
}

.rating-label {
    color: #4da3d8;
}

.rating-label[onclick] {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.rating-label[onclick]:hover {
    color: #3a8fc7;
    text-decoration: underline;
    text-decoration-style: solid;
}

.rating-score {
    color: #666;
}

/* 分页导航 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 30px 0;
}

.page-btn,
.pagination a,
.pagination span {
    padding: 8px 14px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.page-btn.active,
.pagination a.active,
.pagination span.active,
.pagination .current,
.pagination .page-num-current {
    background-color: #4da3d8;
    color: white;
    border-color: #4da3d8;
}

/* 空状态提示 */
.empty-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    min-height: 400px;
}

.empty-icon {
    font-size: 100px;
    margin-bottom: 24px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-text {
    font-size: 20px;
    color: #555;
    font-weight: 500;
    letter-spacing: 1px;
}

.page-btn:hover:not(.active),
.pagination a:hover,
.pagination span:hover {
    background-color: #f0f0f0;
    border-color: #4da3d8;
}

.page-dots {
    display: flex;
    align-items: center;
    padding: 0 8px;
    color: #666;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-container {
    background-color: #f2ede4; /* 浅米色背景，类似图片 */
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid #ccc;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f2ede4;
}

.modal-header h2 {
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.close-icon {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-content {
    padding: 30px;
    display: flex;
    gap: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-left {
    flex: 0 0 240px;
}

.modal-book-cover {
    width: 240px;
    height: 340px;
    background: linear-gradient(to right, #2a5298, #1e3c72); /* 示例背景 */
    position: relative;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.modal-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    color: white;
    background-color: rgba(0,0,0,0.1);
}

.overlay-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.overlay-subtitle {
    font-size: 12px;
    text-align: center;
    opacity: 0.9;
}

.overlay-bottom {
    margin-top: auto;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

.modal-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.dropdown-btn.primary {
    background-color: #2b5d84;
}

.dropdown-btn.secondary {
    background-color: #2b5d84;
}

.dropdown-btn .arrow {
    font-size: 10px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    display: none; /* 默认隐藏 */
    z-index: 1001;
    padding: 5px 0;
}

.dropdown-menu.show {
    display: block !important;
}

.dropdown-item {
    display: block !important;
    padding: 10px 15px !important;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px;
    text-align: left;
    transition: background-color 0.2s;
    border: none !important;
}

.dropdown-item:hover {
    background-color: #f5f5f5 !important;
    color: #2b5d84 !important;
    text-decoration: none !important;
}

.download-count {
    padding: 5px 12px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    color: #333;
}

.detail-title {
    font-size: 28px;
    color: #004d40;
    margin-bottom: 10px;
}

.detail-subtitle {
    font-size: 22px;
    color: #00695c;
    margin-bottom: 15px;
    font-weight: normal;
}

.detail-version {
    font-size: 24px;
    color: #004d40;
    margin-bottom: 10px;
}

.detail-author {
    color: #00bfa5;
    font-size: 16px;
    margin-bottom: 10px;
}

.detail-series {
    font-size: 16px;
    color: #555;
    margin-bottom: 15px;
}

.detail-tags {
    margin-bottom: 20px;
}

.tag {
    background-color: #4db6ac;
    color: white;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
}

.detail-info-item {
    margin-bottom: 12px;
    font-size: 16px;
}

.detail-info-item .label {
    color: #666;
    margin-right: 5px;
}

.detail-info-item .value.link {
    color: #00bfa5;
    cursor: pointer;
    text-decoration: underline;
}

.detail-intro {
    margin-top: 20px;
}

.detail-intro h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 15px;
}

.intro-content {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 15px;
    color: #444;
    line-height: 1.8;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
    background: none !important;
}

.intro-content p {
    background: none !important;
}

/* 自定义滚动条 */
.intro-content::-webkit-scrollbar {
    width: 8px;
}

.intro-content::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.intro-content::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

.modal-footer {
    padding: 15px 20px;
    background-color: #f2ede4;
    display: flex;
    justify-content: flex-end;
}

.close-btn {
    padding: 8px 25px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        padding: 20px;
    }
    
    .modal-left {
        flex: 0 0 auto;
        display: flex;
        justify-content: center;
    }

    .modal-book-cover {
        width: 180px;
        height: 250px;
    }

    .detail-title {
        font-size: 22px;
    }

    .detail-subtitle {
        font-size: 18px;
    }

    .modal-actions-row {
        flex-direction: column;
        gap: 15px;
    }
}
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .search-area {
        width: 100%;
        margin: 0;
        flex-wrap: wrap;
    }

    .search-input {
        max-width: 100%;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .book-cover {
        height: 220px;
    }

    .page-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .main-content,
    .sidebar {
        padding: 15px;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .book-cover {
        height: 180px;
    }

    .filter-buttons {
        gap: 5px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .logo {
        font-size: 20px;
    }
}
