* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    padding: 20px;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.description {
    font-size: 1.1rem;
    opacity: 0.9;
}



.query-form.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6a11cb;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.toggle-btn:hover {
    background: #2575fc;
}

.external-toggle-btn {
    position: fixed;
    top: 10px;
    right: 10px; /* 移到右上角，避免覆盖表单 */
    background: #6a11cb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
}

.external-toggle-btn:hover {
    background: #2575fc;
}

.form-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #6a11cb;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto; /* 标题不伸缩 */
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0; /* 移除底部间距，因为现在是横向 */
    justify-content: center;
    width: 100%;
    max-width: 1200px; /* 限制最大宽度，居中 */
}

.form-group {
    flex: 1 1 150px; /* 允许增长和缩小，最小150px */
    min-width: 150px;
    max-width: 200px; /* 限制单个字段宽度，避免太宽 */
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #6a11cb;
}

.submit-btn {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex: 0 0 auto; /* 按钮不伸缩 */
    margin-top: 0; /* 移除顶部间距 */
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(106, 17, 203, 0.3);
}

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

/* 以下是原文件剩余部分，未修改 */
.loading {
    text-align: center;
    padding: 30px;
    display: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #6a11cb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}








@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message, .success-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.error-message {
    background: #ffebee;
    color: #c62828;
}

.success-message {
    background: #e8f5e9;
    color: #2e7d32;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-card {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.stat-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #6a11cb;
}

.stat-card p {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.items-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.list-header, .list-item {
    display: grid;
    grid-template-columns: 80px 100px 1fr 1fr 1fr 100px 100px 120px 120px;
    gap: 15px;
    padding: 15px 20px;
    align-items: center;
}

.list-header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    font-weight: bold;
}

.list-item {
    border-bottom: 1px solid #eee;
}

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

.list-item:hover {
    background-color: #f9f9f9;
}

.item-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 5px;
    background: #f9f9f9;
}

.item-id, .item-quantity, .item-price {
    text-align: center;
    font-weight: bold;
}

.item-price {
    color: #e74c3c;
}

.status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
}

.status.processed {
    background: #d4edda;
    color: #155724;
}

.status.unprocessed {
    background: #ffecd9;
    color: #ff9f43;
}

.print-btn {
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.9rem;
}

.print-btn:hover {
    background: #218838;
}

.print-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}



.no-results {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.no-results i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

.no-results p {
    font-size: 1.2rem;
    color: #888;
}

.offer-total {
    text-align: center;
    font-weight: bold;
    color: #6a11cb;
    background: #f0f2f5;
    padding: 5px 10px;
    border-radius: 15px;
}


/* 按钮布局 */
/* 横排容器 */
.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;  /* 控件间距 */
    margin: 15px 0;
}

/* 全选样式 */
.select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* 按钮样式复用 */
.print-all-btn {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.print-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
}




.select-all:hover {
    background: #f5f7fa;
}

/* 模态框样式 */
.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: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: modalopen 0.3s;
}

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

.modal-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.form-info {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.form-info p {
    margin: 8px 0;
    word-break: break-all;
}




/* 搜索框 */
.query-form {
    position: fixed;
    top: 100px; /* 避开 header */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.0);
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(101, 97, 97, 0.2);
    width: 95%;
    max-width: 1300px;
    z-index: 1000;

    display: flex;          /* 让整个表单横排 */
    align-items: flex-end;  /* 输入框和按钮底部对齐 */
    gap: 15px;              /* 横向间距 */
    flex-wrap: nowrap;      /* 禁止自动换行（超出会横向滚动） */
    overflow-x: auto;       /* 超出时横向滚动条 */
}

/* 保持每个输入项紧凑 */
.form-group {
    flex: 0 0 auto;  /* 不要自动拉伸 */
    min-width: 160px;
}

/* 按钮固定大小 */
.submit-btn {
    flex: 0 0 auto;
}



/* Responsive design */
@media (max-width: 1200px) {
    .list-header, .list-item {
        grid-template-columns: 60px 80px 1fr 1fr 1fr 100px 100px 120px;
    }

    .list-header span:nth-child(5),
    .list-item .item-order-number {
        display: none;
    }

    .form-row {
        max-width: 1000px;
    }

    .form-group {
        max-width: 180px;
    }
}

@media (max-width: 900px) {
    .list-header, .list-item {
        grid-template-columns: 50px 70px 1fr 1fr 100px 100px 120px;
    }

    .list-header span:nth-child(4),
    .list-item .item-tracking {
        display: none;
    }

    .form-row {
        flex-direction: row; /* 保持横向，但允许换行 */
        justify-content: flex-start;
    }

    .form-group {
        flex: 1 1 100%; /* 小屏时全宽 */
        max-width: none;
    }
}

@media (max-width: 768px) {
    .stats {
        flex-direction: column;
    }

    .list-header, .list-item {
        grid-template-columns: 40px 60px 1fr 1fr 100px 120px;
    }

    .list-header span:nth-child(7),
    .list-item .item-status {
        display: none;
    }

    .list-item {
        padding: 10px 15px;
    }



    .form-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .list-header, .list-item {
        grid-template-columns: 30px 50px 1fr 1fr 120px;
    }

    .list-header span:nth-child(6),
    .list-item .item-price {
        display: none;
    }



    .submit-btn {
        width: 100%; /* 小屏按钮全宽 */
    }
}