/* 结算单生成系统样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "SimHei", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #1f5582;
    font-size: 28px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.form-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.form-section h2 {
    font-size: 20px;
    color: #1f5582;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
}

.form-group label {
    display: block;
    width: 150px;
    font-weight: bold;
    margin-right: 10px;
    line-height: 36px;
}

.form-group input,
.form-group select,
.form-group textarea {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.device-entries {
    margin-bottom: 20px;
}

.device-entry {
    background-color: #f9f9f9;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border-left: 4px solid #1f5582;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    background-color: #f0f0f0;
    color: #333;
    transition: all 0.3s;
    margin-right: 10px;
}

.btn:hover {
    background-color: #e0e0e0;
}

.btn.primary {
    background-color: #1f5582;
    color: white;
}

.btn.primary:hover {
    background-color: #164263;
}

.btn-group {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
}

/* 预览样式 */
.preview-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.settlement-preview {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 210mm;  /* A4纸宽度 */
    min-height: 297mm; /* A4纸高度 */
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* 结算单模板样式 */
.settlement-document {
    width: 100%;
    position: relative;
    padding: 20px 30px;
    font-family: "SimSun", serif;
}

.settlement-header {
    text-align: center;
    margin-bottom: 20px;
}

.settlement-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.settlement-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
}

.settlement-info-left, .settlement-info-right {
    width: 48%;
}

.settlement-info-right {
    text-align: left;
}

.settlement-info-item {
    margin-bottom: 8px;
    line-height: 1.8;
}

.settlement-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    table-layout: fixed;
    border: 1px solid #000;
}

.settlement-table th, .settlement-table td {
    border-top: 1px solid #000;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;
    border-left: 1px solid #000;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    word-break: break-all;
    box-sizing: border-box;
}

/* 添加表头宽度设置 */
.settlement-table th:nth-child(1) { width: 20px; } /* 序号 - 缩小到20px */
.settlement-table th:nth-child(2) { width: 70px; } /* 型号 - 进一步缩小到70px */
.settlement-table th:nth-child(3) { width: 100px; } /* 设备编号 - 从110px减少到100px */
.settlement-table th:nth-child(4) { width: 110px; } /* 租金单价 - 从100px增加到110px */
.settlement-table th:nth-child(5) { width: 100px; } /* 租金开始日期 */
.settlement-table th:nth-child(6) { width: 100px; } /* 租金结束日期 */
.settlement-table th:nth-child(7) { width: 50px; text-align: center !important; } /* 租金天数 */
.settlement-table th:nth-child(8) { width: 60px; } /* 租金区间设备状态 */
.settlement-table th:nth-child(9) { width: 80px; } /* 应付租金 */
.settlement-table th:nth-child(10) { width: 150px; } /* 月租金回算 - 增加到150px */
.settlement-table th:nth-child(11) { width: 150px; } /* 应付运输费 - 增加到150px */

/* 给租金天数列的所有单元格添加居中对齐 */
.settlement-table td:nth-child(7) { text-align: center !important; }

/* 设备状态变更时间列宽度 */
.detail-table th:nth-child(1) { width: 20px; } /* 序号 - 缩小到20px */
.detail-table th:nth-child(2) { width: 70px; } /* 型号 - 进一步缩小到70px */
.detail-table th:nth-child(3) { width: 80px; } /* 设备编号 - 从90px减少到80px */
.detail-table th:nth-child(4) { width: 80px; } /* 租金区间设备状态 */
.detail-table th:nth-child(5) { width: 130px; } /* 设备状态变更时间 - 从120px增加到130px */
.detail-table th:nth-child(6) { width: 80px; } /* 状态变更类型 */
.detail-table th:nth-child(7) { width: 230px; } /* 产生租金日期 - 表头字体恢复正常 */
.detail-table th:nth-child(8) { width: 60px; } /* 租金天数 */

/* 产生租金日期列数据的字体增大 */


.settlement-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    text-align: center; /* 确保所有表头居中 */
}

.settlement-table.detail-table th {
    font-size: 12px;
    padding: 6px 4px;
}

.settlement-table.detail-table td {
    font-size: 12px;
    padding: 6px 4px;
}

.settlement-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 14px;
}

.settlement-number {
    margin-bottom: 0px;
    margin-top: 15px;
    font-size: 14px;
    font-weight: normal;
    color: #cc0000;
}

/* 移除公章相关样式 */
.company-seal, .qr-code {
    display: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    /* 让每个表单组占整行 */
    .form-group {
        display: block !important;
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 20px !important;
    }
    
    .device-entry {
        grid-template-columns: 1fr;
        padding: 15px !important;
    }
    
    .device-entry .form-group {
        margin-bottom: 18px !important;
    }
    
    .form-group {
        flex-direction: column;
    }
    
    .form-group label {
        width: 100%;
        margin-bottom: 8px;
        line-height: 1.4;
        font-size: 14px;
        font-weight: 600;
        color: #333;
    }
    
    /* 移动端按钮组优化 */
    .btn-group {
        flex-direction: column;
        align-items: stretch;
        margin-top: 20px;
    }
    
    .btn {
        margin: 8px 0;
        padding: 16px 20px;
        font-size: 16px;
        width: 100%;
        display: block;
        border-radius: 6px;
        box-sizing: border-box;
    }
    
    /* 移动端输入框优化 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-width: 100%;
        font-size: 16px; /* 防止iOS缩放 */
        padding: 14px 16px;
        width: 100% !important;
        box-sizing: border-box;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        border-radius: 6px;
        border: 1px solid #ddd;
        margin: 0;
    }
    
    /* 改善输入框外观 */
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #1f5582;
        box-shadow: 0 0 0 3px rgba(31, 85, 130, 0.1);
    }
    
    /* 移动端容器优化 */
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    .form-container {
        padding: 15px;
        margin: 0;
        border-radius: 0;
    }
    
    .form-section {
        padding: 20px 15px;
        margin-bottom: 20px;
        border-radius: 8px;
    }
    
    /* 移动端标题优化 */
    header h1 {
        font-size: 20px;
        padding-bottom: 15px;
    }
    
    .form-section h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .form-section h3 {
        font-size: 16px;
        margin-top: 25px;
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    
    /* 开关容器优化 */
    .switch-container {
        margin-bottom: 20px;
        padding: 15px 0;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .switch-text {
        font-size: 14px;
        line-height: 1.4;
        margin-left: 12px;
    }
    
    /* 二维码预览容器优化 */
    .form-group div[style*="border: 1px dashed"] {
        margin-top: 10px;
        width: 100px !important;
        height: 100px !important;
    }
    
    /* 文件上传按钮优化 */
    input[type="file"] {
        font-size: 14px !important;
        padding: 12px !important;
        border: 1px solid #ddd;
        border-radius: 6px;
    }
    
    /* 设备条目内边距优化 */
    .device-entry {
        margin-bottom: 25px;
        border-left-width: 4px;
        background-color: #f8f9fa;
    }
    
    /* 按钮间距优化 - 确保完美对齐 */
    #addDeviceBtn {
        margin-top: 15px;
        width: 100%;
        padding: 16px 20px;
        font-size: 16px;
        border-radius: 6px;
        background-color: #1f5582;
        color: white;
        border: none;
    }
    
    #previewBtn,
    #generatePdfBtn {
        width: 100%;
        margin-bottom: 12px;
        padding: 16px 20px;
        font-size: 16px;
        border-radius: 6px;
        border: none;
    }
    
    #previewBtn {
        background-color: #28a745;
        color: white;
    }
    
    #generatePdfBtn {
        background-color: #007bff;
        color: white;
        margin-bottom: 0;
    }
    
    /* 计算按钮优化 */
    .calculate-btn {
        width: 100% !important;
        margin-top: 10px !important;
        margin-left: 0 !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        background-color: #17a2b8 !important;
        color: white !important;
        border: none !important;
        border-radius: 6px !important;
    }
    
    /* 生成新编号按钮优化 */
    .form-group button[style*="margin-left"] {
        margin-left: 0 !important;
        margin-top: 10px !important;
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        border-radius: 6px !important;
    }
    
    /* 移除设备按钮优化 */
    .remove-device {
        width: 100% !important;
        margin-top: 15px !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        background-color: #dc3545 !important;
        color: white !important;
        border: none !important;
        border-radius: 6px !important;
    }
}

/* 打印样式 */
@media print {
    body {
        margin: 0;
        padding: 0;
    }
    
    .settlement-document {
        page-break-after: always;
        margin: 0;
        padding: 20px;
    }
    
    .settlement-header {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .settlement-title {
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 10px;
    }
    
    .settlement-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
    }
    
    .settlement-info-left,
    .settlement-info-right {
        width: 48%;
    }
    
    .settlement-info-item {
        margin-bottom: 8px;
    }
    
    .settlement-number {
        margin-bottom: 15px;
    }
    
    .settlement-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
    }
    
    .settlement-table th,
    .settlement-table td {
        border: 1px solid #000;
        padding: 6px;
        text-align: center;
        font-size: 12px;
    }
    
    .settlement-table th {
        background-color: #f0f0f0;
    }
    
    .settlement-footer {
        margin-top: 20px;
        display: flex;
        justify-content: space-between;
    }
    
    /* 隐藏不需要打印的元素 */
    .btn,
    .preview-container,
    .form-section {
        display: none !important;
    }
}

/* 明细表格样式 */
.detail-table th,
.detail-table td {
    font-size: 12px;
    padding: 4px;
}

.detail-table th {
    background-color: #f5f5f5;
    font-weight: normal;
}

/* 强制租金天数列完全居中 - 最高优先级 */
.settlement-table th:nth-child(7),
.settlement-table td:nth-child(7) {
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    word-break: normal !important;
    width: 50px !important;
    vertical-align: middle !important;
}

/* 移除第7列的word-break影响 */
.settlement-table th:nth-child(7) {
    word-break: normal !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

/* 终极强制样式 - 确保PDF生成时也生效 */
table.settlement-table th:nth-child(7),
table.settlement-table td:nth-child(7),
.settlement-table th:nth-child(7),
.settlement-table td:nth-child(7) {
    text-align: center !important;
    padding-left: 0px !important;
    padding-right: 0px !important;
}

/* 强制所有表格边框为黑色细线 - 最高优先级 */
.settlement-table,
table.settlement-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1px solid #000 !important;
    box-sizing: border-box !important;
}

.settlement-table th,
.settlement-table td,
table.settlement-table th,
table.settlement-table td {
    border-top: 1px solid #000 !important;
    border-right: 1px solid #000 !important;
    border-bottom: 1px solid #000 !important;
    border-left: 1px solid #000 !important;
    border-color: #000 !important;
    border-width: 1px !important;
    border-style: solid !important;
    box-sizing: border-box !important;
}

/* 移动端预览优化 - 重新设计 */
@media (max-width: 768px) {
    /* 预览容器：保持原有结构 */
    .preview-container {
        padding: 10px;
    }
    
    /* 预览内容：保持原有定位，稍作调整 */
    .preview-content {
        max-width: 95vw;
        max-height: 95vh;
        overflow: auto;
        padding: 10px;
    }
    
    /* 结算单预览：简单缩放，保持原有比例 */
    .settlement-preview {
        width: 100%;
        min-height: auto;
        padding: 15px;
        margin: 0 auto;
        transform: scale(0.8);
        transform-origin: top center;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
    
    /* 关闭按钮：恢复到预览内容底部 */
    .preview-content .btn {
        display: block;
        width: 120px;
        margin: 20px auto 0 auto;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 6px;
        background-color: #dc3545;
        color: white;
        border: none;
        position: static;
        box-shadow: none;
        z-index: auto;
    }
}

/* 超小屏幕（480px以下）进一步调整缩放 */
@media (max-width: 480px) {
    .settlement-preview {
        transform: scale(0.6);
        padding: 10px;
    }
    
    .preview-content {
        padding: 5px;
    }
    
    .preview-content .btn {
        width: 100px;
        padding: 10px 16px;
        font-size: 14px;
        margin: 15px auto 0 auto;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 16px !important;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px; /* 保持16px防止iOS缩放 */
        padding: 10px 14px;
    }
    
    .container {
        padding: 8px;
    }
    
    .form-section {
        padding: 12px 8px;
        margin-bottom: 16px;
    }
    
    .header h1 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .form-section h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .form-section h3 {
        font-size: 14px;
        margin-top: 20px;
        margin-bottom: 12px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    /* 开关组件优化 */
    .switch {
        width: 44px;
        height: 22px;
    }
    
    .slider:before {
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 4px;
    }
    
    input:checked + .slider:before {
        transform: translateX(22px);
    }
    
    .switch-text {
        font-size: 13px;
    }
    
    /* 设备条目优化 */
    .device-entry {
        padding: 8px !important;
        margin-bottom: 16px;
    }
    
    /* 二维码预览容器 */
    .form-group div[style*="border: 1px dashed"] {
        width: 80px !important;
        height: 80px !important;
    }
}

/* 二维码预览容器 */
.form-group div[style*="border: 1px dashed"] {
    width: 80px !important;
    height: 80px !important;
} 