/* 图书浏览页面样式 */

/* 全局容器 */
.browse-container {
    padding: 24px;
    background-color: #f6f9fc;
    min-height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
}

/* 装饰气泡 */
.bubble {
    position: absolute;
    bottom: -50px;
    background-color: rgba(221, 236, 255, 0.4);
    border-radius: 50%;
    z-index: 1;
    animation: bubble 25s infinite ease-in;
}

@keyframes bubble {
    0% {
        transform: translateY(100%) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* 为页面添加15个泡泡 */
.bubble:nth-child(1) { left: 5%; width: 30px; height: 30px; animation-duration: 20s; animation-delay: 0s; }
.bubble:nth-child(2) { left: 15%; width: 20px; height: 20px; animation-duration: 18s; animation-delay: 1s; }
.bubble:nth-child(3) { left: 25%; width: 25px; height: 25px; animation-duration: 16s; animation-delay: 2s; }
.bubble:nth-child(4) { left: 35%; width: 15px; height: 15px; animation-duration: 15s; animation-delay: 0.5s; }
.bubble:nth-child(5) { left: 45%; width: 30px; height: 30px; animation-duration: 14s; animation-delay: 3s; }
.bubble:nth-child(6) { left: 55%; width: 20px; height: 20px; animation-duration: 13s; animation-delay: 2.5s; }
.bubble:nth-child(7) { left: 65%; width: 25px; height: 25px; animation-duration: 12s; animation-delay: 1.5s; }
.bubble:nth-child(8) { left: 75%; width: 15px; height: 15px; animation-duration: 11s; animation-delay: 4s; }
.bubble:nth-child(9) { left: 85%; width: 30px; height: 30px; animation-duration: 10s; animation-delay: 3.5s; }
.bubble:nth-child(10) { left: 10%; width: 18px; height: 18px; animation-duration: 19s; animation-delay: 0.5s; }
.bubble:nth-child(11) { left: 20%; width: 22px; height: 22px; animation-duration: 17s; animation-delay: 2.5s; }
.bubble:nth-child(12) { left: 30%; width: 28px; height: 28px; animation-duration: 16s; animation-delay: 1.2s; }
.bubble:nth-child(13) { left: 40%; width: 17px; height: 17px; animation-duration: 15s; animation-delay: 3.7s; }
.bubble:nth-child(14) { left: 60%; width: 23px; height: 23px; animation-duration: 13s; animation-delay: 2.1s; }
.bubble:nth-child(15) { left: 80%; width: 19px; height: 19px; animation-duration: 12s; animation-delay: 1.7s; }

/* 页面标题部分 */
.page-header {
    margin-bottom: 25px;
    position: relative;
    z-index: 2;
    text-align: center;
}

.page-header h1 {
    color: #3c4858;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-text {
    margin-top: 10px;
    color: #8492a6;
    font-size: 1.1rem;
}

.welcome-text strong {
    color: #764ba2;
}

/* 过滤和搜索部分 */
.filter-section {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 2;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-row {
    margin-bottom: 5px;
    width: 100%;
}

.search-group {
    display: flex;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.search-group .form-control {
    border: 1px solid #e4e7eb;
    border-right: none;
    border-radius: 25px 0 0 25px;
    padding: 10px 20px;
    height: 46px;
    font-size: 1rem;
    background-color: #f7fafc;
    box-shadow: none;
    transition: all 0.3s;
    flex: 1;
}

.search-group .form-control:focus {
    outline: none;
    border-color: #a3bffa;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

.search-group .btn {
    border-radius: 0 25px 25px 0;
    width: 46px;
    height: 46px;
    min-width: 46px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -1px;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11);
    transition: all 0.3s;
    border: none;
}

.search-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    align-items: center;
}

.category-filters {
    position: relative;
    flex: 2;
    min-width: 180px;
}

.category-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    width: 100%;
    height: 42px;
    background: #f7fafc;
    border: 1px solid #e4e7eb;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #3c4858;
    transition: all 0.3s;
}

.category-filter-toggle:hover {
    background: #edf2f7;
}

.category-filter-toggle i.fa-chevron-down {
    margin-left: 8px;
    transition: transform 0.3s;
}

.category-filter-toggle.active i.fa-chevron-down {
    transform: rotate(180deg);
}

.category-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
    padding: 10px;
    z-index: 100;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.category-filter-dropdown.show {
    display: block;
    animation: fadeIn 0.2s;
}

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

.category-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #3c4858;
    border-radius: 6px;
    text-decoration: none;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.category-item:hover {
    background: #f7fafc;
    color: #667eea;
}

.category-item.active {
    background: #ebf4ff;
    color: #667eea;
    font-weight: 500;
}

.category-item i {
    margin-right: 10px;
}

.filter-group {
    flex: 1;
    min-width: 130px;
}

.filter-section .form-control {
    border: 1px solid #e4e7eb;
    border-radius: 25px;
    height: 42px;
    padding: 10px 20px;
    background-color: #f7fafc;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    width: 100%;
    transition: all 0.3s;
}

.filter-section .form-control:focus {
    outline: none;
    border-color: #a3bffa;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

/* 图书统计显示 */
.browse-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 25px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex: 1;
    min-width: 160px;
    max-width: 240px;
}

.stat-item i {
    font-size: 24px;
    color: #667eea;
    margin-right: 15px;
    background: #ebf4ff;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3c4858;
}

.stat-label {
    font-size: 0.875rem;
    color: #8492a6;
}

.search-results {
    flex: 2;
    padding: 12px 20px;
    background: #ebf4ff;
    border-radius: 12px;
    color: #667eea;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 图书网格布局 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

/* 图书卡片样式 */
.book-card {
    border-radius: 10px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
}

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

.books-grid .book-card:nth-child(1) { animation-delay: 0.1s; }
.books-grid .book-card:nth-child(2) { animation-delay: 0.15s; }
.books-grid .book-card:nth-child(3) { animation-delay: 0.2s; }
.books-grid .book-card:nth-child(4) { animation-delay: 0.25s; }
.books-grid .book-card:nth-child(5) { animation-delay: 0.3s; }
.books-grid .book-card:nth-child(6) { animation-delay: 0.35s; }
.books-grid .book-card:nth-child(7) { animation-delay: 0.4s; }
.books-grid .book-card:nth-child(8) { animation-delay: 0.45s; }
.books-grid .book-card:nth-child(9) { animation-delay: 0.5s; }
.books-grid .book-card:nth-child(10) { animation-delay: 0.55s; }
.books-grid .book-card:nth-child(11) { animation-delay: 0.6s; }
.books-grid .book-card:nth-child(12) { animation-delay: 0.65s; }

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
}

.book-cover {
    height: 240px;
    position: relative;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.08);
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.5) 100%);
    z-index: 1;
}

.book-ribbon {
    position: absolute;
    top: 10px;
    right: -30px;
    transform: rotate(45deg);
    width: 120px;
    text-align: center;
    z-index: 2;
}

.book-ribbon span {
    display: block;
    width: 100%;
    padding: 5px 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.book-ribbon .available {
    background-color: #4caf50;
    color: white;
}

.book-ribbon .unavailable {
    background-color: #f44336;
    color: white;
}

.no-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #f6f9fc 0%, #e9ecef 100%);
    color: #8492a6;
}

.no-cover i {
    font-size: 40px;
    margin-bottom: 10px;
}

.book-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #3c4858;
    margin: 0 0 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-author {
    font-size: 0.95rem;
    color: #8492a6;
    margin-bottom: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.book-category {
    padding: 5px 10px;
    background-color: #ebf4ff;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.75rem;
}

.book-year {
    padding: 5px 10px;
    background-color: #f7fafc;
    color: #8492a6;
    border-radius: 20px;
    font-size: 0.75rem;
}

.book-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: auto;
}

.book-actions a, .book-actions button {
    padding: 10px 12px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-detail {
    background-color: #e9ecef;
    color: #3c4858;
}

.btn-detail:hover {
    background-color: #dee2e6;
    color: #2d3748;
}

.btn-borrow {
    background-color: #667eea;
    color: white;
}

.btn-borrow:hover {
    background-color: #5a67d8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(102, 126, 234, 0.4);
}

.btn-borrow.disabled {
    background-color: #cbd5e0;
    color: #718096;
    cursor: not-allowed;
}

/* 无图书状态 */
.no-books {
    grid-column: 1 / -1;
    padding: 50px 30px;
    text-align: center;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.no-books-img {
    max-width: 200px;
    margin-bottom: 20px;
}

.no-books h3 {
    font-size: 1.25rem;
    color: #3c4858;
    margin: 0 0 10px;
}

.no-books p {
    font-size: 1rem;
    color: #8492a6;
    margin-bottom: 20px;
}

.btn-reset-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #667eea;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-reset-search:hover {
    background-color: #5a67d8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(102, 126, 234, 0.4);
}

/* 分页容器 */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    background-color: white;
    border-radius: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 15px;
    border: none;
    color: #3c4858;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.pagination .page-link:hover {
    color: #667eea;
    background-color: #f7fafc;
}

.pagination .page-item.active .page-link {
    background-color: #667eea;
    color: white;
    box-shadow: none;
}

.pagination .page-item.disabled .page-link {
    color: #cbd5e0;
    background-color: #f7fafc;
    cursor: not-allowed;
}

.pagination-info {
    color: #8492a6;
    font-size: 0.9rem;
}

/* 模态框样式优化 */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    background-color: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    color: #3c4858;
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e2e8f0;
    background-color: #f7fafc;
}

.modal-info {
    margin-top: 10px;
    padding: 12px 16px;
    background-color: #ebf8ff;
    border-left: 4px solid #4299e1;
    color: #2b6cb0;
    font-size: 0.9rem;
    border-radius: 4px;
}

.modal .close {
    font-size: 1.5rem;
    color: #a0aec0;
    opacity: 0.8;
    text-shadow: none;
    transition: all 0.2s;
}

.modal .close:hover {
    opacity: 1;
    color: #667eea;
}

.modal .btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.modal .btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
    border: none;
}

.modal .btn-secondary:hover {
    background-color: #cbd5e0;
    color: #2d3748;
}

.modal .btn-primary {
    background-color: #667eea;
    color: white;
    border: none;
}

.modal .btn-primary:hover {
    background-color: #5a67d8;
    box-shadow: 0 5px 10px rgba(102, 126, 234, 0.4);
}

/* 响应式调整 */
@media (max-width: 992px) {
    .filter-row {
        flex-wrap: wrap;
    }

    .category-filters {
        flex: 1 0 100%;
        margin-bottom: 10px;
    }

    .filter-group {
        flex: 1 0 180px;
    }
}

@media (max-width: 768px) {
    .browse-container {
        padding: 16px;
    }

    .page-header {
        text-align: left;
    }

    .filter-section {
        padding: 15px;
    }

    .search-form {
        flex-direction: column;
        gap: 12px;
    }

    .search-group {
        max-width: 100%;
    }

    .filter-row {
        gap: 12px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }

    .stat-item {
        min-width: 130px;
        padding: 10px;
    }

    .stat-item i {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }

    .search-results {
        padding: 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .books-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .book-cover {
        height: 180px;
    }

    .book-info {
        padding: 12px;
    }

    .book-title {
        font-size: 0.9rem;
    }

    .book-author {
        font-size: 0.8rem;
    }

    .book-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .browse-stats {
        flex-direction: column;
        align-items: stretch;
    }

    .stat-item {
        max-width: none;
    }

    .search-results {
        width: 100%;
    }
}
