/* 阅读视图样式 - Lofter风格 */

.reading-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10000;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* iOS 安全区域适配 */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* 淡出动画 */
    animation: fadeIn 0.2s ease-out;
}

.reading-modal.fade-out {
    animation: fadeOut 0.2s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.reading-container {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* 顶部导航 */
.reading-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #f0f0f0;
    z-index: 100;
    flex-shrink: 0;
}

.reading-back-btn,
.reading-menu-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    border-radius: 50%;
    transition: background 0.2s;
}

.reading-back-btn:active,
.reading-menu-btn:active {
    background: #f5f5f5;
}

.reading-book-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 10px;
}

/* 阅读内容区 */
.reading-content {
    padding: 16px 16px 40px;
    max-width: 100%;
    margin: 0 auto;
}

.reading-chapter-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.reading-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.reading-author-name {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.reading-publish-time {
    font-size: 13px;
    color: #999;
}

/* 章节正文 */
.reading-chapter-content {
    font-size: 17px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 32px;
}

.reading-chapter-content p {
    margin: 0 0 20px 0;
    text-indent: 2em;
    text-align: justify;
}

.reading-chapter-content p:last-child {
    margin-bottom: 0;
}

/* 作者的话 */
.reading-author-note {
    background: #f8f9fa;
    border-left: 3px solid #07c160;
    padding: 16px 20px;
    margin: 32px 0;
    border-radius: 4px;
}

.reading-author-note-title {
    font-size: 14px;
    font-weight: 600;
    color: #07c160;
    margin-bottom: 8px;
}

.reading-author-note-content {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

/* 赞赏功能样式 - 新设计 */
.reading-reward-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px 0;
    margin: 32px 0;
    gap: 12px;
}

.reading-reward-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.reading-reward-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.reading-reward-btn:hover::before {
    opacity: 0.3;
}

.reading-reward-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.reading-reward-btn svg {
    stroke: white;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.reading-reward-btn span {
    display: none;
}

.reading-reward-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

/* 导航按钮 */
.reading-nav-buttons {
    display: flex;
    gap: 12px;
    margin: 32px 0;
    padding: 20px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.reading-nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.reading-nav-btn:active {
    background: #e8e8e8;
    transform: scale(0.98);
}

.reading-nav-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reading-nav-btn.disabled:active {
    transform: none;
}

.reading-nav-btn svg {
    flex-shrink: 0;
}

/* 评论区 */
.reading-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 32px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.reading-comments-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.reading-comments-count {
    font-size: 16px;
    color: #999;
    font-weight: 400;
}

.reading-write-comment-btn {
    padding: 6px 16px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reading-write-comment-btn:active {
    background: #06ad56;
    transform: scale(0.95);
}

/* 评论列表 */
.reading-comments-list {
    margin-top: 16px;
}

.reading-comment-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #f5f5f5;
}

.reading-comment-item:last-child {
    border-bottom: none;
}

.reading-comment-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.avatar-emoji {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f5f5f5;
}

.reading-comment-content {
    flex: 1;
    min-width: 0;
}

.reading-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.reading-comment-username {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.reading-comment-time {
    font-size: 12px;
    color: #999;
}

.reading-comment-text {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.reading-comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.reading-comment-like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 13px;
    border-radius: 12px;
    transition: all 0.2s;
}

.reading-comment-like-btn:active {
    background: #f5f5f5;
}

.reading-comment-like-btn.liked {
    color: #07c160;
}

.reading-comment-like-btn.liked svg {
    fill: #07c160;
}

.reading-comment-likes {
    font-size: 13px;
}

/* 礼物赞赏模态框样式 */
.reward-gift-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10003;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.reward-gift-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.reward-gift-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px 32px;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.reward-gift-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.reward-gift-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reward-gift-author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.reward-gift-author-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reward-gift-author-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.reward-gift-author-desc {
    font-size: 13px;
    color: #999;
}

.reward-gift-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.reward-gift-close:active {
    background: #e8e8e8;
    transform: scale(0.95);
}

.reward-gift-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.reward-gift-item {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.reward-gift-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gift-color);
    opacity: 0;
    transition: opacity 0.3s;
}

.reward-gift-item:active {
    transform: scale(0.95);
}

.reward-gift-item:active::before {
    opacity: 0.1;
}

.reward-gift-icon {
    font-size: 40px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s;
}

.reward-gift-item:active .reward-gift-icon {
    transform: scale(1.2);
}

.reward-gift-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    position: relative;
    z-index: 1;
}

.reward-gift-amount {
    font-size: 16px;
    font-weight: 600;
    color: #ff6b6b;
    position: relative;
    z-index: 1;
}

.reward-gift-custom {
    margin-bottom: 16px;
}

.reward-gift-custom-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.reward-gift-custom-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.reward-gift-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 14px;
    color: #666;
}

.reward-gift-recharge {
    padding: 6px 16px;
    background: #07c160;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reward-gift-recharge:active {
    background: #06ad56;
    transform: scale(0.95);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .reading-content {
        padding: 16px 16px 32px;
    }
    
    .reading-chapter-title {
        font-size: 20px;
    }
    
    .reading-chapter-content {
        font-size: 16px;
    }
    
    .reading-nav-buttons {
        gap: 8px;
    }
    
    .reading-nav-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .reward-gift-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .reward-gift-item {
        padding: 16px 8px;
    }
    
    .reward-gift-icon {
        font-size: 36px;
    }
}
