/* ==========================================================================
   爬虫页样式 —— 复用即梦主题
   ========================================================================== */

#hmViewCrawler {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 40px;
}

.crawler-input-card {
    background: #161616;
    border: 1px solid #232323;
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crawler-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crawler-url-wrap {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    background: #0f0f12;
    border: 1px solid #2a2a32;
    border-radius: 10px;
    transition: border-color .15s;
}

.crawler-url-wrap:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, .15);
}

.crawler-url-wrap>i {
    color: #71717a;
    font-size: 13px;
}

.crawler-url-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e4e4e7;
    font-size: 13.5px;
    font-family: inherit;
}

.crawler-url-wrap input::placeholder {
    color: #52525b;
}

.crawler-count-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    background: #0f0f12;
    border: 1px solid #2a2a32;
    border-radius: 10px;
}

.crawler-count-wrap>label {
    font-size: 12.5px;
    color: #71717a;
}

.crawler-count-wrap input {
    width: 60px;
    background: transparent;
    border: none;
    outline: none;
    color: #e4e4e7;
    font-size: 14px;
    font-family: 'SF Mono', Monaco, monospace;
    text-align: center;
}

.crawler-start-btn,
.crawler-stop-btn {
    height: 42px;
    padding: 0 22px;
    border-radius: 10px;
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
}

.crawler-start-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.crawler-start-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.crawler-start-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.crawler-stop-btn {
    background: #ef4444;
    color: #fff;
}

.crawler-stop-btn:hover {
    background: #dc2626;
}

.crawler-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    color: #a1a1aa;
}

.crawler-status-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crawler-status-text::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #52525b;
}

.crawler-status.running .crawler-status-text::before {
    background: #facc15;
    animation: cvPulse 1s infinite;
}

.crawler-status.success .crawler-status-text::before {
    background: #22c55e;
}

.crawler-status.error .crawler-status-text::before {
    background: #ef4444;
}

.crawler-progress-bar {
    height: 4px;
    background: #1f1f24;
    border-radius: 2px;
    overflow: hidden;
}

.crawler-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    width: 0%;
    transition: width .3s ease;
    border-radius: 2px;
}

/* 主体布局 —— ★ 固定高度，让内部自己滚动 */
.crawler-main {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    height: calc(100vh - 340px);
    /* ★ 关键：固定高度 */
    min-height: 420px;
    max-height: 800px;
}

.crawler-chapters,
.crawler-content {
    background: #161616;
    border: 1px solid #232323;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* ★ 关键：允许 flex 子项收缩 */
}

.crawler-chapters-header,
.crawler-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #232323;
    font-size: 13px;
    font-weight: 600;
    color: #e4e4e7;
    flex-shrink: 0;
}

.crawler-chapters-count,
.crawler-content-meta {
    font-size: 11.5px;
    color: #71717a;
    font-weight: 400;
}

.crawler-chapters-list,
.crawler-content-body {
    flex: 1;
    min-height: 0;
    /* ★ 关键 */
    overflow-y: auto;
}

.crawler-chapters-list::-webkit-scrollbar {
    width: 5px;
}

.crawler-chapters-list::-webkit-scrollbar-thumb {
    background: #2a2a32;
    border-radius: 3px;
}

.crawler-chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12.5px;
    color: #a1a1aa;
    cursor: pointer;
    transition: all .12s;
    line-height: 1.4;
}

.crawler-chapter-item:hover {
    background: #1f1f24;
    color: #fff;
}

.crawler-chapter-item.active {
    background: rgba(99, 102, 241, .15);
    color: #c7d2fe;
}

.crawler-chapter-item .crawler-chapter-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crawler-chapter-item .crawler-chapter-status {
    font-size: 10px;
    color: #52525b;
    flex-shrink: 0;
}

.crawler-chapter-item.active .crawler-chapter-status {
    color: #a5b4fc;
}

.crawler-content-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    color: #d4d4d8;
    font-size: 14px;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

.crawler-content-body::-webkit-scrollbar {
    width: 6px;
}

.crawler-content-body::-webkit-scrollbar-thumb {
    background: #2a2a32;
    border-radius: 3px;
}

.crawler-content-body .crawler-content-title-display {
    display: block;
    color: #a5b4fc;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

.crawler-empty,
.crawler-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    min-height: 200px;
    color: #52525b;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

.crawler-empty i,
.crawler-empty-content i {
    font-size: 32px;
    opacity: .4;
}

/* 底部操作栏 */
.crawler-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: #161616;
    border: 1px solid #232323;
    border-radius: 14px;
}

.crawler-footer-stats {
    font-size: 12.5px;
    color: #71717a;
}

.crawler-footer-stats strong {
    color: #a5b4fc;
    font-weight: 600;
}

.crawler-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crawler-bookname-input {
    height: 36px;
    width: 200px;
    padding: 0 12px;
    background: #0f0f12;
    border: 1px solid #2a2a32;
    border-radius: 8px;
    color: #e4e4e7;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}

.crawler-bookname-input:focus {
    border-color: #6366f1;
}

.crawler-btn-secondary,
.crawler-btn-primary {
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
    font-family: inherit;
    border: none;
}

.crawler-btn-secondary {
    background: transparent;
    border: 1px solid #2a2a32;
    color: #d4d4d8;
}

.crawler-btn-secondary:hover {
    background: #1f1f24;
    color: #fff;
}

.crawler-btn-primary {
    background: #6366f1;
    color: #fff;
}

.crawler-btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}

.crawler-btn-primary:disabled {
    background: #2a2a32;
    color: #52525b;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .crawler-main {
        grid-template-columns: 1fr;
    }

    .crawler-chapters {
        max-height: 200px;
    }
}








/* ==========================================================================
   引导 / 错误提示
   ========================================================================== */
.crawler-guide,
.crawler-invalid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 320px;
    padding: 40px 24px;
    gap: 8px;
}

.crawler-guide-icon,
.crawler-invalid-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 8px;
}

.crawler-guide-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(139, 92, 246, .18));
    color: #a5b4fc;
}

.crawler-invalid-icon {
    background: rgba(245, 158, 11, .15);
    color: #f59e0b;
}

.crawler-guide-title,
.crawler-invalid-title {
    font-size: 16px;
    font-weight: 600;
    color: #e4e4e7;
    margin: 0;
}

.crawler-invalid-title {
    color: #fbbf24;
}

.crawler-guide-sub,
.crawler-invalid-sub {
    font-size: 13px;
    color: #a1a1aa;
    margin: 4px 0 0;
    line-height: 1.7;
}

.crawler-guide-sub b {
    color: #c7d2fe;
    font-weight: 600;
}

.crawler-invalid-sub {
    color: #d4d4d8;
    font-size: 13.5px;
    margin-top: 8px;
}

.crawler-guide-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    background: #0f0f12;
    border: 1px solid #232323;
    border-radius: 10px;
    padding: 14px 20px;
    max-width: 560px;
    width: 100%;
}

.crawler-guide-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: #d4d4d8;
}

.crawler-guide-list li i {
    color: #22c55e;
    font-size: 13px;
    flex-shrink: 0;
}

.crawler-guide-list li code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12.5px;
    color: #a5b4fc;
    background: rgba(99, 102, 241, .1);
    padding: 2px 8px;
    border-radius: 4px;
    user-select: text;
}

.crawler-guide-tip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 16px;
    background: rgba(99, 102, 241, .08);
    border: 1px solid rgba(99, 102, 241, .2);
    border-radius: 8px;
    font-size: 12.5px;
    color: #c7d2fe;
}

.crawler-guide-tip i {
    color: #a5b4fc;
}

.crawler-guide-tip b {
    color: #e4e4e7;
}

.crawler-invalid-tip {
    margin-top: 20px;
    padding: 16px 20px;
    background: #0f0f12;
    border: 1px solid #232323;
    border-radius: 10px;
    max-width: 560px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    text-align: left;
}

.crawler-invalid-tip-title {
    font-size: 12.5px;
    color: #a1a1aa;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crawler-invalid-tip-title i {
    color: #f59e0b;
}

.crawler-invalid-tip code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    color: #a5b4fc;
    background: rgba(99, 102, 241, .1);
    padding: 4px 10px;
    border-radius: 4px;
    user-select: text;
    display: block;
    width: 100%;
    box-sizing: border-box;
}