/* ===================================
   工具页通用样式
   适用于所有工具页（tool01-tool11）
   =================================== */

/* ===================================
   主内容区域
   =================================== */
.app-main {
    flex: 1;
    padding: 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tool-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tool-header {
    text-align: center;
    margin-bottom: 8px;
}

.tool-title {
    font-size: 32px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
}

.tool-subtitle {
    font-size: 16px;
    color: #6B7280;
}

/* ===================================
   卡片样式
   =================================== */
.card {
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 32px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-secondary {
    background-color: #F8F9FA;
    border: 1px solid #E5E7EB;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 16px;
}

/* ===================================
   区块样式
   =================================== */
.section {
    margin-bottom: 24px;
}

.section:last-child {
    margin-bottom: 0;
}

.section-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 12px;
}

/* ===================================
   文件上传区域
   =================================== */
.file-upload {
    border: 2px dashed #E5E7EB;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    background-color: #F8F9FA;
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #1E3A8A;
    background-color: #F0F4FF;
}

.file-upload.file-upload-has-file {
    border-color: #16A34A;
    background-color: #ECFDF5;
}

.file-upload.file-upload-has-file .file-title {
    color: #15803D;
}

.file-upload.file-upload-has-file .file-icon {
    color: #16A34A;
}

.file-upload.drag-over {
    border-color: #1E3A8A;
    background-color: #EFF6FF;
    border-style: solid;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.file-icon {
    font-size: 48px;
    line-height: 1;
}

.file-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-title {
    font-size: 16px;
    font-weight: 500;
    color: #1F2937;
}

.file-hint {
    font-size: 14px;
    color: #6B7280;
}

/* ===================================
   文件列表
   =================================== */
.file-list {
    margin-top: 16px;
    padding: 16px;
    background-color: #F8F9FA;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.file-count {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}

.file-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #FFFFFF;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
}

.file-item-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.file-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.file-item-name {
    font-size: 14px;
    color: #1F2937;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    line-height: 1.4;
}

.file-item-size {
    font-size: 12px;
    color: #6B7280;
    margin-left: 8px;
}

.file-item-remove {
    background: none;
    border: none;
    color: #EF4444;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: color 0.2s;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: -2px;
}

.file-item-remove:hover {
    color: #DC2626;
}

/* ===================================
   预览表（通用样式：固定表头 + 条纹行）
   适用场景：拆分结果预览、规则预览等
   使用方式：
   <div class="preview-table-container">
     <table class="preview-table">...
   =================================== */
.preview-table-container {
    max-height: 320px;
    overflow: auto;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table thead th {
    position: sticky;
    top: 0;
    background: #F9FAFB;
    z-index: 1;
}

.preview-table th,
.preview-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
}

.preview-table tbody tr:nth-child(odd) {
    background-color: #FFFFFF;
}

.preview-table tbody tr:nth-child(even) {
    background-color: #F9FAFB;
}

/* ===================================
   数据预览区域（通用样式，与 tool03 等共享）
   =================================== */
.data-preview {
    margin-top: 15px;
}

.data-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.data-preview-hint {
    font-size: 12px;
    color: #6B7280;
}

.data-preview-table-wrapper {
    max-height: 220px;
    overflow: auto;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
}

.data-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

/* Excel 数据预览表头：锁定在顶部，配色与预览表保持一致 */
.data-preview-table thead th {
    position: sticky;
    top: 0;
    background: #F9FAFB;
    z-index: 1;
}

.data-preview-table th,
.data-preview-table td {
    padding: 6px 8px;
    border: 1px solid #E5E7EB;
    text-align: left;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-preview-table tbody tr:nth-child(even) {
    background-color: #F8F9FA;
}

.data-preview-table tbody tr.header-row-highlight {
    background-color: #DBEAFE;
    font-weight: bold;
}

/* ===================================
   选项组
   =================================== */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: #F8F9FA;
}

.checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #1E3A8A;
}

.checkbox-text {
    font-size: 14px;
    color: #1F2937;
}

/* 三列排布的选项组（例如分隔符选择），在大屏幕下一行显示多项，节省纵向空间 */
.options-group-three-cols {
    flex-direction: row;
    flex-wrap: wrap;
}

.options-group-three-cols .checkbox-label {
    width: 33.333%;
    box-sizing: border-box;
}

/* 五列排布的选项组，一行显示5个选项 */
.options-group-five-cols {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.options-group-five-cols .checkbox-label {
    width: calc(20% - 7px);
    box-sizing: border-box;
    padding: 8px;
    gap: 8px;
}

/* ===================================
   输入框
   =================================== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.input-label {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}

.input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: #1F2937;
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

select.input {
    height: 42px;
    line-height: 1.5;
}

.input:hover {
    border-color: #9CA3AF;
}

.input:focus {
    border-color: #1E3A8A;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* 复选框列表（用于替代多选下拉框） */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.checkbox-list .checkbox-label {
    padding: 10px 12px;
    margin: 0;
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    transition: all 0.2s;
}

.checkbox-list .checkbox-label:hover {
    background-color: #F3F4F6;
    border-color: #D1D5DB;
}

.checkbox-list .checkbox:checked + .checkbox-text {
    color: #1E3A8A;
    font-weight: 500;
}

.checkbox-list .checkbox-label:has(.checkbox:checked) {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-color: #3B82F6;
}

/* 选择按钮组（全选、取消全选、反选） */
.selection-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.selection-btn {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 400;
    color: #1E3A8A;
    background-color: #FFFFFF;
    border: 1.5px solid #1E3A8A;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.selection-btn:hover {
    background-color: #EFF6FF;
    border-color: #1E40AF;
    color: #1E40AF;
}

.selection-btn:active {
    background-color: #DBEAFE;
    transform: scale(0.98);
}

.input-hint {
    font-size: 12px;
    color: #6B7280;
}

.input-error {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ===================================
   按钮样式
   =================================== */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background-color: #1E3A8A;
    color: #FFFFFF;
    min-width: 140px;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1E40AF;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
}

.btn-primary:active:not(:disabled) {
    background-color: #1E3A8A;
    transform: translateY(1px);
}

.btn-primary:disabled {
    background-color: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background-color: #FFFFFF;
    color: #1E3A8A;
    border: 1px solid #1E3A8A;
    min-width: 140px;
}

.btn-secondary:hover {
    background-color: #F8F9FA;
    border-color: #1E40AF;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #1E3A8A;
    color: #1E3A8A;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover:not(:disabled) {
    background-color: #F0F4FF;
    border-color: #1E40AF;
    color: #1E40AF;
}

.btn-outline:disabled {
    border-color: #CBD5F5;
    color: #9CA3AF;
    cursor: not-allowed;
    background-color: #F9FAFB;
}

.btn-text {
    background-color: transparent;
    color: #1E3A8A;
    padding: 8px 16px;
    min-width: auto;
}

.btn.btn-primary .btn-text {
    color: #FFFFFF;
}

.btn.btn-primary:disabled .btn-text {
    color: rgba(255, 255, 255, 0.85);
}

.btn.btn-primary .btn-text:hover {
    color: #FFFFFF;
    background-color: transparent;
}

.btn-text:hover {
    background-color: #F8F9FA;
    color: #1E40AF;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
}

/* ===================================
   进度条
   =================================== */
.progress-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #E5E7EB;
}

.progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-label {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}

.progress-percent {
    font-size: 14px;
    font-weight: 600;
    color: #1E3A8A;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1E3A8A 0%, #3B82F6 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #6B7280;
}

/* ===================================
   提示信息
   =================================== */
.alert-section {
    margin-top: 24px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #ECFDF5;
    border-color: #10B981;
    color: #065F46;
}

.alert-error {
    background-color: #FEF2F2;
    border-color: #EF4444;
    color: #991B1B;
}

.alert-warning {
    background-color: #FFFBEB;
    border-color: #F59E0B;
    color: #92400E;
}

.alert-info {
    background-color: #EFF6FF;
    border-color: #3B82F6;
    color: #1E40AF;
}

.alert-icon {
    font-size: 20px;
    font-weight: bold;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-message {
    font-size: 14px;
    line-height: 1.5;
}

/* ===================================
   弹窗
   =================================== */
body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    background: #FFFFFF;
    border-radius: 16px;
    width: min(960px, 92%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    overflow: hidden;
    z-index: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1F2937;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #6B7280;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #1E3A8A;
}

.modal-body {
    padding: 0 24px 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid #E5E7EB;
    background-color: #FFFFFF;
}

/* ===================================
   试用提示 Banner（通用）
   =================================== */
.activation-notice,
.trial-notice {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
}

.activation-notice {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 1px solid #F59E0B;
}

.trial-notice {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border: 1px solid #3B82F6;
}

.activation-notice-content,
.trial-notice-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 16px;
}

.activation-notice-content span,
.trial-notice-content span {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    flex: 1;
}

/* ===================================
   帮助列表 / 使用步骤
   =================================== */

/* 无序列表（项目符号） */
.help-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
    margin: 0;
}

.help-list li {
    font-size: 14px;
    color: #6B7280;
    padding-left: 24px;
    position: relative;
    line-height: 1.6;
}

.help-list li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #1E3A8A;
    font-weight: bold;
    font-size: 14px;
}

/* 有序列表（数字序号）- 用于"使用步骤" */
ol.help-list {
    list-style: decimal;
    padding-left: 24px;
    counter-reset: item;
}

ol.help-list li {
    padding-left: 8px;
    list-style-position: outside;
}

ol.help-list li::before {
    content: none;
}

/* ===================================
   加载动画
   =================================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

/* ===================================
   响应式设计
   =================================== */

/* 平板适配 */
@media (max-width: 1024px) {
    .app-main {
        max-width: 100%;
        padding: 28px 20px;
    }

    .card {
        padding: 28px 20px;
    }

    .modal-dialog {
        width: min(900px, 90%);
    }
}

/* 小平板适配 */
@media (max-width: 768px) {
    .app-main {
        padding: 24px 16px;
    }

    .card {
        padding: 24px 16px;
    }

    .tool-title {
        font-size: 24px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .modal-dialog {
        width: 94%;
    }

    .file-upload {
        padding: 40px 20px;
    }

    /* 试用 Banner 响应式 */
    .activation-notice-content,
    .trial-notice-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .activation-notice-content span,
    .trial-notice-content span {
        text-align: center;
    }
    
    .btn-sm {
        width: 100%;
    }
}

/* 手机适配 */
@media (max-width: 480px) {
    .app-main {
        padding: 20px 12px;
    }

    .card {
        padding: 20px 12px;
        border-radius: 8px;
    }

    .tool-title {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .tool-subtitle {
        font-size: 14px;
    }

    .section {
        margin-bottom: 20px;
    }

    .section-label {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .file-upload {
        padding: 32px 16px;
    }

    .file-icon {
        font-size: 40px;
    }

    .file-title {
        font-size: 14px;
    }

    .file-hint {
        font-size: 12px;
    }

    .file-list {
        padding: 12px;
    }

    .file-item {
        padding: 10px 12px;
    }

    .file-item-name {
        font-size: 13px;
    }

    .checkbox-label {
        padding: 10px;
    }

    .checkbox-text {
        font-size: 13px;
    }

    .input {
        padding: 10px 14px;
        font-size: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 15px;
    }

    .modal-dialog {
        width: 96%;
        border-radius: 12px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-close {
        font-size: 20px;
    }
}
