/**
 * 半糖书屋 - 书籍详情页样式
 * 翻开的书本风格设计
 */

/* ========================================
   面包屑导航
   ======================================== */
.detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: var(--background-warm);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-light);
}

.detail-breadcrumb a {
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.detail-breadcrumb a:hover {
    color: var(--primary-color);
}

.detail-breadcrumb .separator {
    font-size: 10px;
    color: var(--text-light);
}

.detail-breadcrumb .current {
    color: var(--primary-dark);
    font-weight: 500;
}

/* ========================================
   主区域 - 书本展开效果
   ======================================== */
.book-detail-section {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
    overflow: hidden;
}

/* 书签装饰 */
.bookmark-decoration {
    position: absolute;
    top: -8px;
    right: 60px;
    z-index: 10;
}

.bookmark-ribbon {
    width: 32px;
    height: 80px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    transition: transform 0.3s ease;
}

.bookmark-ribbon:hover {
    transform: translateY(8px);
}

.book-detail-wrapper {
    display: flex;
    gap: 48px;
}

/* ========================================
   左侧封面区域
   ======================================== */
.book-detail-cover {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* 3D 书籍效果 */
.book-3d-wrapper {
    perspective: 1000px;
    width: 220px;
    height: 310px;
}

.book-3d {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateY(15deg);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-3d-wrapper:hover .book-3d {
    transform: rotateY(25deg) scale(1.02);
}

.book-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 25px;
    height: 100%;
    background: linear-gradient(90deg,
        #8b5a2b 0%,
        #a0522d 30%,
        #8b5a2b 70%,
        #6b4423 100%);
    transform: rotateY(-90deg) translateZ(12.5px) translateX(-12.5px);
    border-radius: 2px 0 0 2px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.book-spine::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 8px;
    right: 8px;
    background: linear-gradient(180deg,
        rgba(255, 215, 0, 0.6) 0%,
        rgba(255, 215, 0, 0.3) 50%,
        rgba(255, 215, 0, 0.6) 100%);
    border-radius: 2px;
}

.book-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-paper) 0%, #efe8df 100%);
    border-radius: 0 6px 6px 0;
    transform: translateZ(12.5px);
    overflow: hidden;
    box-shadow:
        4px 4px 15px rgba(139, 90, 43, 0.25),
        0 0 1px rgba(0, 0, 0, 0.1);
}

.book-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-front .cover-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.cover-badge.finished {
    background: rgba(46, 204, 113, 0.9);
    color: white;
}

.cover-badge.ongoing {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

.book-pages {
    position: absolute;
    right: 0;
    top: 4px;
    width: 25px;
    height: calc(100% - 8px);
    background: repeating-linear-gradient(
        to bottom,
        #fff 0px,
        #fff 1px,
        #f5f0e8 1px,
        #f5f0e8 3px
    );
    transform: rotateY(90deg) translateZ(195px) translateX(12.5px);
    border-radius: 0 2px 2px 0;
}

/* ========================================
   评分区域
   ======================================== */
.rating-display {
    text-align: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-cream) 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border-warm);
}

.rating-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.score-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    font-family: Georgia, serif;
    line-height: 1;
}

.score-label {
    font-size: 14px;
    color: var(--text-light);
}

.rating-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
    color: #ffc107;
    font-size: 16px;
}

.rating-stars .bi-star {
    color: var(--text-light);
}

.rating-count {
    font-size: 12px;
    color: var(--text-light);
}

/* ========================================
   右侧信息区域
   ======================================== */
.book-detail-info {
    flex: 1;
    position: relative;
    padding: 20px 24px;
    background: linear-gradient(135deg, #fffdf9 0%, #fff8ee 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* 书页折角 */
.page-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, transparent 50%, var(--accent-cream) 50%);
    border-bottom-left-radius: 8px;
}

.page-corner::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--white) 50%, transparent 50%);
    box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
    line-height: 1.3;
    letter-spacing: 1px;
}

.detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 15px;
}

.author-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-weight: 500;
    padding: 4px 12px;
    background: var(--primary-light);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.author-link:hover {
    background: var(--accent-cream);
    transform: translateY(-2px);
}

.meta-divider {
    color: var(--text-light);
}

.category-link {
    color: var(--secondary-color);
    font-weight: 500;
}

.category-link:hover {
    color: var(--primary-color);
}

.sub-category {
    color: var(--text-light);
}

/* ========================================
   标签
   ======================================== */
.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag-item {
    padding: 4px 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 12px;
    color: var(--secondary-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.tag-item:hover {
    background: var(--accent-cream);
    border-color: var(--border-warm);
    color: var(--primary-dark);
    transform: scale(1.05);
}

/* ========================================
   统计数据
   ======================================== */
.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    border-radius: 50%;
    color: white;
    font-size: 16px;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
}

/* ========================================
   更新信息
   ======================================== */
.update-info {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.update-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.update-row:last-child {
    margin-bottom: 0;
}

.update-label {
    width: 80px;
    font-size: 13px;
    color: var(--text-light);
    flex-shrink: 0;
}

.latest-chapter {
    color: var(--primary-color);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.latest-chapter:hover {
    text-decoration: underline;
}

.update-time {
    color: var(--secondary-color);
    font-size: 14px;
}

/* ========================================
   操作按钮
   ======================================== */
.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(196, 139, 74, 0.35);
    text-decoration: none;
}

.btn-primary-action:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(196, 139, 74, 0.45);
    color: white;
}

.btn-primary-action:active {
    transform: translateY(-1px);
}

.btn-secondary-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--white);
    color: var(--primary-dark);
    border: 2px solid var(--border-warm);
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary-action:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-secondary-action.collected {
    background: var(--accent-cream);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon-action {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--secondary-color);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon-action:hover {
    background: var(--accent-cream);
    border-color: var(--border-warm);
    color: var(--primary-color);
    transform: translateY(-2px) rotate(5deg);
}

/* ========================================
   简介区域
   ======================================== */
.book-intro-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.section-title i {
    color: var(--primary-color);
    font-size: 20px;
}

.section-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-warm), transparent);
    margin-left: 20px;
}

.intro-content {
    position: relative;
}

.intro-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--secondary-color);
    max-height: 108px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.5s ease;
}

.intro-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--white));
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.intro-text.expanded {
    max-height: 2000px;
}

.intro-text.expanded::after {
    opacity: 0;
}

.expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: var(--background-warm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: var(--accent-cream);
    border-color: var(--border-warm);
}

.expand-btn i {
    transition: transform 0.3s ease;
}

/* ========================================
   章节列表区域
   ======================================== */
.chapter-list-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.chapter-count {
    margin-left: 12px;
    padding: 4px 12px;
    background: var(--accent-cream);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 400;
    color: var(--primary-dark);
}

.section-controls {
    display: flex;
    gap: 8px;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--background-warm);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 13px;
    color: var(--secondary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-btn:hover {
    background: var(--accent-cream);
    border-color: var(--border-warm);
}

.sort-btn.active {
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    color: white;
    border-color: var(--primary-color);
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--background-warm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.chapter-item:hover {
    background: var(--white);
    border-color: var(--border-warm);
    transform: translateX(4px);
    box-shadow: var(--shadow-card);
}

.chapter-number {
    flex-shrink: 0;
    font-weight: 500;
    color: var(--primary-dark);
}

.chapter-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--secondary-color);
}

.chapter-item:hover .chapter-title {
    color: var(--primary-color);
}

.vip-badge {
    flex-shrink: 0;
    padding: 2px 6px;
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #8b5a2b;
}

.new-badge {
    flex-shrink: 0;
    padding: 2px 6px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.chapter-item.vip {
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff8ee 100%);
}

.chapter-pagination {
    margin-top: 24px;
    text-align: center;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--background-warm);
    border: 2px dashed var(--border-warm);
    border-radius: 24px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: var(--accent-cream);
    border-style: solid;
    transform: scale(1.02);
}

/* ========================================
   相关推荐
   ======================================== */
.recommend-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    border: 1px solid var(--border-color);
}

.more-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.more-link:hover {
    gap: 10px;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.recommend-card {
    display: flex;
    flex-direction: column;
    background: var(--background-warm);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.recommend-card:hover {
    border-color: var(--border-warm);
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.recommend-cover {
    position: relative;
    padding-top: 133%;
    overflow: hidden;
}

.recommend-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.recommend-card:hover .recommend-cover img {
    transform: scale(1.08);
}

.recommend-info {
    padding: 16px;
}

.recommend-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recommend-card:hover .recommend-title {
    color: var(--primary-color);
}

.recommend-desc {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
    height: 36px;
}

.recommend-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.recommend-category {
    padding: 2px 8px;
    background: var(--accent-cream);
    border-radius: 8px;
    color: var(--primary-dark);
}

.recommend-words {
    color: var(--text-light);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .book-detail-wrapper {
        flex-direction: column;
        gap: 32px;
    }

    .book-detail-cover {
        align-items: center;
    }

    .book-3d-wrapper {
        width: 180px;
        height: 254px;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .chapter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .recommend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .book-detail-section {
        padding: 24px;
    }

    .bookmark-decoration {
        right: 24px;
    }

    .bookmark-ribbon {
        width: 24px;
        height: 60px;
    }

    .detail-title {
        font-size: 22px;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .stat-value {
        font-size: 16px;
    }

    .detail-actions {
        flex-wrap: wrap;
    }

    .btn-primary-action,
    .btn-secondary-action {
        flex: 1;
        justify-content: center;
        padding: 12px 20px;
        font-size: 14px;
    }

    .chapter-grid {
        grid-template-columns: 1fr;
    }

    .recommend-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .book-detail-section {
        padding: 16px;
    }

    .book-3d-wrapper {
        width: 150px;
        height: 212px;
    }

    .rating-display {
        padding: 12px 16px;
    }

    .score-number {
        font-size: 28px;
    }

    .detail-meta {
        font-size: 13px;
    }

    .btn-icon-action {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .recommend-grid {
        grid-template-columns: 1fr;
    }

    .recommend-card {
        flex-direction: row;
    }

    .recommend-cover {
        width: 80px;
        padding-top: 0;
        height: 106px;
        flex-shrink: 0;
    }
}

/* ========================================
   入场动画
   ======================================== */
.book-detail-section {
    animation: fadeInUp 0.5s ease-out forwards;
}

.book-intro-section {
    animation: fadeInUp 0.5s ease-out 0.1s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.chapter-list-section {
    animation: fadeInUp 0.5s ease-out 0.2s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.recommend-section {
    animation: fadeInUp 0.5s ease-out 0.3s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* ========================================
   收藏按钮状态样式
   ======================================== */

/* 加载状态 */
.btn-secondary-action.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* 禁用全局 .loading 的伪元素动画 */
.btn-secondary-action.loading::after {
    display: none;
}

.btn-secondary-action.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 收藏成功动画 */
.btn-secondary-action.collecting {
    animation: collectPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes collectPulse {
    0% { transform: scale(1); }
    30% { transform: scale(0.95); }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 已收藏状态增强 */
.btn-secondary-action.collected {
    background: linear-gradient(135deg, var(--accent-cream) 0%, #fff8ee 100%);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(196, 139, 74, 0.2);
}

.btn-secondary-action.collected:hover {
    background: linear-gradient(135deg, #fff8ee 0%, var(--accent-cream) 100%);
    transform: translateY(-2px);
}

.btn-secondary-action.collected i {
    color: var(--primary-color);
}

/* ========================================
   书签形状 Toast 提示
   ======================================== */

/* Toast 容器 */
#toast-container {
    position: fixed;
    top: 20px;
    right: 80px;
    z-index: 10000;
    pointer-events: none;
}

/* 书签形状 Toast */
.bookmark-toast {
    position: relative;
    padding: 14px 24px;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* 书签底部 V 形切口 */
.bookmark-toast::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--primary-color);
}

/* 成功状态 - 暖棕渐变 */
.bookmark-toast.success {
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
}

.bookmark-toast.success::after {
    border-top-color: var(--primary-color);
}

/* 失败状态 - 红棕渐变 */
.bookmark-toast.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.bookmark-toast.error::after {
    border-top-color: #c0392b;
}

/* 信息状态 */
.bookmark-toast.info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.bookmark-toast.info::after {
    border-top-color: #2980b9;
}

/* Toast 动画 */
.bookmark-toast.slide-in {
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.bookmark-toast.slide-out {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100px);
        opacity: 0;
    }
}

/* ========================================
   登录提示模态框（借书卡风格）
   ======================================== */

/* 遮罩层 */
.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-overlay.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.login-modal-overlay.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* 借书卡风格卡片 */
.login-modal-card {
    width: 360px;
    max-width: 90vw;
    background: #fffdf9;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(139, 90, 43, 0.25);
    overflow: hidden;
}

.login-modal-overlay.fade-in .login-modal-card {
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.login-modal-overlay.fade-out .login-modal-card {
    animation: modalSlideDown 0.3s ease forwards;
}

/* 红色装饰条（借书卡风格） */
.login-modal-header {
    height: 8px;
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.login-modal-body {
    padding: 32px;
    text-align: center;
}

.login-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.login-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.login-modal-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

.login-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.login-modal-btn {
    padding: 12px 28px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-modal-btn.primary {
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(196, 139, 74, 0.35);
}

.login-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 139, 74, 0.45);
}

.login-modal-btn.secondary {
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.login-modal-btn.secondary:hover {
    background: var(--background-warm);
    border-color: var(--border-warm);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideUp {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes modalSlideDown {
    from {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    to {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
}

/* ========================================
   Toast 和模态框响应式设计
   ======================================== */
@media (max-width: 768px) {
    #toast-container {
        right: 50%;
        transform: translateX(50%);
        left: auto;
    }

    .bookmark-toast {
        padding: 12px 20px;
        font-size: 13px;
    }

    .login-modal-card {
        width: 320px;
    }

    .login-modal-body {
        padding: 24px;
    }

    .login-modal-icon {
        font-size: 40px;
    }

    .login-modal-title {
        font-size: 18px;
    }

    .login-modal-desc {
        font-size: 13px;
    }

    .login-modal-btn {
        padding: 10px 24px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        transform: none;
    }

    .bookmark-toast {
        width: 100%;
        justify-content: center;
    }

    .login-modal-card {
        width: calc(100vw - 32px);
    }

    .login-modal-actions {
        flex-direction: column;
    }

    .login-modal-btn {
        width: 100%;
    }
}

/* ========================================
   分享模态框 - 书信邀请函风格
   ======================================== */

/* 遮罩层 */
.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(62, 39, 20, 0.7) 0%, rgba(30, 18, 8, 0.9) 100%);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
}

.share-modal-overlay.fade-in {
    animation: letterOverlayIn 0.4s ease forwards;
}

.share-modal-overlay.fade-out {
    animation: letterOverlayOut 0.3s ease forwards;
}

@keyframes letterOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes letterOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 信封容器 */
.share-letter-envelope {
    position: relative;
    width: 480px;
    max-width: 92vw;
    transform-style: preserve-3d;
}

.share-modal-overlay.fade-in .share-letter-envelope {
    animation: envelopeOpen 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.share-modal-overlay.fade-out .share-letter-envelope {
    animation: envelopeClose 0.4s ease forwards;
}

@keyframes envelopeOpen {
    0% {
        opacity: 0;
        transform: rotateX(-30deg) translateY(60px) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: rotateX(10deg) translateY(-10px) scale(1.02);
    }
    100% {
        transform: rotateX(0deg) translateY(0) scale(1);
    }
}

@keyframes envelopeClose {
    to {
        opacity: 0;
        transform: rotateX(20deg) translateY(40px) scale(0.9);
    }
}

/* 信封盖子装饰 */
.envelope-flap {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 40px;
    background: linear-gradient(180deg, #d4a574 0%, #c48b4a 100%);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    z-index: 1;
    box-shadow: 0 4px 12px rgba(139, 90, 43, 0.3);
}

.envelope-flap::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: linear-gradient(180deg, #e8c9a0 0%, #d4a574 100%);
    clip-path: polygon(50% 10%, 95% 100%, 5% 100%);
}

/* 信纸主体 */
.share-letter-card {
    position: relative;
    background:
        /* 纸张纹理 */
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"),
        /* 羊皮纸渐变 */
        linear-gradient(175deg,
            #fdf8f0 0%,
            #f9f0e3 15%,
            #f5ead8 30%,
            #f2e5d0 50%,
            #efe0c8 70%,
            #f5ead8 85%,
            #faf3e8 100%
        );
    border-radius: 4px;
    box-shadow:
        0 2px 4px rgba(139, 90, 43, 0.1),
        0 8px 24px rgba(139, 90, 43, 0.15),
        0 24px 48px rgba(62, 39, 20, 0.2),
        inset 0 0 80px rgba(210, 180, 140, 0.15);
    padding: 32px 36px;
    border: 1px solid rgba(180, 140, 90, 0.3);
    overflow: hidden;
}

/* 纸张边缘做旧效果 */
.share-letter-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(180, 140, 90, 0.08) 0%, transparent 3%, transparent 97%, rgba(180, 140, 90, 0.08) 100%),
        linear-gradient(180deg, rgba(180, 140, 90, 0.05) 0%, transparent 5%, transparent 95%, rgba(180, 140, 90, 0.1) 100%);
    pointer-events: none;
    border-radius: 4px;
}

/* 蜡封关闭按钮 */
.wax-seal-close {
    position: absolute;
    top: -12px;
    right: 24px;
    width: 52px;
    height: 52px;
    background:
        radial-gradient(circle at 35% 35%,
            #a83232 0%,
            #8b1a1a 40%,
            #6b0f0f 70%,
            #4a0a0a 100%
        );
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    box-shadow:
        0 4px 12px rgba(139, 26, 26, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 200, 200, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.wax-seal-close::before {
    content: '';
    position: absolute;
    inset: 4px;
    background:
        radial-gradient(circle at 30% 30%,
            rgba(255, 150, 150, 0.3) 0%,
            transparent 50%
        );
    border-radius: 50%;
}

.wax-seal-close::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 200, 180, 0.2);
    border-radius: 50%;
}

.seal-text {
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 20px;
    font-weight: 700;
    color: #ffeedd;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
}

.wax-seal-close:hover {
    transform: scale(1.1) rotate(-10deg);
    box-shadow:
        0 8px 20px rgba(139, 26, 26, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 200, 200, 0.3);
}

.wax-seal-close:active {
    transform: scale(1.05) rotate(-5deg);
}

/* 羽毛笔装饰 */
.quill-decoration {
    position: absolute;
    top: 20px;
    left: -15px;
    width: 45px;
    height: 90px;
    color: #8b6914;
    opacity: 0.5;
    transform: rotate(25deg);
    pointer-events: none;
    filter: drop-shadow(2px 2px 4px rgba(139, 105, 20, 0.2));
}

.quill-svg {
    width: 100%;
    height: 100%;
}

/* 信纸头部 */
.letter-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
    padding-top: 8px;
}

.header-flourish {
    font-size: 24px;
    color: #b8860b;
    opacity: 0.7;
    line-height: 1;
}

.header-flourish.left {
    transform: scaleX(-1);
}

.letter-title {
    font-family: "STXingkai", "Xingkai SC", "行楷", "STKaiti", "KaiTi", "楷体", serif;
    font-size: 28px;
    font-weight: 400;
    color: #5a3e2b;
    letter-spacing: 8px;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(90, 62, 43, 0.1);
}

/* 分割线装饰 */
.ornament-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0 24px;
    color: #c9a66b;
}

.divider-wing {
    font-size: 12px;
    letter-spacing: 2px;
    opacity: 0.6;
}

.divider-icon {
    font-size: 18px;
    animation: bookFloat 3s ease-in-out infinite;
}

@keyframes bookFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* 书籍邮票区域 */
.book-stamp-section {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

/* 邮票框架 - 简洁优雅风格 */
.stamp-frame {
    position: relative;
    flex-shrink: 0;
    width: 95px;
    background: #fff;
    padding: 6px;
    border-radius: 3px;
    box-shadow:
        0 4px 16px rgba(90, 62, 43, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 0 0 1px rgba(180, 140, 90, 0.1);
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
}

.stamp-frame:hover {
    transform: rotate(0deg) scale(1.02);
}

/* 邮票内边框装饰 */
.stamp-frame::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(180, 140, 90, 0.3);
    border-radius: 1px;
    pointer-events: none;
}

/* 隐藏旧的齿孔元素 */
.stamp-perforations {
    display: none;
}

.stamp-cover {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

/* 邮票角落装饰 */
.stamp-frame::after {
    content: '❦';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #d4a574 0%, #c48b4a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    box-shadow: 0 2px 6px rgba(139, 90, 43, 0.3);
}

.stamp-value {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 10px;
    background: linear-gradient(90deg, transparent, rgba(139, 26, 26, 0.9), transparent);
    color: #ffeedd;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* 书信内容 */
.book-letter-info {
    flex: 1;
    min-width: 0;
}

.letter-greeting {
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 15px;
    color: #6b5344;
    margin: 0 0 12px;
}

.letter-content {
    font-family: "STFangsong", "FangSong", "仿宋", serif;
    font-size: 14px;
    line-height: 1.9;
    color: #5a4a3a;
    margin: 0 0 16px;
    text-align: justify;
}

.book-title-highlight {
    color: #8b4513;
    font-weight: 600;
}

.book-name-bracket {
    color: #b8860b;
    font-weight: 400;
}

.letter-signature {
    text-align: right;
    margin: 0;
}

.signature-text {
    font-family: "STXingkai", "Xingkai SC", "行楷", "STKaiti", serif;
    font-size: 16px;
    color: #8b6914;
    font-style: italic;
}

/* 分享书签区域 */
.share-bookmarks {
    margin-bottom: 20px;
}

.bookmarks-label {
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 13px;
    color: #8b7355;
    text-align: center;
    margin: 0 0 16px;
    letter-spacing: 2px;
}

.bookmarks-row {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* 书签按钮 */
.bookmark-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bookmark-btn:hover {
    transform: translateY(-6px);
}

.bookmark-btn:active {
    transform: translateY(-3px);
}

/* 书签丝带 */
.bookmark-ribbon {
    position: relative;
    width: 44px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.bookmark-ribbon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
}

.bookmark-ribbon.copy {
    background: linear-gradient(180deg, #7c6aa0 0%, #5a4d7a 100%);
}

.bookmark-ribbon.qrcode {
    background: linear-gradient(180deg, #2d8a6e 0%, #1e6b4f 100%);
}

.bookmark-ribbon.weibo {
    background: linear-gradient(180deg, #e6162d 0%, #b31222 100%);
}

.bookmark-ribbon.qq {
    background: linear-gradient(180deg, #12b7f5 0%, #0d8fc2 100%);
}

.bookmark-btn:hover .bookmark-ribbon {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.bookmark-text {
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 12px;
    color: #6b5344;
    transition: color 0.3s ease;
}

.bookmark-btn:hover .bookmark-text {
    color: #8b4513;
}

/* 复制成功状态 */
.bookmark-btn.copied .bookmark-ribbon {
    background: linear-gradient(180deg, #2d8a6e 0%, #1e6b4f 100%);
    animation: ribbonPulse 0.5s ease;
}

.bookmark-btn.copied .bookmark-text {
    color: #2d8a6e;
}

@keyframes ribbonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 二维码区域 */
.qrcode-letter-section {
    margin-top: 20px;
    text-align: center;
}

.qrcode-parchment {
    position: relative;
    display: inline-block;
    padding: 16px;
    background:
        linear-gradient(135deg, #fffef8 0%, #f8f4e8 100%);
    border: 1px solid rgba(180, 140, 90, 0.3);
    box-shadow:
        0 2px 8px rgba(90, 62, 43, 0.1),
        inset 0 0 20px rgba(210, 180, 140, 0.1);
}

/* 二维码角落装饰 */
.qrcode-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #c9a66b;
    border-style: solid;
}

.qrcode-corner.tl {
    top: 4px;
    left: 4px;
    border-width: 2px 0 0 2px;
}

.qrcode-corner.tr {
    top: 4px;
    right: 4px;
    border-width: 2px 2px 0 0;
}

.qrcode-corner.bl {
    bottom: 4px;
    left: 4px;
    border-width: 0 0 2px 2px;
}

.qrcode-corner.br {
    bottom: 4px;
    right: 4px;
    border-width: 0 2px 2px 0;
}

#qrcodeContainer {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

#qrcodeContainer img,
#qrcodeContainer canvas {
    border-radius: 2px;
}

.qrcode-instruction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 0;
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    font-size: 13px;
    color: #8b7355;
}

.qrcode-instruction i {
    font-size: 16px;
    color: #2d8a6e;
}

/* 信纸底部 */
.letter-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed rgba(180, 140, 90, 0.3);
}

.footer-pattern {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: #c9a66b;
    font-size: 10px;
    opacity: 0.6;
}

.footer-pattern span {
    animation: starTwinkle 2s ease-in-out infinite;
}

.footer-pattern span:nth-child(2) {
    animation-delay: 0.3s;
}

.footer-pattern span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* 响应式设计 */
@media (max-width: 540px) {
    .share-letter-envelope {
        width: calc(100vw - 24px);
    }

    .share-letter-card {
        padding: 24px 20px;
    }

    .letter-title {
        font-size: 22px;
        letter-spacing: 4px;
    }

    .quill-decoration {
        display: none;
    }

    .book-stamp-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .stamp-frame {
        width: 85px;
    }

    .stamp-cover {
        height: 105px;
    }

    .letter-content {
        text-align: left;
    }

    .letter-signature {
        text-align: center;
    }

    .bookmarks-row {
        gap: 12px;
    }

    .bookmark-ribbon {
        width: 38px;
        height: 56px;
        font-size: 18px;
    }

    .bookmark-text {
        font-size: 11px;
    }

    .wax-seal-close {
        width: 44px;
        height: 44px;
        top: -10px;
        right: 16px;
    }

    .seal-text {
        font-size: 17px;
    }

    #qrcodeContainer {
        width: 130px;
        height: 130px;
    }
}

@media (max-width: 380px) {
    .header-flourish {
        display: none;
    }

    .ornament-divider .divider-wing {
        display: none;
    }

    .bookmarks-row {
        flex-wrap: wrap;
        gap: 16px 12px;
    }
}
