/* 小说模块样式表 - 与门户/API 调试页统一风格 */

:root {
    --bg: #f6f7fb;
    --card-bg: #ffffff;
    --border: #e8eaf1;
    --title: #171c2e;
    --muted: #6b7488;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
}

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

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--title);
    min-height: 100vh;
    padding: 10px;
}

/* ===== 首页样式 ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 10px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px rgba(23, 28, 46, 0.06);
}

h1 {
    font-size: 30px;
    font-weight: 800;
    color: var(--title);
    margin-bottom: 26px;
    text-align: center;
}

h2 {
    color: var(--title);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 700;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fbfbfe;
}

.upload-area:hover {
    border-color: var(--accent);
    background: #eef0ff;
}

.upload-area.highlight {
    border-color: var(--accent);
    background: #eef0ff;
    transform: scale(1.01);
}

.upload-area input[type="file"] {
    display: none;
}

.upload-text {
    font-size: 16px;
    color: var(--title);
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 13px;
    color: var(--muted);
}

.btn {
    display: inline-block;
    padding: 11px 22px;
    background: #eef0ff;
    color: var(--accent);
    border: 1px solid #dfe3ff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.18s ease, border-color 0.18s ease;
    text-decoration: none;
}

.btn:hover {
    background: #e2e6ff;
    border-color: #ccd2ff;
}

.files-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #fbfbfe;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.file-item:hover {
    border-color: #cdd3e6;
    box-shadow: 0 6px 16px rgba(23, 28, 46, 0.06);
}

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

.file-name {
    font-weight: 600;
    color: var(--title);
    margin-bottom: 5px;
}

.file-meta {
    font-size: 12px;
    color: var(--muted);
}

.file-actions {
    display: flex;
    gap: 10px;
}

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

/* ===== 章节列表页面样式 ===== */
.container-full {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(23, 28, 46, 0.06);
    overflow: hidden;
}

.header {
    background: #f8fafc;
    color: var(--title);
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--title);
}

.header p {
    font-size: 14px;
    color: var(--muted);
}

.content {
    padding: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(23, 28, 46, 0.06);
    display: flex;
    flex-direction: column;
    flex: 1;
    max-height: calc(100vh - 40px);
}

.info-bar {
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: center; /* center the title horizontally */
    align-items: center;
    border: 1px solid var(--border);
}

.info-bar-left {
    font-size: 15px;
    font-weight: 600;
    color: var(--title);
    width: 100%;
    text-align: center; /* center text inside the left area */
}

.info-bar-left h1 {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    color: var(--title);
}

.info-bar-right {
    display: flex;
    gap: 10px;
}

.batch-controls {
    background: white;
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
}

.batch-controls input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}

.batch-controls select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    background: white;
}

.batch-controls button {
    padding: 6px 12px;
    background: #f2f4fa;
    color: #3f4658;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.18s ease, border-color 0.18s ease;
    margin-left: auto;
}

.batch-controls button:hover {
    background: #e8ebf5;
    border-color: #d5dae8;
}

.batch-controls .convert-btn {
    background: #eef0ff;
    color: var(--accent);
    border-color: #dfe3ff;
}

.batch-controls .convert-btn:hover {
    background: #e2e6ff;
    border-color: #ccd2ff;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0;
}

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 8px;
    margin-bottom: 10px;
}

thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #5b6478;
    font-size: 13px;
    letter-spacing: 0.02em;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f1f7;
    color: var(--title);
    font-size: 13px;
    background: white;
}

td input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

tbody tr:hover td {
    background: #f5f6fd;
}

.index-col {
    font-weight: 600;
    color: var(--accent);
    width: 60px;
}

.title-col {
    font-weight: 500;
    color: var(--title);
}

.action-col {
    width: 180px;
    text-align: center;
}

button {
    padding: 6px 14px;
    background: #f2f4fa;
    color: #3f4658;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

button:hover {
    background: #e8ebf5;
    border-color: #d5dae8;
}

/* 柔和语义按钮：浅色底 + 彩色文字，简约高级 */
.convert-btn {
    background: #eef0ff;
    color: var(--accent);
    border-color: #dfe3ff;
}

.convert-btn:hover {
    background: #e2e6ff;
    border-color: #ccd2ff;
}

.delete-btn {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fbdcdc;
}

.delete-btn:hover {
    background: #fee4e4;
    border-color: #f7c9c9;
}

.status {
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    display: none;
}

.status.success {
    background: #e8f8ee;
    color: #15803d;
    border: 1px solid #c9ecd4;
    display: block;
}

.status.error {
    background: #fdecec;
    color: #b91c1c;
    border: 1px solid #f5c6c6;
    display: block;
}

.status.loading {
    background: #eef0ff;
    color: var(--accent);
    border: 1px solid #dfe3ff;
    display: block;
}

.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .content {
        padding: 15px;
        max-height: calc(100vh - 60px);
    }

    .info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .info-bar-left h1 {
        font-size: 16px;
    }

    .batch-controls {
        padding: 10px;
        gap: 6px;
    }

    .batch-controls select {
        font-size: 13px;
        padding: 7px 8px;
        flex: 1;
        min-width: 70px;
    }

    .batch-controls button {
        font-size: 13px;
        padding: 7px 10px;
        white-space: nowrap;
    }

    .table-wrapper {
        margin-top: 10px;
        margin-bottom: 15px;
    }

    table {
        font-size: 12px;
    }

    th {
        padding: 8px 6px;
        font-size: 12px;
    }

    td {
        padding: 8px 6px;
        font-size: 12px;
    }

    /* 调整操作列 */
    .action-col {
        width: auto;
    }

    button {
        padding: 6px 10px;
        font-size: 11px;
        margin-right: 3px;
    }

    .download-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .pagination {
        padding: 8px 10px;
        bottom: 0;
    }

    .pagination input {
        width: 40px;
        padding: 4px;
        font-size: 11px;
    }

    .pagination > span {
        gap: 6px;
    }

    .pagination button {
        margin: 0 4px;
    }
}

/* ===== 模态框样式 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--title);
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--title);
    background: #f1f3f9;
    border-radius: 50%;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    line-height: 1.8;
    color: var(--title);
    font-size: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-footer button {
    padding: 8px 20px;
    background: #eef0ff;
    color: var(--accent);
    border: 1px solid #dfe3ff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.modal-footer button:hover {
    background: #e2e6ff;
    border-color: #ccd2ff;
}

/* 链接样式 */
a {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* 响应式设计 - 小于600px */
@media (max-width: 600px) {
    table {
        font-size: 12px;
    }

    td, th {
        padding: 8px 10px;
    }
}

.pagination button {
    padding: 6px 10px;
    border: 1px solid #e3e6f0;
    background: #f2f4fa;
    color: #3f4658;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.18s ease, border-color 0.18s ease;
    font-weight: 500;
    font-size: 13px;
    flex-shrink: 0;
}

.pagination button:hover:not(:disabled) {
    background: #e8ebf5;
    border-color: #d5dae8;
}

.pagination button:disabled {
    background: #f7f8fc;
    color: #aab0c2;
    border-color: #eceef5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #eef0ff;
    color: var(--accent);
    border-color: #dfe3ff;
}

.pagination input {
    width: 50px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.pagination span {
    font-size: 12px;
    color: var(--title);
    font-weight: 500;
    white-space: nowrap;
}

.pagination > span {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex: 1;
}

table tbody tr {
    height: 50px;
}

table tbody td {
    padding: 12px 8px;
}

/* ===== 阅读页面样式 ===== */
.read-page body,
body.read-page {
    background: var(--bg);
}

.read-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 120px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    min-height: 100vh;
}

.read-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.read-header h1 {
    margin: 0;
    color: var(--title);
    font-size: 26px;
    font-weight: 800;
    flex: 1;
    text-align: left;
}

.read-header a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.read-header a:hover {
    text-decoration: underline;
}

.read-content {
    line-height: 2;
    color: #333a4d;
    font-size: 19px;
    text-align: justify;
    margin-bottom: 40px;
    white-space: pre-wrap;
    word-break: break-word;
}

.read-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 900px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    z-index: 1000;
}

.read-nav-inner {
    max-width: 600px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.read-nav a,
.read-nav button {
    flex: 1;
    min-width: 80px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.92);
    color: #3f4658;
    border: 1px solid #e3e6f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 14px rgba(23, 28, 46, 0.08);
    backdrop-filter: blur(6px);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.read-nav a:hover,
.read-nav button:hover:not(:disabled) {
    background: #eef0ff;
    border-color: #dfe3ff;
    color: var(--accent);
}

.read-nav a:disabled,
.read-nav button:disabled {
    cursor: not-allowed;
    background: rgba(247, 248, 252, 0.9);
    color: #aab0c2;
    border-color: #eceef5;
    box-shadow: none;
}

.read-nav span {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 10px 15px;
    color: var(--muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .read-container {
        padding: 20px 15px 140px;
    }

    .read-header h1 {
        font-size: 20px;
    }

    .read-content {
        font-size: 18px;
    }

    .read-nav {
        padding: 8px 15px;
        left: 0;
        right: 0;
        transform: none;
        max-width: 100%;
    }

    .read-nav-inner {
        gap: 8px;
        max-width: 100%;
    }

    .read-nav a,
    .read-nav button {
        min-width: 60px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .read-nav span {
        min-width: 60px;
        padding: 8px 12px;
        font-size: 11px;
    }
}

/* ===== Toast 提示样式 ===== */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(23, 28, 46, 0.16);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.toast-success {
    background: #10b981;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

.toast-warning {
    background: #f59e0b;
    color: white;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    word-break: break-word;
}

/* ===== 确认对话框样式 ===== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.confirm-overlay.show {
    opacity: 1;
}

.confirm-dialog {
    background: white;
    border-radius: 14px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.confirm-overlay.show .confirm-dialog {
    transform: scale(1);
}

.confirm-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--title);
    margin-bottom: 12px;
}

.confirm-message {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 20px;
    line-height: 1.6;
    white-space: pre-line;
}

.confirm-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirm-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.18s ease;
}

.confirm-btn-cancel {
    background: #eef0f8;
    color: var(--muted);
}

.confirm-btn-cancel:hover {
    background: #e2e6f4;
}

.confirm-btn-ok {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fbdcdc;
}

.confirm-btn-ok:hover {
    background: #fee4e4;
    border-color: #f7c9c9;
}

@media (max-width: 480px) {
    #toastContainer {
        right: 10px;
        left: 10px;
    }
    .toast {
        min-width: auto;
        max-width: 100%;
    }
}
