/* 书架页面专用样式 */

/* 书架头部 */
.shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #1f2430;
}

.shelf-header h1 {
    color: #e5e7eb;
    font-size: 2.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shelf-header h1::before {
    content: "📚";
    font-size: 2rem;
}

.shelf-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #60a5fa;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 6px;
}

.sync-icon {
    animation: spin 1s linear infinite;
}

.sync-text {
    font-weight: 500;
}

/* 书架统计 */
.shelf-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #151923;
    border: 1px solid #1f2430;
    border-radius: 12px;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #0b0d12;
    border-radius: 8px;
    border: 1px solid #1f2430;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 搜索和筛选 */
.shelf-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

/* 将书架页的搜索样式限定在筛选区域，避免影响全站头部导航搜索框 */
.filter-search {
    display: flex;
    align-items: center;
    background: #151923;
    border: 1px solid #1f2430;
    border-radius: 8px;
    padding: 0.5rem;
    flex: 1;
    min-width: 300px;
}

.filter-search input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 0.5rem;
    color: #e5e7eb;
    font-size: 1rem;
}

.filter-search input::placeholder {
    color: #9ca3af;
}

.filter-options select {
    padding: 0.75rem 1rem;
    border: 1px solid #1f2430;
    border-radius: 8px;
    background: #151923;
    color: #e5e7eb;
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-options select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* 书架内容 */
.shelf-content {
    margin-bottom: 3rem;
}

.shelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.shelf-item {
    background: #151923;
    border: 1px solid #1f2430;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.shelf-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.book-cover {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #0b0d12;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.shelf-item:hover .book-cover img {
    transform: scale(1.05);
}

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.shelf-item:hover .book-overlay {
    opacity: 1;
}

.book-info {
    padding: 1.5rem;
}

.book-title {
    color: #e5e7eb;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
}

.book-chapter {
    color: #60a5fa;
    font-size: 0.85rem;
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.book-time {
    color: #6b7280;
    font-size: 0.8rem;
    margin: 0 0 1rem 0;
}

.book-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 空状态 */
.empty-shelf {
    text-align: center;
    padding: 4rem 2rem;
    color: #9ca3af;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-shelf h3 {
    color: #e5e7eb;
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}

.empty-shelf p {
    font-size: 1rem;
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

/* 阅读历史 */
.reading-history {
    background: #151923;
    border: 1px solid #1f2430;
    border-radius: 12px;
    padding: 2rem;
}

.reading-history h2 {
    color: #e5e7eb;
    font-size: 1.5rem;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reading-history h2::before {
    content: "📖";
    font-size: 1.2rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #0b0d12;
    border: 1px solid #1f2430;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.history-item:hover {
    background: #1f2430;
}

.history-cover {
    width: 60px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #0b0d12;
}

.history-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-info h4 {
    color: #e5e7eb;
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-info p {
    color: #60a5fa;
    font-size: 0.85rem;
    margin: 0 0 0.25rem 0;
}

.history-time {
    color: #6b7280;
    font-size: 0.8rem;
}

.history-actions {
    flex-shrink: 0;
}

.no-history {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    padding: 2rem;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #374151;
    color: #e5e7eb;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .shelf-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        margin-bottom: 1rem; /* 新增：减少外边距 */
        padding-bottom: 0.6rem; /* 新增：减少下边距 */
    }

    .shelf-actions {
        justify-content: center;
    }

    .shelf-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        padding: 1rem; /* 新增：减小内边距 */
    }

    .shelf-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search { min-width: auto; }

    .shelf-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    /* 新增：移动端字体缩小与布局更紧凑 */
    .shelf-header h1 { font-size: 1.6rem; }
    .stat-item { padding: 0.75rem; }
    .stat-number { font-size: 1.5rem; }
    .stat-label { font-size: 0.8rem; }
    .book-info { padding: 1rem; }
    .book-title { font-size: 0.95rem; }
    .book-author { font-size: 0.8rem; }
    .book-chapter { font-size: 0.8rem; }
    .book-time { font-size: 0.75rem; }

    .reading-history { padding: 1rem; }
    .reading-history h2 { font-size: 1.2rem; margin-bottom: 1rem; }
    .history-item { padding: 0.75rem; }
    .history-info h4 { font-size: 0.95rem; }
    .history-info p { font-size: 0.8rem; }
    .history-time { font-size: 0.75rem; }

    .btn { font-size: 0.85rem; padding: 0.45rem 0.9rem; }
    .btn-sm { font-size: 0.75rem; padding: 0.35rem 0.7rem; }
}

@media (max-width: 480px) {
    .shelf-header h1 {
        font-size: 1.5rem;
    }

    .shelf-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.6rem;
        padding: 0.6rem;
    }
    .stat-item { padding: 0.5rem; }

    .shelf-grid {
        grid-template-columns: 1fr;
    }

    .book-actions {
        flex-direction: column;
    }

    .btn {
        justify-content: center;
        font-size: 0.85rem;
    }
}

/* 加载状态 */
.shelf-item.loading {
    opacity: 0.7;
    position: relative;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1.2rem;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shelf-item {
    animation: fadeInUp 0.5s ease-out;
}

.shelf-item:nth-child(1) { animation-delay: 0.1s; }
.shelf-item:nth-child(2) { animation-delay: 0.2s; }
.shelf-item:nth-child(3) { animation-delay: 0.3s; }
.shelf-item:nth-child(4) { animation-delay: 0.4s; }
.shelf-item:nth-child(5) { animation-delay: 0.5s; }
.shelf-item:nth-child(6) { animation-delay: 0.6s; }

/* 书架页移动端紧凑网格：三列布局，类似首页热门（提高优先级） */
@media (max-width: 768px) {
    .shelf-content .shelf-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 0.6rem !important; }
    .shelf-content .shelf-item { width: 100% !important; border-radius: 10px; }
    .shelf-content .book-cover { height: 120px !important; }
    .shelf-content .book-info { padding: 0.6rem !important; }
    .shelf-content .book-title { font-size: 0.85rem !important; -webkit-line-clamp: 2; }
    .shelf-content .book-author,
    .shelf-content .book-chapter,
    .shelf-content .book-time,
    .shelf-content .book-actions { display: none !important; }
}

@media (max-width: 480px) {
    .shelf-content .shelf-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 0.5rem !important; }
    .shelf-content .book-cover { height: 100px !important; }
    .shelf-content .book-info { padding: 0.5rem !important; }
    .shelf-content .book-title { font-size: 0.8rem !important; }
}
