/* 通用左右布局样式 - 适用于所有字帖页面 */

.content-area {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    background-color: transparent;
}

.copybook-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.copybook-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 200px);
}

/* 左侧控制面板 */
.control-panel {
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 24px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: calc(100vh - 100px);
}

.panel-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.panel-header h1 {
    font-size: 24px;
    color: #272a2d;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.panel-header .subtitle {
    font-size: 13px;
    color: #6c757d;
    margin: 0;
}

/* 右侧预览区域 */
.preview-panel {
    flex: 1;
    background: #f5f5f5;
    padding: 24px;
    overflow-y: auto;
}

.copybook-preview {
    background: white;
    min-height: 500px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* 控制项样式 */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #272a2d;
    margin-bottom: 8px;
}

.control-group textarea,
.control-group input[type="number"],
.control-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.control-group textarea {
    resize: vertical;
    min-height: 80px;
}

.control-group textarea:focus,
.control-group input:focus {
    outline: none;
    border-color: #272a2d;
}

.control-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.control-group select:focus {
    outline: none;
    border-color: #272a2d;
}

.checkbox-group {
    margin-bottom: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #f0f0f0;
}

.primary-btn, .secondary-btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn {
    background: #272a2d;
    color: white;
}

.primary-btn:hover {
    background: #3a3d40;
}

.secondary-btn {
    background: white;
    color: #272a2d;
    border: 1.5px solid #dee2e6;
}

.secondary-btn:hover {
    background: #f8f9fa;
    border-color: #272a2d;
}

/* A4纸张样式 */
.a4-page {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .copybook-layout {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .preview-panel {
        padding: 16px;
    }

    .a4-page {
        width: 100%;
        min-height: auto;
        padding: 10mm;
        transform: scale(0.9);
        transform-origin: top center;
    }
}

/* 打印样式 */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    /* 隐藏所有不需要打印的元素 */
    .site-header,
    .site-footer,
    .breadcrumb,
    .control-panel,
    .button-group,
    nav,
    header,
    footer,
    .logo,
    .menu,
    #top-menu,
    .site-main > nav,
    .char-pinyin {
        display: none !important;
    }

    /* 重置主要容器 */
    html,
    body,
    #primary,
    .content-area,
    .site-main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    .copybook-container {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    .copybook-layout {
        display: block !important;
        min-height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .preview-panel {
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .copybook-preview {
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
        display: block !important;
    }

    .a4-page {
        width: 210mm !important;
        height: 297mm !important;
        padding: 15mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: avoid !important;
        background: white !important;
    }

    /* 确保只显示A4页面内容 */
    body > *:not(#primary) {
        display: none !important;
    }

    /* 移除浏览器默认的页眉页脚 */
    @page {
        margin: 0;
        size: A4;
    }
}
