/* 莫兰迪色系变量 */
:root {
    --muted-blue: #8E9EAB;
    --muted-green: #94A19C;
    --muted-gray: #B4B8B8;
    --muted-pink: #C4A9A7;
    --muted-brown: #A69B97;
    --bg-color: #F5F6F5;
    --text-primary: #4A4E4D;
    --text-secondary: #6B7172;
    --border-color: #E5E7E6;
    --accent-color: #8E9EAB;
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: white;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
}

/* 区域样式 */
.area-section {
    margin-bottom: 2rem;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
}

.area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

/* 预览模式样式 */
body.preview-mode {
    background-color: white;
}

body.preview-mode .container {
    max-width: 1000px;
    padding: 1rem;
    box-shadow: none;
}

body.preview-mode .area-section {
    border: none;
    margin-bottom: 2rem;
}

body.preview-mode .area-header {
    background-color: transparent;
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

body.preview-mode .table-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

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

    .container {
        max-width: 1000px;
        margin: 0 auto;
        padding: 1rem;
        box-shadow: none;
    }

    .mode-switch,
    .edit-only,
    .header-top {
        display: none !important;
    }

    .area-section {
        border: none;
        margin-bottom: 2rem;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .area-header {
        background-color: transparent;
        border-bottom: 1px solid #eee;
        padding: 1rem 0;
    }

    .table-header {
        background-color: #f8f9fa !important;
        border-bottom: 1px solid #eee;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* 表格列宽与预览模式保持一致 */
    .table-header,
    .table-row {
        grid-template-columns: 2.5fr 1fr 1.2fr 3fr 3fr 1fr;
        font-size: 1rem;
    }

    .table-header .col,
    .table-row .col {
        padding: 0.5rem;
    }

    /* 数量和单价列保持居中对齐 */
    .table-header .col:nth-child(2),
    .table-header .col:nth-child(3),
    .table-row .col:nth-child(2),
    .table-row .col:nth-child(3) {
        justify-content: center;
    }

    /* 合计部分样式 */
    .summary {
        break-inside: avoid;
        page-break-inside: avoid;
        border-top: 2px solid #4a90e2;
        background: none;
        margin-top: 2rem;
        padding: 2rem 0;
    }

    .summary-item {
        margin-bottom: 0.5rem;
        font-size: 1rem;
    }

    .summary-item.total {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid #eee;
    }

    /* 页脚样式 */
    .footer-content {
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid #eee;
    }

    .company-seal {
        width: 120px;
        height: 120px;
        border: none;
        color: transparent;
        background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="none" stroke="%23f00" stroke-width="2"/></svg>');
        background-size: contain;
        opacity: 0.1;
    }

    /* 页面设置 */
    @page {
        size: A4;
        margin: 2cm;
    }
}

/* 区域装饰 */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.1;
}

body::before {
    background: var(--muted-pink);
    top: -100px;
    right: -100px;
    filter: blur(80px);
}

body::after {
    background: var(--muted-blue);
    bottom: -100px;
    left: -100px;
    filter: blur(80px);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--muted-blue),
        var(--muted-pink),
        var(--muted-green)
    );
}

/* 区域装饰 */
.area-section {
    position: relative;
    background: white;
}

.area-section::before {
    display: none;
}

/* 表格装饰 */
.table-header {
    position: relative;
    overflow: hidden;
}

.table-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #eee;
}

/* 预览模式背景样式 */
body.preview-mode {
    background-color: white;
}

body.preview-mode .container {
    box-shadow: none;
}

body.preview-mode .area-section::before {
    opacity: 0.15;
}

/* 打印样式 */
@media print {
    body::before,
    body::after,
    .container::before,
    .area-section::before {
        display: none;
    }

    .container {
        box-shadow: none;
    }
}

/* 头部样式 */
header {
    margin-bottom: 2rem;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.project-info {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.project-info input {
    width: 100%;
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

.project-info h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.project-info span {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

h1 {
    font-size: 2rem;
    color: #1a1a1a;
    margin: 0 0 1rem 0;
    font-weight: 600;
    text-align: center;
}

.header-decoration {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #4a90e2, #50e3c2);
    margin: 0 auto;
}

/* 控制按钮样式 */
.controls {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    background: #f8f9fa;
    border-color: #4a90e2;
    color: #4a90e2;
}

.btn-primary {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.btn-primary:hover {
    background: #357abd;
    color: white;
}

.btn-delete {
    padding: 0.3rem 0.8rem;
    border: 1px solid #ff4d4f;
    background: white;
    color: #ff4d4f;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #ff4d4f;
    color: white;
}

/* 区域样式 */
.area-section {
    margin-bottom: 2rem;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.area-section.dragging {
    opacity: 0.5;
    cursor: move;
}

.area-section.drag-over {
    border: 2px dashed #4a90e2;
}

.area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.drag-handle {
    cursor: move;
    padding: 0.5rem;
    margin-right: 1rem;
    color: #999;
    display: flex;
    align-items: center;
}

.drag-handle:hover {
    color: #666;
}

.area-header h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.3rem;
    color: #2c3e50;
    flex-grow: 1;
}

.area-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* 表格样式 */
.quote-table {
    width: 100%;
}

.table-header {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.2fr 3fr 3fr 1fr;
    background-color: #f8f9fa;
    padding: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.table-header .col {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-row {
    display: grid;
    grid-template-columns: 2.5fr 1fr 1.2fr 3fr 3fr 1fr;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s;
}

.table-row:hover {
    background-color: #f8f9fa;
}

.col {
    padding: 0.5rem;
}

/* 调整内容单元格的对齐方式 */
.table-row .col {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* 数量和单价列保持居中对齐 */
.table-header .col:nth-child(2),
.table-header .col:nth-child(3),
.table-row .col:nth-child(2),
.table-row .col:nth-child(3) {
    justify-content: center;
}

/* 输入框样式 */
.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-input:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* 合计部分样式 */
.summary {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.summary-item {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.summary-item span:first-child {
    margin-right: 2rem;
}

.summary-item.total {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 2px solid #eee;
    font-weight: 600;
    font-size: 1.3rem;
    color: #e74c3c;
}

/* 页脚样式 */
footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.signature {
    line-height: 1.8;
}

.signature-input {
    padding: 0.3rem;
    border: none;
    border-bottom: 1px solid #ddd;
    margin-left: 0.5rem;
    font-size: 1rem;
}

.signature-input:focus {
    outline: none;
    border-bottom-color: #4a90e2;
}

.company-seal {
    width: 120px;
    height: 120px;
    border: 2px dashed #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

/* 预览模式切换按钮 */
.mode-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

/* 预览模式样式 */
body.preview-mode .edit-only {
    display: none !important;
}

body:not(.preview-mode) .preview-mode {
    display: none !important;
}

body.preview-mode .preview-text {
    display: block;
    padding: 0.5rem;
}

body:not(.preview-mode) .preview-text {
    display: none;
}

body.preview-mode .form-input {
    display: none;
}

body.preview-mode .container > header {
    margin-top: 2rem;
}

body.preview-mode .header-top {
    display: none;
}

body.preview-mode .summary {
    border-top: 2px solid #4a90e2;
    background-color: transparent;
    padding: 2rem 0;
}

body.preview-mode .company-seal {
    border: none;
    color: transparent;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="none" stroke="%23f00" stroke-width="2"/></svg>');
    background-size: contain;
    opacity: 0.1;
}

/* 区域标题样式 */
.area-title {
    flex-grow: 1;
    position: relative;
    margin-right: 1rem;
}

.area-name {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 1.3rem;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s;
}

.area-name:hover {
    color: #4a90e2;
}

.area-name-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    font-size: 1.3rem;
    border: 2px solid #4a90e2;
    border-radius: 4px;
    background: white;
    z-index: 1;
}

.area-name-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* 客户信息样式 */
.customer-info {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid #eee;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row label,
.info-row span:first-child {
    width: 100px;
    color: #666;
    font-weight: 500;
}

.info-row input {
    flex: 1;
    max-width: 400px;
}

.info-row span:last-child {
    flex: 1;
    color: #333;
    font-weight: 500;
}

/* 标题样式 */
.title-container {
    text-align: center;
    margin: 1rem 0;
}

.title-container h1 {
    font-size: 2rem;
    color: #1a1a1a;
    margin: 0 0 1rem 0;
    font-weight: 600;
    display: inline-block;
}

.project-title {
    display: inline-block;
}

.project-title input {
    width: 300px;
    font-size: 2rem;
    font-weight: 600;
    color: #1a1a1a;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0 0.5rem;
    transition: all 0.3s;
    text-align: left;
}

.project-title input:focus {
    outline: none;
    border-bottom-color: #4a90e2;
}

.project-title input::placeholder {
    color: #ccc;
}

.project-title span {
    font-size: 2rem;
    color: #1a1a1a;
    font-weight: 600;
}

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

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

    .container > header {
        margin-top: 0;
        margin-bottom: 1.5rem;
    }

    .mode-switch,
    .edit-only,
    .header-top {
        display: none !important;
    }

    .area-section {
        break-inside: avoid;
        page-break-inside: avoid;
        border: none;
        margin-bottom: 1.5rem;
    }

    .table-header {
        background-color: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .summary {
        break-inside: avoid;
        page-break-inside: avoid;
        border-top: 1px solid #eee;
        background: none;
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .footer-content {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #eee;
    }

    .company-seal {
        width: 100px;
        height: 100px;
    }

    /* 纵向A4纸张设置 */
    @page {
        size: A4;
        margin: 2cm;
    }

    /* 调整表格列宽以适应纵向布局 */
    .table-header,
    .table-row {
        grid-template-columns: 2.5fr 1fr 1.2fr 3fr 3fr;
    }

    /* 调整字体大小 */
    .table-header,
    .table-row {
        font-size: 1rem;
    }

    .summary-item {
        font-size: 1rem;
    }

    /* 优化间距 */
    .col {
        padding: 0.5rem;
    }

    .summary-item {
        margin-bottom: 0.5rem;
    }

    .summary-item.total {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    /* 调整区域间距 */
    .area-section {
        margin-bottom: 2rem;
    }

    /* 调整页眉页脚间距 */
    .container > header {
        margin-bottom: 2rem;
    }

    .footer-content {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
} 