/* 主样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2rem;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* 标签导航 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

/* 标签内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 卡片 */
.card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* 表单元素 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
}

.form-group .hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    margin-top: 5px;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #e94560;
    background: rgba(255, 255, 255, 0.15);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

select option {
    background: #1a1a2e;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

.btn-success {
    background: linear-gradient(90deg, #00b894, #00cec9);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(90deg, #d63031, #e17055);
    color: #fff;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 搜索统计 */
.search-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.search-stats strong {
    color: #e94560;
}

.stats-detail {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* 书籍列表 */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.book-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.book-item:hover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.1);
    transform: translateX(5px);
}

.book-cover {
    width: 80px;
    height: 110px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-info {
    flex: 1;
    min-width: 0;
}

.book-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-info .meta {
    display: flex;
    gap: 15px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.book-info .latest {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.book-info .progress {
    color: #00b894;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

/* 书架标记 */
.in-shelf {
    font-size: 0.8rem;
    color: #00b894;
}

/* 书源列表 */
.source-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
}

.source-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.source-item.disabled {
    opacity: 0.5;
}

.source-item.invalid {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.source-item.invalid .source-name {
    color: #e94560;
}

.source-info {
    flex: 1;
    min-width: 0;
}

.source-name {
    font-weight: 500;
    display: block;
}

.source-url {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.source-actions {
    display: flex;
    gap: 8px;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 25px;
}

/* 书籍详情 */
.book-detail {
    padding: 10px 0;
}

.book-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.book-detail .book-cover {
    width: 120px;
    height: 160px;
}

.book-title h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.book-title .meta {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 5px;
}

.book-title .source {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.book-title .progress {
    color: #00b894;
    font-size: 0.85rem;
    margin-top: 5px;
}

.book-intro {
    margin-bottom: 20px;
}

.book-intro h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.book-intro p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
}

/* 主要操作 */
.book-actions-main {
    margin-bottom: 15px;
}

/* 次要操作 */
.book-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 下载进度 */
.download-progress {
    text-align: center;
    padding: 20px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    transition: width 0.3s;
}

.progress-text {
    color: rgba(255, 255, 255, 0.6);
}

/* 下载完成 */
.download-complete {
    text-align: center;
    padding: 20px;
}

.download-complete h3 {
    color: #00b894;
    margin-bottom: 10px;
}

.download-complete .actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 阅读器样式 */
.reader {
    position: relative;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.reader-title {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%;
}

.reader-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.reader-content .chapter-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.reader-content .chapter-content p {
    text-indent: 2em;
    margin-bottom: 1em;
}

.reader-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.reader-progress {
    text-align: center;
    font-size: 0.85rem;
}

.progress-bar-mini {
    width: 100px;
    height: 4px;
    background: rgba(128, 128, 128, 0.3);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: #e94560;
    transition: width 0.3s;
}

.reader-nav {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 25px;
    z-index: 100;
}

.reader-nav.show {
    display: flex;
}

.reader-nav button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    padding: 5px 10px;
    cursor: pointer;
}

/* 章节列表 */
.chapter-list-modal {
    padding: 10px 0;
}

.chapter-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.chapter-list-content {
    max-height: 60vh;
    overflow-y: auto;
}

.chapter-list-content .chapter-item {
    display: flex;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chapter-list-content .chapter-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chapter-list-content .chapter-item.current {
    background: rgba(233, 69, 96, 0.2);
}

.chapter-num {
    color: rgba(255, 255, 255, 0.4);
    margin-right: 10px;
    min-width: 40px;
}

.chapter-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.current-mark {
    color: #e94560;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* 阅读设置 */
.reader-settings {
    padding: 10px 0;
}

.reader-settings h3 {
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.setting-item input[type="range"] {
    width: 100%;
}

.theme-options, .font-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.theme-btn, .font-btn {
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn.active, .font-btn.active {
    border-color: #e94560;
}

.setting-actions {
    margin-top: 20px;
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: rgba(0, 184, 148, 0.9);
    color: #fff;
    border-radius: 8px;
    transform: translateX(200%);
    transition: transform 0.3s;
    z-index: 2000;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: rgba(214, 48, 49, 0.9);
}

/* 状态提示 */
.loading {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
}

.empty {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.3);
}

.empty ul {
    text-align: left;
    margin-top: 10px;
    padding-left: 20px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #e94560;
}

.hidden {
    display: none !important;
}

.hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    margin-top: 10px;
}

/* 调试样式 */
.debug-chapter {
    padding: 10px 0;
}

.debug-chapter h3 {
    margin-bottom: 20px;
    color: #e94560;
}

.debug-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.debug-section h4 {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.debug-section p {
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

.debug-section code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    word-break: break-all;
}

.debug-section .success {
    color: #00b894;
}

.debug-section .error {
    color: #e94560;
}

.debug-content, .debug-html {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 10px;
    font-size: 0.8rem;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.debug-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* 换书源样式 */
.change-source-progress {
    text-align: center;
    padding: 30px;
}

.change-source-progress h3 {
    margin-bottom: 15px;
}

.change-source-progress p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
}

.change-source-result {
    padding: 10px 0;
}

.change-source-result h3 {
    margin-bottom: 10px;
}

.change-source-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.match-section {
    margin-bottom: 20px;
}

.match-section h4 {
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid #e94560;
}

.change-source-result .source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.change-source-result .source-item:hover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.1);
}

.change-source-result .source-item.current {
    border-color: #00b894;
    background: rgba(0, 184, 148, 0.1);
}

.change-source-result .source-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.change-source-result .source-name {
    font-weight: 500;
}

.change-source-result .source-latest,
.change-source-result .source-author,
.change-source-result .source-from {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.current-badge {
    background: #00b894;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.change-source-actions {
    margin-top: 20px;
    text-align: center;
}

/* 订阅列表改进 */
.subscribe-list .subscribe-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
}

.subscribe-info {
    flex: 1;
}

.subscribe-name {
    font-weight: 500;
    display: block;
}

.subscribe-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
}

.subscribe-actions {
    display: flex;
    gap: 8px;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .book-item {
        flex-direction: column;
    }
    
    .book-cover {
        width: 100%;
        height: 200px;
    }
    
    .book-header {
        flex-direction: column;
    }
    
    .book-detail .book-cover {
        width: 100%;
        height: 200px;
    }
    
    .form-row {
        flex-direction: column;
    }
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
