/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 6px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #00bcd4 0%, #20b2aa 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 标签页导航 */
.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: white;
    border-bottom-color: #667eea;
    font-weight: bold;
}

/* 标签页内容 */
.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

/* 搜索表单 */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-field {
    flex: 2;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
}

.select-field {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
}

/* 按钮 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 搜索结果 */
.results-container {
    margin-top: 20px;
}

.result-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.result-item:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.result-author {
    color: #666;
    font-size: 0.95em;
}

.result-meta {
    display: flex;
    gap: 15px;
    color: #888;
    font-size: 0.9em;
    margin-top: 10px;
}

.result-meta span {
    display: flex;
    align-items: center;
}

/* 书源列表 */
.sources-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.source-card {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 18px;
    transition: all 0.3s;
}

.source-card:hover {
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.15);
}

.source-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.source-url {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    word-break: break-all;
}

.source-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    margin-right: 5px;
}

.badge-success {
    background: #e8f5e9;
    color: #4caf50;
}

.badge-warning {
    background: #fff3e0;
    color: #ff9800;
}

/* 任务列表 */
.tasks-list {
    margin-top: 20px;
}

.task-item {
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 15px;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.task-status {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
}

.status-pending {
    background: #ffeaa7;
    color: #fdcb6e;
}

.status-downloading {
    background: #74b9ff;
    color: #0984e3;
}

.status-completed {
    background: #55efc4;
    color: #00b894;
}

.status-failed {
    background: #fab1a0;
    color: #e17055;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}

/* 文件列表 */
.files-list {
    margin-top: 20px;
}

.file-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.file-meta {
    color: #888;
    font-size: 0.9em;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 6px;
    padding: 25px;
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }

    .search-form {
        flex-direction: column;
        gap: 12px;
    }

    .input-field,
    .select-field {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .sources-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tabs {
        flex-wrap: wrap;
        position: sticky;
        top: 0;
        z-index: 100;
        background: #f5f5f5;
    }

    .tab-btn {
        flex-basis: 50%;
        padding: 12px 8px;
        font-size: 0.85em;
    }

    .tab-content {
        padding: 15px;
    }

    .header {
        padding: 20px 15px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header .subtitle {
        font-size: 0.9em;
    }

    h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    h3 {
        font-size: 1.1em;
    }

    /* 搜索结果优化 */
    .result-item {
        padding: 14px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .result-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .result-title {
        font-size: 1.1em;
    }

    .result-meta {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    /* 按钮优化 */
    .btn {
        padding: 10px 20px;
        font-size: 0.9em;
        -webkit-tap-highlight-color: transparent;
    }

    /* 书源卡片优化 */
    .source-card {
        padding: 14px;
    }

    .source-name {
        font-size: 1em;
    }

    .source-url {
        font-size: 0.85em;
    }

    /* 任务卡片优化 */
    .task-item {
        padding: 14px;
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* 文件列表优化 */
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .file-item > div:last-child {
        width: 100%;
    }

    .file-item .btn {
        width: 100%;
    }

    /* 模态框优化 */
    .modal-content {
        width: 90%;
        padding: 20px;
        margin: 10px;
    }

    .modal-content h3 {
        font-size: 1.2em;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 0.9em;
    }

    /* Toast 优化 */
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        font-size: 0.9em;
        padding: 10px 15px;
    }

    /* 汇总卡片优化 */
    .check-summary > div {
        padding: 15px !important;
    }

    .check-summary h3 {
        font-size: 1.1em !important;
    }

    .check-summary .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
        gap: 10px !important;
    }

    /* 公告优化 */
    .announcement {
        padding: 14px;
        font-size: 0.9em;
    }

    .announcement h3 {
        font-size: 1.1em;
    }

    /* 进度条容器 */
    .check-progress,
    .search-progress {
        font-size: 0.9em;
    }

    .progress-bar {
        height: 6px;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }

    .tab-btn {
        font-size: 0.75em;
        padding: 10px 5px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85em;
    }

    .result-title {
        font-size: 1em;
    }

    .source-name {
        font-size: 0.95em;
    }

    /* 搜索结果按钮栈式布局 */
    .result-header > div:last-child {
        flex-direction: column;
    }

    .result-header > div:last-child .btn {
        width: 100%;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .tab-content {
        padding: 12px;
    }

    .tabs {
        position: static;
    }
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 15px;
    right: 15px;
    background: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideIn 0.3s;
    font-size: 0.95em;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid #4caf50;
}

.toast-error {
    border-left: 4px solid #f44336;
}

.toast-info {
    border-left: 4px solid #2196f3;
}

/* 书源检查结果样式 */
.badge-danger {
    background: #ffebee;
    color: #f44336;
}

.badge-secondary {
    background: #f5f5f5;
    color: #9e9e9e;
}

.status-success {
    border-left: 4px solid #4caf50 !important;
}

.status-warning {
    border-left: 4px solid #ff9800 !important;
}

.status-error {
    border-left: 4px solid #f44336 !important;
}

.status-disabled {
    border-left: 4px solid #9e9e9e !important;
    opacity: 0.6;
}

.check-summary {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 触摸优化 */
.btn, .tab-btn, .source-card, .result-item, .task-item, .file-item {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    cursor: pointer;
}

/* 阻止双击缩放 */
* {
    touch-action: pan-x pan-y;
}

input, textarea, select {
    touch-action: auto;
}

/* 公告模块 */
.announcement {
    background: linear-gradient(135deg, #e3f2fd 0%, #e0f7fa 100%);
    border-left: 4px solid #00bcd4;
    border-radius: 4px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0, 188, 212, 0.1);
}

.announcement h3 {
    color: #00838f;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.announcement p {
    color: #455a64;
    line-height: 1.6;
    margin: 8px 0;
}

.announcement ul, .announcement ol {
    margin-left: 20px;
    color: #455a64;
    line-height: 1.8;
}

.announcement code {
    background: #b2ebf2;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.announcement pre {
    background: #b2ebf2;
    padding: 12px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
}

.announcement a {
    color: #00838f;
    text-decoration: none;
    font-weight: 500;
}

.announcement a:hover {
    text-decoration: underline;
}

