body {
    font-family: "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    color: #333;
}

.title-bar {
    background-color: #1a237e;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title-text {
    flex: 1;
    text-align: center;
}

.main-title {
    font-size: 24px;
    font-weight: bold;
}

.slogan {
    font-size: 14px;
    color: #e3f2fd;
    font-weight: normal;
    margin-left: 15px;
    opacity: 0.8;
    vertical-align: middle;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-btn {
    padding: 8px 16px;
    border: 1px solid white;
    border-radius: 4px;
    color: white;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.auth-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-content {
    display: flex;
    gap: 15px;
    padding: 5px 20px 20px 20px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

/* 新增中间栏样式 */
.middle-panel {
    flex: 1.15;
    min-width: 0;
    min-height: 600px;
}

.left-panel {
    flex: 3;
    min-width: 250px;
    min-height: 600px;
}

.right-panel {
    flex: 4;
    min-width: 300px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.container h1 {
    font-size: 20px;
    margin: 0 0 15px 0;
    color: #222;
}

.upload-section {
    margin-bottom: 20px;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    text-align: center;
    background-color: #fafafa;
}

.preview-section {
    margin-top: 2px;
    text-align: center;
    position: relative;
    height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}

#preview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

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

.upload-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin: 0;
    transition: background-color 0.3s;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.upload-btn:hover {
    background-color: #45a049;
}

.upload-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 10px 16px;
    background-color: #2196F3;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    font-size: 14px;
}

.file-label:hover {
    background-color: #1976D2;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.blocks-container {
    margin-top: 12px;
    text-align: left;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    display: none;
    background-color: #fafafa;
}

.workpiece-item {
    border: 1px solid #ddd;
    padding: 10px;
    margin: 8px 0;
    border-radius: 8px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.workpiece-item h3 {
    margin: 0 0 6px 0;
    color: #333;
}

.workpiece-item p {
    margin: 3px 0;
    color: #666;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
    gap: 10px;
    align-items: center;
}

.nav-btn {
    padding: 7px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 13px;
}

.nav-btn:hover {
    background-color: #45a049;
}

.nav-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.block-info {
    text-align: center;
    margin-bottom: 2px;
    font-weight: bold;
}

.preview-container {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    height: 320px;
}

.block-preview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.block-details {
    border-top: 1px solid #ddd;
    padding-top: 6px;
}

.detail-row {
    display: flex;
    margin: 2px 0;
    align-items: center;
}

.detail-label {
    width: 80px;
    text-align: right;
    padding-right: 6px;
    color: #666;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
}

.detail-value {
    display: flex;
    align-items: center;
    flex: 1;
    font-size: 13px;
    min-width: 0;
}

.detail-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
}

.detail-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    background-color: white;
    min-width: 120px;
    box-sizing: border-box;
}

/* 厚度下拉框宽度减少三分之一 */
.thickness-select {
    width: 66.67%;
    min-width: 80px;
}

.workpiece-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.workpiece-item:hover {
    background-color: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 添加模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.close-modal:hover {
    color: #333;
}

.modal-workpiece-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.modal-workpiece-item {
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
    background-color: white;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.modal-workpiece-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.modal-workpiece-item h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #333;
}

.modal-workpiece-item p {
    margin: 3px 0;
    color: #666;
}

.basic-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.input-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    margin-top: 6px;
}

.basic-info {
    margin: 0;
}

.block-info {
    text-align: center;
    margin-bottom: 1px;
    font-size: 13px;
    font-weight: bold;
}

.block-info span {
    font-size: 12px;
    font-weight: normal;
}

.block-info div {
    font-size: 11px;
    color: #666;
    margin-top: 0px;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
    align-items: center;
}

.nav-btn {
    padding: 7px 12px;
    font-size: 13px;
}

.cart-panel {
    flex: 3;
    min-width: 250px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    min-height: 600px;
    max-height: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.cart-panel h2 {
    margin-top: 0;
    font-size: 18px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #222;
}

.cart-item {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 4px;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    font-size: 14px;
}

/* 购物车项目勾选框样式 */
.cart-item-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 0;
    flex-shrink: 0;
}

/* 购物车项目删除按钮样式 */
.cart-item-delete {
    width: 20px;
    height: 20px;
    font-size: 12px;
    padding: 0;
    margin-left: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cart-item-delete:hover {
    background-color: #c82333;
}

.cart-item-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 3px;
}

.cart-item-price {
    color: #d32f2f;
    font-size: 13px;
    margin: 2px 0;
}

.cart-item-qty {
    font-size: 12px;
    margin: 2px 0;
}

.cart-item-total {
    font-size: 12px;
    color: #333;
    margin: 2px 0;
}

.cart-item-price-formula {
    font-size: 13px;
    color: #d32f2f;
    font-weight: bold;
    margin-top: 5px;
}

#cartList {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 15px;
}

#cartList::-webkit-scrollbar {
    width: 6px;
}

#cartList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#cartList::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#cartList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-top: 1px solid #eee;
}

.cart-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.select-all-btn {
    background-color: #f5f5f5;
    color: #333;
}

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

.checkout-btn {
    background-color: #4CAF50;
    color: white;
}

.checkout-btn:hover {
    background-color: #45a049;
}

.checkout-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.history-btn {
    margin-top: 15px;
    padding: 10px 16px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    width: 100%;
}

.history-btn:hover {
    background-color: #1976D2;
}

.history-list {
    margin-top: 15px;
}

.history-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item p {
    margin: 5px 0;
    color: #333;
}

.history-item p:first-child {
    font-weight: bold;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.bottom-bar {
    width: 100%;
    background: #e3e6f0;
    color: #333;
    text-align: center;
    padding: 20px 0;
    font-size: 16px;
    margin-top: 20px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.04);
}

.example-section {
    margin-top: 15px;
    padding: 20px;
    background: #f8fafd;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.example-title {
    font-size: 18px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 10px;
}

.example-file {
    font-size: 14px;
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.example-download {
    color: #2196F3;
    text-decoration: underline;
    font-size: 14px;
    margin-top: 5px;
}

.example-download:hover {
    color: #1565c0;
}

.bottom-bar-flex {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    max-width: 1600px;
    margin: 0 auto;
    flex-wrap: wrap;
    padding: 0 20px;
}

.bottom-bar-instruction {
    flex: 1 1 744px;
    min-width: 651px;
}

.bottom-bar-title {
    font-weight: bold;
    font-size: 20px;
    margin-bottom: 15px;
    color: #1a237e;
}

.bottom-bar-text {
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.bottom-bar-image {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    margin-top: 15px;
}

.payment-methods label {
    display: block;
    margin-bottom: 12px;
    font-size: 16px;
}

.pay-button {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
}

#loading-indicator {
    color: #007bff;
    font-weight: bold;
    text-align: center;
    margin-top: 15px;
}

#error-message {
    margin-top: 15px;
    font-size: 14px;
    color: #d32f2f;
    text-align: center;
}

/* 响应式设计 - 桌面端和平板横屏优化 */
/* 超宽屏适配 (1920px+) */
@media (min-width: 1920px) {
    .main-content {
        max-width: 100%;
        margin: 0 auto;
        gap: 20px;
        padding: 20px 2vw;
    }
    
    .left-panel {
        flex: 3;
        min-width: 250px;
    }
    
    .right-panel {
        flex: 4;
        min-width: 300px;
    }
    
    .cart-panel {
        flex: 3;
        min-width: 250px;
    }
    
    .container h1 {
        font-size: 24px;
    }
    
    .upload-btn {
        font-size: 18px;
        padding: 12px 24px;
    }
}

/* 宽屏适配 (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
    .main-content {
        gap: 15px;
        padding: 20px 1.5vw;
    }
    
    .left-panel {
        flex: 3;
        min-width: 250px;
    }
    
    .right-panel {
        flex: 4;
        min-width: 300px;
    }
    
    .cart-panel {
        flex: 3;
        min-width: 250px;
    }
}

/* 标准桌面适配 (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .main-content {
        gap: 12px;
        padding: 20px 1.5vw;
    }
    
    .left-panel {
        flex: 3;
        min-width: 200px;
    }
    
    .right-panel {
        flex: 4;
        min-width: 300px;
    }
    
    .cart-panel {
        flex: 3;
        min-width: 200px;
    }
}

/* 小桌面适配 (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .main-content {
        gap: 10px;
        padding: 20px 2vw;
    }
    
    .left-panel {
        flex: 3;
        min-width: 200px;
    }
    
    .right-panel {
        flex: 4;
        min-width: 250px;
    }
    
    .cart-panel {
        flex: 3;
        min-width: 200px;
    }
    
    .container {
        padding: 15px;
    }
    
    .upload-btn, .file-label {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .upload-section {
        padding: 12px;
    }
}

/* 平板横屏适配 (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-content {
        flex-direction: column;
        gap: 15px;
        padding: 20px 3vw;
    }
    
    .left-panel, .right-panel, .cart-panel {
        min-height: auto;
        max-width: 100%;
        flex: none;
    }
    
    .left-panel {
        order: 1;
    }
    
    .right-panel {
        order: 2;
    }
    
    .cart-panel {
        order: 3;
        max-height: 400px;
        margin-top: 0;
    }
    
    .container {
        padding: 15px;
    }
    
    .preview-section {
        height: 250px;
    }
    
    .basic-info-grid {
        grid-template-columns: auto auto;
        gap: 6px;
        justify-content: space-between;
    }
    
    .input-info-grid {
        grid-template-columns: auto auto;
        gap: 4px;
        justify-content: space-between;
    }
    
    .upload-btn, .file-label {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .upload-section {
        padding: 12px;
    }
    
    .cart-panel h2 {
        font-size: 18px;
    }
    
    .cart-item-title {
        font-size: 14px;
    }
    
    .cart-item-price {
        font-size: 13px;
    }
}

/* 高DPI屏幕适配 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .upload-btn, .file-label, .auth-btn, .nav-btn {
        border-width: 0.5px;
    }
    
    .container, .left-panel, .right-panel, .cart-panel {
        border-width: 0.5px;
    }
}

/* 打印样式 */
@media print {
    .title-bar, .auth-buttons, .upload-section, .cart-panel, .bottom-bar {
        display: none;
    }
    
    .main-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .left-panel, .right-panel {
        min-height: auto;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .preview-section {
        height: auto;
        border: 1px solid #ccc;
    }
    
    #preview, #blockPreview {
        max-height: none;
        max-width: 100%;
    }
}

/* 工件备注和补充图纸样式优化 */
.workpiece-notes-section .detail-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 2px;
}

.workpiece-notes-section .detail-row > div {
    flex: 1;
    display: flex;
    align-items: center;
}

.workpiece-notes-section .detail-label {
    min-width: 80px;
    flex-shrink: 0;
    font-size: 13px;
}

.workpiece-notes-section .detail-value {
    flex: 1;
}

.workpiece-notes-section .notes-textarea {
    width: 100%;
    resize: vertical;
    min-height: 24px;
    padding: 2px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.file-upload-btn {
    display: inline-block;
    padding: 2px 8px;
    background-color: #2196F3;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
    text-decoration: none;
    border: none;
}

.file-upload-btn:hover {
    background-color: #1976D2;
}

.supplementary-files-preview {
    margin-top: 1px;
    font-size: 11px;
    color: #666;
}

.supplementary-files-section, .order-notes-section {
    flex: 1;
}

.supplementary-files-section .detail-label,
.order-notes-section .detail-label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.supplementary-upload-btn {
    padding: 6px 12px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.supplementary-upload-btn:hover {
    background-color: #1976D2;
}

.supplementary-files-list {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.order-notes-textarea {
    width: 100%;
    resize: vertical;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.no-files-message {
    color: #999;
    font-style: italic;
}

/* 增加折弯按钮样式 */
.bending-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
    padding: 3px 7px;
    line-height: 1.2;
}

.bending-btn:hover {
    background-color: #1976D2;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .workpiece-notes-section .detail-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .workpiece-notes-section .detail-row > div {
        width: 100%;
    }
    
    .supplementary-files-section, .order-notes-section {
        width: 100%;
    }
}