/* 扫描界面样式 */

/* 高亮效果 */
.highlight {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7); }
    50% { box-shadow: 0 0 20px 5px rgba(0, 123, 255, 0.5); }
    100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    position: relative;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #007bff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 结果区域 */
.result-content {
    padding: 10px 0;
}

.info-row {
    display: flex;
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
}

.info-row .label {
    width: 80px;
    color: #6c757d;
    font-size: 13px;
}

.info-row .value {
    flex: 1;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    background: #e3f2fd;
    color: #1976d2;
}

/* 箱列表 */
.cases-list {
    margin-top: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
}

.cases-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.case-item {
    display: flex;
    justify-content: space-between;
    padding: 5px;
    font-size: 13px;
    border-bottom: 1px solid #dee2e6;
}

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

.case-item .qty {
    font-weight: 600;
    color: #007bff;
}

.more {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    padding-top: 5px;
}

/* 序列号显示 */
.serials {
    margin-top: 10px;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 6px;
    font-size: 12px;
    color: #2e7d32;
}

/* 库存信息 */
.stock-info {
    margin-top: 10px;
    padding: 10px;
    background: #fff3e0;
    border-radius: 6px;
}

.stock-title {
    font-weight: 600;
    margin-bottom: 5px;
    color: #e65100;
}

/* 创建单据提示 */
.doc-created {
    margin-top: 15px;
    padding: 10px;
    background: #d4edda;
    border-radius: 6px;
    color: #155724;
    font-weight: 500;
    text-align: center;
}

/* 历史记录项 */
.history-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-item.failed {
    opacity: 0.7;
    background-color: #fff5f5;
}

.history-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.history-icon.PALLET { background: #e3f2fd; color: #1976d2; }
.history-icon.CASE { background: #e8f5e9; color: #388e3c; }
.history-icon.ITEM { background: #fff3e0; color: #f57c00; }
.history-icon.LOCATION { background: #f3e5f5; color: #7b1fa2; }
.history-icon.SOURCE { background: #e1f5fe; color: #0288d1; }
.history-icon.ERROR { background: #ffebee; color: #c62828; }

.history-content {
    flex: 1;
}

.history-value {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
    font-size: 14px;
}

.history-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #6c757d;
}

.history-type {
    padding: 2px 6px;
    border-radius: 10px;
    background: #f1f3f5;
}

.history-msg {
    color: #28a745;
}

.empty-history {
    text-align: center;
    padding: 30px;
    color: #adb5bd;
    font-style: italic;
}

/* 详情对话框 */
.detail-row {
    display: flex;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.detail-label {
    width: 80px;
    color: #6c757d;
    font-size: 13px;
}

.detail-value {
    flex: 1;
    font-weight: 500;
}

.detail-value pre {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    overflow: auto;
    max-height: 200px;
}

/* Toast消息 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease;
}

.toast-info {
    background: rgba(0,0,0,0.8);
    color: white;
}

.toast-success {
    background: #28a745;
    color: white;
}

.toast-warning {
    background: #ffc107;
    color: #212529;
}

.toast-error {
    background: #dc3545;
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* 按钮禁用状态 */
.mode-btn:disabled,
.subtype-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .type-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .subtype-bar {
        flex-wrap: wrap;
    }
    
    .subtype-btn {
        flex: 1 1 calc(50% - 5px);
    }
    
    .mode-buttons {
        flex-direction: column;
        gap: 2px;
    }
    
    .dialog-content {
        width: 95%;
        margin: 10px;
    }
}

/* 打印样式 */
@media print {
    .scan-interface {
        padding: 0;
        background: white;
    }
    
    .type-selector,
    .mode-switch,
    .scan-input-area,
    .scan-history,
    .back-btn {
        display: none !important;
    }
    
    .scan-result {
        box-shadow: none;
        border: 1px solid #000;
    }
}