/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "SimSun", "宋体", serif;
    font-size: 14px;
    line-height: 1.6;
    color: #000;
    background-color: #f5f5f5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* 功能按钮面板 */
.control-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-bottom: 3px solid #5a67d8;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.template-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-warning {
    background: #ed8936;
    color: white;
}

.btn-info {
    background: #38b2ac;
    color: white;
}

#trademarkCategoryBtn {
    background: #17a2b8;
    color: white;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-purple {
    background: #9f7aea;
    color: white;
}

.btn-orange {
    background: #ff8c00;
    color: white;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

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

/* 按钮悬停效果增强 */
.btn-primary:hover {
    background: #3182ce;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-warning:hover {
    background: #dd6b20;
}

.btn-info:hover {
    background: #319795;
}

#trademarkCategoryBtn:hover {
    background: #138496;
}

.btn-success:hover {
    background: #38a169;
}

.btn-purple:hover {
    background: #805ad5;
}

.btn-orange:hover {
    background: #e67e22;
}

.btn-danger:hover {
    background: #c53030;
}

.template-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    min-width: 150px;
    transition: border-color 0.3s ease;
}

.template-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 进度覆盖层 */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.progress-overlay.show {
    opacity: 1;
    visibility: visible;
}

.progress-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 320px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 加载动画 */
.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-text {
    font-size: 16px;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 20px;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4299e1, #48bb78);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-percentage {
    font-size: 14px;
    font-weight: 600;
    color: #4299e1;
}

/* A4纸张容器 */
.form-container {
    max-width: 210mm;
    margin: 120px auto 40px;
    padding: 5mm 20mm 10mm 19mm;
    /* 上边距改为5mm，其他保持不变 */
    background-color: #fff;
    min-height: 297mm;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}

.form-container:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
}

/* 标题样式 */
.form-title {
    text-align: center;
    font-size: 25px;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

/* 表单内容区域 */
.form-content {
    margin-bottom: 20px;
}

/* 表单区块 */
.form-section {
    margin-bottom: 4px;
}

/* 表单行 */
.form-row {
    display: flex;
    /*align-items: center;*/
    margin-bottom: 4px;
    position: relative;
    min-height: 20px;
}

/* 表单行右对齐 */
.form-row.right-align {
    justify-content: flex-end;
}

/* 标签样式 */
.label {
    font-size: 14px;
    white-space: nowrap;
    margin-right: 8px;
    display: inline-block;
    font-weight: normal;
}

.right-label {
    margin-left: 43px;
    margin-right: 8px;
    position: relative;
}

.right-label::after {
    content: "：";
}



/* 对齐样式 - 让冒号位置对齐 */
.form-row.align-colon .label:not(.right-label) {
    display: inline-block;
    width: 180px;
    /* 设置固定宽度确保冒号对齐 */
    position: relative;
    text-align: right;
    padding-right: 16px;
}

.form-row.align-colon .label:not(.right-label)::after {
    content: "：";
    position: absolute;
    right: 0;
    top: 0;
}

/* checkbox-row的对齐样式 */
.checkbox-row.align-colon .label:not(.right-label) {
    display: inline-block;
    width: 180px;
    /* 与上面保持一致的宽度 */
    position: relative;
    text-align: right;
    padding-right: 16px;
}

.checkbox-row.align-colon .label:not(.right-label)::after {
    content: "：";
    position: absolute;
    right: 0;
    top: 0;
}

/* 隐藏对齐区域的下划线 */
.form-row.align-colon .form-input {
    border-bottom: none;
}

.form-row.align-colon .form-input:focus {
    border-bottom: none;
    background: transparent;
    transform: none;
}

.form-row.align-colon .form-input:hover:not(:focus) {
    border-bottom: none;
}

/* 表单输入字段样式 */
.form-input {
    flex: 1;
    border: none;
    border-bottom: 1px solid #000;
    background: transparent;
    padding: 2px 5px;
    font-family: inherit;
    font-size: 14px;
    margin-right: 10px;
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-bottom: 2px solid #4299e1;
    background: rgba(66, 153, 225, 0.05);
    transform: translateY(-1px);
}

.form-input:hover:not(:focus) {
    border-bottom-color: #666;
}

.form-input.short {
    flex: 0 0 100px;
    margin-right: 20px;
}

.form-input.medium {
    flex: 0 0 150px;
    margin-right: -20px;
}

.form-textarea {
    flex: 0.90;
    border: 0px solid #000;
    background: transparent;
    padding: 5px;
    font-family: inherit;
    font-size: 14px;
    margin-right: 10px;
    outline: none;
    resize: vertical;
    min-height: 20px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.form-textarea:focus {
    border-color: #4299e1;
    background: rgba(66, 153, 225, 0.05);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-textarea:hover:not(:focus) {
    border-color: #666;
}

/* 复选框区域 */
.declaration-section {
    margin: 2px 0;
}

.checkbox-row {
    display: flex;
    /*  align-items: center; */
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.checkbox-row.indent {
    padding-left: 120px;
}

/* 网格布局的复选框 */
.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.checkbox-grid-row {
    display: flex;
    align-items: center;
    gap: 30px;
}

.checkbox-grid-row .checkbox-label {
    margin-right: 0;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.checkbox-grid-row .checkbox-label.full-width {
    flex: 1;
}

/* 水平对齐的复选框布局 */
.checkbox-row.horizontal-align {
    flex-wrap: nowrap;
    align-items: center;
    margin-left: 64px;
}

.checkbox-row.horizontal-align .checkbox-label {
    margin-right: 4px;
    margin-bottom: 0;
    white-space: nowrap;
}


/* 确保horizontal-align与align-colon同时使用时，align-colon样式生效 */
.checkbox-row.horizontal-align.align-colon .label:not(.right-label) {
    display: inline-block;
    width: 180px;
    position: relative;
}

.checkbox-row.horizontal-align.align-colon .label:not(.right-label)::after {
    content: "：";
    position: absolute;
    right: 0;
    top: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-right: 25px;
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.3s ease;
}

.checkbox-label:hover {
    color: #4299e1;
}

.checkbox-label.long {
    margin-right: 10px;
}

.checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 5px;
    border: 1px solid #000;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 承诺部分 */
.commitment-section {
    margin: 2px 0;
    border: 0px solid #000;
    padding: 4px 10px 4px 25px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.00);
}

.commitment-text {
    font-size: 13px;
    line-height: 1.5;
    text-align: justify;
}

/* 签名区域 */
.signature-section {
    margin: 10px 0;
}

.signature-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.signature-space {
    flex: 0 0 150px;
    height: 50px;
    margin-right: 20px;
    position: relative;
    border: 0px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

.signature-space:hover {
    border-color: #4299e1;
}

.signature-canvas {
    border: 0px solid #ccc;
    border-radius: 4px;
    cursor: crosshair;
    display: block;
    width: 100%;
    height: 40px;
    transition: border-color 0.3s ease;
}

.signature-canvas:hover {
    border-color: #4299e1;
}

.clear-signature {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
}

.signature-space:hover .clear-signature {
    opacity: 1;
}

.clear-signature:hover {
    background: #c53030;
    transform: scale(1.1);
}

.empty-space {
    flex: 1;
}

/* 弹窗签名样式 */
.signature-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.signature-modal.show {
    display: flex;
}

.signature-modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.signature-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2d3748;
}

.signature-large-canvas {
    border: 2px solid #4299e1;
    border-radius: 8px;
    cursor: crosshair;
    background: white;
    box-shadow: 0 4px 20px rgba(66, 153, 225, 0.2);
}

.signature-modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.signature-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.signature-modal-btn.confirm {
    background: #48bb78;
    color: white;
}

.signature-modal-btn.confirm:hover {
    background: #38a169;
}

.signature-modal-btn.cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.signature-modal-btn.cancel:hover {
    background: #cbd5e0;
}

.signature-modal-btn.clear {
    background: #e53e3e;
    color: white;
}

.signature-modal-btn.clear:hover {
    background: #c53030;
}

.signature-hint {
    font-size: 12px;
    color: #718096;
    margin-top: 10px;
    text-align: center;
}

/* 签名区域提示 */
.signature-tip {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #718096;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.signature-space:hover .signature-tip {
    opacity: 1;
}

/* 注：请按说明填写 样式 */
.note-row {
    /* 强制保持在第一页，避免跨页 */
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    break-inside: avoid !important;
    break-after: avoid !important;
    margin-bottom: 10px;
}

.label.note-text {
    /* 确保只在第一页显示 */
    page-break-inside: avoid;
    page-break-after: avoid;
}

/* 隐藏页码1和页码2 */
.page-number {
    display: none;
}

/* 隐藏打印预览按钮 */
#printBtn {
    display: none;
}

/* 商标图样区域 */
.trademark-box {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.trademark-frame {
    width: 400px;
    height: 400px;
    border: 2px solid #000;
    background-color: #fff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.trademark-frame:hover {
    border-color: #4299e1;
    background-color: rgba(66, 153, 225, 0.05);
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(66, 153, 225, 0.2);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-hint {
    color: #666;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
    transition: color 0.3s ease;
}

.trademark-frame:hover .upload-hint {
    color: #4299e1;
}

.trademark-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* 页码 */
.page-number {
    position: absolute;
    right: 0;
    font-size: 14px;
}

.page-number.bottom {
    position: absolute;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
}

/* 分页 */
.page-break {
    page-break-before: always;
    break-before: page;
    height: 30px;
}

/* 第二页 */
.second-page {
    padding-top: 20px;
    min-height: auto; /* 改为自适应高度，避免强制高度导致空白页 */
    position: relative;
}

/* 商标图样说明 */
.trademark-instruction {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.4;
    text-align: justify;
    /*background: rgba(0, 0, 0, 0.02);*/
    padding: 15px;
    /*border-radius: 8px;*/
    /*border-left: 4px solid #4299e1;*/
}

.trademark-instruction p {
    margin-bottom: 10px;
}

/* 增强状态消息 */
.status-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #48bb78;
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    backdrop-filter: blur(10px);
}

.status-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: messageSlide 0.4s ease;
}

@keyframes messageSlide {
    0% {
        transform: translate(-50%, -50%) scale(0.8) translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1) translateY(0);
        opacity: 1;
    }
}

.status-message.error {
    background: linear-gradient(135deg, #e53e3e, #c53030);
}

.status-message.warning {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.status-message.info {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.status-message.success {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.message-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    font-weight: 500;
}

/* 隐藏模板相关按钮和控件 */
#templateBtn,
.template-controls {
    display: none !important;
}

/* 不打印的元素 */
.no-print {
    /* 这个类将在打印时隐藏 */
}

/* 打印样式 */
@media print {
    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    .control-panel,
    .no-print,
    .progress-overlay,
    .status-message {
        display: none !important;
    }

    .form-container {
        max-width: none;
        margin: 0;
        padding: 15mm 20mm;
        box-shadow: none;
        border-radius: 0;
    }

    .page-break {
        page-break-before: always;
        height: 0;
    }

    .second-page {
        padding-top: 0;
    }

    .form-input,
    .form-textarea {
        border-bottom: 1px solid #000 !important;
        background: transparent !important;
        -webkit-print-color-adjust: exact;
    }

    /* 打印时保持对齐样式但隐藏下划线 */
    .form-row.align-colon .form-input {
        border-bottom: none !important;
    }

    .form-row.align-colon .label:not(.right-label),
    .checkbox-row.align-colon .label:not(.right-label) {
        width: 180px !important;
        display: inline-block !important;
        position: relative !important;
    }

    .form-row.align-colon .label:not(.right-label)::after,
    .checkbox-row.align-colon .label:not(.right-label)::after {
        content: "：" !important;
        position: absolute !important;
        right: 0 !important;
        top: 0 !important;
    }

    /* 确保"注：请按说明填写"只在第一页显示 */
    .label.note-text {
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
        break-inside: avoid !important;
        break-after: avoid !important;
    }



    .trademark-frame {
        border: 2px solid #000 !important;
    }

    .signature-canvas {
        border: 1px solid #000 !important;
    }

    .trademark-category-section {
        display: block !important;
    }

    .category-summary {
        background: white !important;
        border: 1px solid #000 !important;
    }

    .category-content {
        background: white !important;
        border: 1px solid #000 !important;
    }

    .category-group-title {
        background: #f0f0f0 !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }

    .category-item {
        background: white !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }
}

/* 确保复选框样式正确 */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #000;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    margin-right: 6px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

input[type="checkbox"]:checked {
    background-color: #4299e1;
    border-color: #4299e1;
}

input[type="checkbox"]:checked::before {
    content: "✓";
    position: absolute;
    top: -2px;
    left: 1px;
    font-size: 12px;
    color: white;
    font-weight: bold;
}

input[type="checkbox"]:hover {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 商标分类选择结果样式 */
.trademark-category-section {
    margin-top: 0px;
    /* 增加上边距避免重叠 */
}

/* category-page 内部完全独立样式 */
.category-page .simple-trademark-display {
    margin-top: 20px;
}

/* 独立的表单行样式 */
.category-page .category-form-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
    min-height: 20px;
}

/* 独立的对齐样式 */
.category-page .category-form-row.category-align-colon .category-label {
    display: inline-block;
    width: 126px;
    position: relative;
    text-align: right;
    padding-right: 16px;
    font-size: 14px;
    white-space: nowrap;
    font-weight: normal;
}

.category-page .category-form-row.category-align-colon .category-label::after {
    content: "：";
    position: absolute;
    right: 0;
    top: 0;
}

/* 独立的内容样式 */
.category-page .category-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.category-page {
    padding-top: 2px;
    /* 增加顶部内边距 */
    min-height: auto; /* 改为自适应高度，避免强制高度导致空白页 */
    position: relative;
}

/* category-page 内部元素的完全独立样式 */
.category-page * {
    /* 重置继承，确保独立性 */
}

.category-page .form-section {
    margin-bottom: 2px;
}

.category-page .page-number {
    position: absolute;
    right: 0;
    font-size: 14px;
}

.category-page .page-number.bottom {
    position: absolute;
    bottom: 20px;
    right: 50%;
    transform: translateX(50%);
}

.category-title {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.category-summary {
    background: rgba(66, 153, 225, 0.1);
    border: 1px solid #4299e1;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
}

.category-summary .summary-item {
    display: inline-block;
    margin-right: 30px;
    margin-bottom: 5px;
}

.category-summary .summary-item strong {
    color: #2d3748;
}

.category-content {
    border: 0px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px;
}

.category-group {
    margin-bottom: 25px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.category-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.category-group-title {
    font-size: 16px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #4299e1;
    color: white;
    border-radius: 4px;
}

.category-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-item {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    color: #374151;
    display: inline-block;
    margin: 2px;
}

.category-item:nth-child(odd) {
    background: #f8f9fa;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
    .control-panel {
        position: relative;
        padding: 10px;
    }

    .button-group {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
    }

    .template-controls {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }

    .form-container {
        margin: 20px 10px;
        padding: 10mm 15mm;
        max-width: 100%;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-input,
    .form-textarea {
        width: 100%;
        margin: 5px 0;
    }

    .checkbox-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .checkbox-row.indent {
        padding-left: 0;
    }

    .signature-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .signature-space {
        width: 100%;
        margin: 10px 0;
    }

    .trademark-frame {
        width: 150px;
        height: 150px;
    }

    .progress-content {
        margin: 20px;
        padding: 30px 20px;
        min-width: auto;
        width: calc(100% - 40px);
    }

    .status-message {
        margin: 20px;
        min-width: auto;
        width: calc(100% - 40px);
    }

    .category-items {
        gap: 4px;
    }

    .category-item {
        font-size: 12px;
        padding: 4px 8px;
    }

    .category-group-title {
        font-size: 14px;
        padding: 6px 10px;
    }
}

/* 中等屏幕响应式调整 */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .button-group {
        gap: 8px;
    }

    .template-controls {
        margin-left: 10px;
    }

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

    #trademarkCategoryBtn {
        order: -1;
        /* 让商标分类按钮在移动设备上排在最前面 */
    }

    .template-select {
        min-width: 120px;
        font-size: 12px;
    }
}

/* 微调间距以更好地匹配原始表单 */
.form-row:first-child {
    margin-top: 5px;
}

.declaration-section .checkbox-row:first-child {
    margin-top: 4px;
}

/* 商标说明部分的特殊样式 */
.second-page .form-section {
    margin-top: 30px;
}

.second-page .form-row {
    margin-bottom: 12px;
}

/* 加载状态时的按钮样式 */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 表单焦点流畅过渡 */
.form-input,
.form-textarea,
.signature-canvas,
.trademark-frame {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}