/* ============================================
   软著程序鉴别材料生成工具 - 样式表
   ============================================ */

/* --- CSS 变量 & 全局重置 --- */
:root {
    --blue: #1B5E8A;
    --blue-light: #2A7DB5;
    --blue-dark: #134666;
    --blue-bg: #E8F2F8;
    --beige: #F8E5B3;
    --beige-light: #FCF3DD;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --red: #EF4444;
    --red-light: #FEE2E2;
    --green: #10B981;
    --green-light: #D1FAE5;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--blue-bg) 0%, var(--beige-light) 50%, #F0F4F8 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* --- 容器 --- */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

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

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 400;
}

/* --- 上传区域 --- */
.upload-section {
    margin-bottom: 24px;
}

.upload-zone {
    background: #FFFFFF;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.upload-zone:hover {
    border-color: var(--blue);
    background: #FAFCFE;
}

.upload-zone.drag-over {
    border-color: var(--blue);
    background: var(--blue-bg);
    border-style: solid;
    box-shadow: var(--shadow-md);
}

.upload-zone.drag-over .upload-icon svg path,
.upload-zone.drag-over .upload-icon svg circle {
    stroke: var(--blue-dark);
}

.upload-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.upload-text {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-link {
    color: var(--blue);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

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

/* --- 进度条 --- */
.progress-container {
    margin-top: 18px;
    background: #FFFFFF;
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

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

.progress-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.progress-percent {
    font-size: 13px;
    color: var(--blue);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    border-radius: 4px;
    width: 0%;
    transition: width 0.15s ease;
}

/* --- 文件列表 --- */
.file-list-section {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.file-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 12px;
}

.file-list-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
    color: #FFF;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    padding: 0 8px;
}

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

.file-list {
    list-style: none;
    max-height: 420px;
    overflow-y: auto;
}

.file-list:empty {
    display: none;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
    cursor: default;
}

.file-item:hover {
    background: var(--gray-50);
}

.file-item.dragging {
    opacity: 0.4;
    background: var(--blue-bg);
}

.file-item.drag-over {
    background: var(--beige-light);
    border-top: 2px solid var(--blue);
}

/* 拖拽手柄 */
.drag-handle {
    cursor: grab;
    color: var(--gray-400);
    font-size: 18px;
    line-height: 1;
    user-select: none;
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition);
    flex-shrink: 0;
}

.drag-handle:hover {
    color: var(--gray-600);
}

.drag-handle:active {
    cursor: grabbing;
    color: var(--blue);
}

/* 序号 */
.file-index {
    font-size: 13px;
    color: var(--gray-400);
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* 文件图标 */
.file-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #FFF;
    text-transform: uppercase;
}

.file-icon.php { background: #787CB5; }
.file-icon.html { background: #E44D26; }
.file-icon.css { background: #264DE4; }
.file-icon.js { background: #F7DF1E; color: #333; }
.file-icon.xml { background: #006699; }
.file-icon.json { background: #5B8C5A; }
.file-icon.wxss { background: #07C160; }
.file-icon.wxml { background: #2A6FDB; }

/* 文件信息 */
.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* 删除按钮 */
.file-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.file-remove:hover {
    background: var(--red-light);
    color: var(--red);
}

/* 拖拽提示 */
.drag-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 12px;
    color: var(--gray-400);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

.drag-handle-demo {
    display: inline-flex;
    color: var(--gray-400);
    font-size: 14px;
}

/* --- 按钮通用 --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--blue);
    color: #FFF;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--blue-light);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: #FFF;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger-outline {
    color: var(--red);
    border-color: var(--gray-300);
}

.btn-danger-outline:hover {
    background: var(--red-light);
    border-color: var(--red);
    color: var(--red);
}

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

/* --- 操作按钮区 --- */
.action-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* --- 预览区域 --- */
.preview-section {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 10px;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-info {
    font-size: 12px;
    color: var(--gray-400);
    margin-right: 4px;
}

.preview-content-wrapper {
    max-height: 500px;
    overflow: auto;
}

.preview-content {
    padding: 20px;
    margin: 0;
    font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Menlo", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.7;
    color: var(--gray-800);
    background: #FAFBFC;
    white-space: pre-wrap;
    word-break: break-all;
    border: none;
    tab-size: 4;
}

/* 预览中的文件分隔符 */
.preview-content .file-separator {
    display: block;
    padding: 8px 0;
    margin: 4px 0;
    border-top: 1px dashed var(--gray-300);
    color: var(--blue);
    font-weight: 600;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* --- 页脚 --- */
.footer {
    text-align: center;
    padding: 16px 0;
    font-size: 12px;
    color: var(--gray-400);
}

/* --- Toast --- */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: var(--gray-800);
    color: #FFF;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--green);
}

.toast.error {
    background: var(--red);
}

/* ============================================
   Tab 导航 + PDF 裁页面板样式
   ============================================ */

/* --- Tab 导航 --- */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: #FFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 4px;
}

.tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius-lg) - 4px);
    transition: all var(--transition);
    font-family: inherit;
}

.tab:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.tab.active {
    background: var(--blue);
    color: #FFF;
    box-shadow: var(--shadow-sm);
}

/* --- Tab 面板 --- */
.tab-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- PDF 信息卡片 --- */
.pdf-result {
    margin-bottom: 24px;
}

.pdf-info-card {
    background: #FFF;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
}

.pdf-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.pdf-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #FEE2E2;
    color: #DC2626;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.pdf-filename {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-filesize {
    font-size: 13px;
    color: var(--gray-400);
    flex-shrink: 0;
}

.pdf-info-body {
    display: flex;
    gap: 32px;
    padding: 16px 20px;
}

.pdf-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-stat-label {
    font-size: 12px;
    color: var(--gray-400);
}

.pdf-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

/* --- PDF 页数范围可视化条 --- */
.pdf-range-bar {
    display: flex;
    height: 40px;
    margin: 0 20px 16px;
    border-radius: 6px;
    overflow: hidden;
}

.pdf-range-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #FFF;
    min-width: 60px;
    transition: flex 0.3s ease;
}

.pdf-range-segment span {
    white-space: nowrap;
    overflow: hidden;
}

.pdf-range-keep {
    background: var(--green);
}

.pdf-range-remove {
    background: var(--gray-300);
    color: var(--gray-500);
}

/* --- PDF 操作按钮 --- */
.pdf-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- 响应式扩展 --- */
@media (max-width: 640px) {
    .pdf-info-body {
        flex-direction: column;
        gap: 12px;
    }

    .pdf-range-bar {
        height: 32px;
    }

    .pdf-range-segment {
        font-size: 10px;
    }

    .pdf-range-segment span {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* --- 响应式 --- */
@media (max-width: 640px) {
    .container {
        padding: 20px 12px 36px;
    }

    .title {
        font-size: 22px;
    }

    .upload-zone {
        padding: 32px 16px;
    }

    .file-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-section {
        flex-direction: column;
    }

    .action-section .btn {
        justify-content: center;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .file-item {
        padding: 10px 12px;
    }
}
