* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #a3a5a5 100%);
    padding: 20px;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 40px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 1px;
}

.form-container {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
}

.form-group.half-width {
    flex: 0 0 calc(50% - 10px);
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
    transform: translateY(-1px);
}

.items-section {
    margin-top: 40px;
    margin-bottom: 30px;
    padding: 25px;
    background-color: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.items-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

#itemsContainer {
    margin-bottom: 20px;
}

.item-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    align-items: flex-start;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.item-row:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.item-content {
    flex: 3;
}

.item-price,
.item-quantity,
.item-subtotal {
    flex: 1;
    min-width: 120px;
}

/* 统一所有项目列的标签样式 */
.item-content label,
.item-price label,
.item-quantity label,
.item-subtotal label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
    height: 20px;
}

/* 单价、数量和小计保持固定高度 */
.item-price input,
.item-quantity input,
.subtotal-value {
    width: 100%;
    height: 66px;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
}

/* 内容文本框自动调整高度 */
.item-content textarea {
    width: 100%;
    min-height: 30px;
    max-height: 150px;
    height: 45px;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    display: block;
    resize: vertical;
    overflow-y: auto;
    line-height: 1.4;
    margin: 0;
}

.item-content textarea:focus,
.item-price input:focus,
.item-quantity input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

/* 小计特殊样式 */
.subtotal-value {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    font-weight: bold;
    color: #166534;
}

/* 统一移除按钮位置 */
.item-remove {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: 28px;
}

.remove-btn {
    width: 35px;
    height: 35px;
    border: none;
    background-color: #ef4444;
    color: white;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background-color: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.add-btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.add-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.add-btn:before {
    content: '+';
    font-size: 18px;
    font-weight: bold;
}

/* .total-section {
    margin-top: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 10px;
    border: 2px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
} */

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.total-label {
    font-weight: bold;
    font-size: 18px;
    color: #374151;
    font-weight: 600;
}

.total-value {
    font-weight: bold;
    font-size: 32px;
    color: #1e40af;
    font-weight: 700;
}

.button-group {
    margin-top: 40px;
    text-align: center;
}

.submit-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 15px 45px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.submit-btn:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.message {
    margin-top: 30px;
    padding: 18px 25px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 15px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 2px solid #bbf7d0;
}

.message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 30px;
    }
    
    /* 移动端表单行改为垂直排列 */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    /* 移动端表单组改为全宽 */
    .form-group.half-width {
        flex: 1;
        min-width: 100%;
    }
    
    .item-row {
        flex-wrap: wrap;
        padding: 15px;
    }
    
    .item-content {
        width: 100%;
        flex: none;
        margin-bottom: 15px;
    }
    
    .item-price,
    .item-quantity,
    .item-subtotal {
        flex: 1;
        min-width: 120px;
    }
    
    /* 移动端统一输入区域高度 */
    .item-content textarea,
    .item-price input,
    .item-quantity input,
    .subtotal-value {
        height: 45px;
    }
    
    .item-remove {
        margin-top: 0;
        order: 5;
        width: 100%;
        justify-content: flex-end;
        align-items: center;
    }
    

    
    .total-value {
        font-size: 28px;
    }
    
    .submit-btn {
        width: 100%;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .item-price,
    .item-quantity,
    .item-subtotal {
        width: 100%;
        flex: none;
        margin-bottom: 15px;
    }
    
    .item-row {
        gap: 10px;
    }
    
    /* 移动端统一输入区域高度 */
    .item-content textarea,
    .item-price input,
    .item-quantity input,
    .subtotal-value {
        height: 45px;
    }
}