/* ========================================
   WMS 调拨收货扫描系统 - 样式表
   现代化设计 · 响应式布局 · 优雅交互
   ======================================== */

:root {
    /* 主色调 */
    --primary: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3a0ca3;
    --primary-bg: rgba(67, 97, 238, 0.08);
    
    /* 辅助色 */
    --success: #06d6a0;
    --success-bg: rgba(6, 214, 160, 0.1);
    --warning: #ffd60a;
    --warning-bg: rgba(255, 214, 10, 0.15);
    --danger: #ef476f;
    --danger-bg: rgba(239, 71, 111, 0.1);
    --orange: #f77f00;
    --orange-bg: rgba(247, 127, 0, 0.1);
    
    /* 中性色 */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* 背景渐变 */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient-light: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(67, 97, 238, 0.3);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    /* 过渡 */
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ========================================
   全局重置
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ========================================
   加载遮罩
   ======================================== */
.loading-mask {
    position: fixed;
    inset: 0;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-mask.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-mask p {
    color: #fff;
    margin-top: 16px;
    font-size: 14px;
    letter-spacing: 2px;
}

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

/* ========================================
   顶部导航栏
   ======================================== */
.app-header {
    background: var(--bg-gradient);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    z-index: 100;
    flex-shrink: 0;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-text h1 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.logo-sub {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    letter-spacing: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: #fff;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
}

/* ========================================
   统计概览条
   ======================================== */
.summary-bar {
    background: #fff;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    overflow-x: auto;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 80px;
}

.summary-label {
    font-size: 11px;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
    font-variant-numeric: tabular-nums;
    transition: var(--transition);
}

.summary-value.highlight {
    color: var(--primary);
    font-size: 22px;
}

.summary-value.highlight.pulse {
    animation: numberPulse 0.4s ease;
}

@keyframes numberPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--primary-light); }
    100% { transform: scale(1); }
}

.summary-divider {
    width: 1px;
    height: 28px;
    background: var(--gray-200);
    margin: 0 20px;
}

.summary-spacer {
    flex: 1;
}

/* ========================================
   主内容区
   ======================================== */
.main-content {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
}

/* ========================================
   左侧操作面板
   ======================================== */
.operation-panel {
    width: 340px;
    flex-shrink: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 4px;
}

.operation-panel::-webkit-scrollbar {
    width: 6px;
}

.operation-panel::-webkit-scrollbar-track {
    background: transparent;
}

.operation-panel::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

/* ========================================
   卡片组件
   ======================================== */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--gray-50) 0%, #fff 100%);
    border-bottom: 1px solid var(--gray-100);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 svg {
    color: var(--primary);
}

.record-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 10px;
    border-radius: 10px;
}

.card-body {
    padding: 16px 18px;
}

/* ========================================
   按钮组件
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.btn svg {
    flex-shrink: 0;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.35);
}

.btn-secondary {
    background: var(--warning);
    color: var(--gray-800);
    box-shadow: 0 2px 8px rgba(255, 214, 10, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #f72585 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 71, 111, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #04a97c 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(6, 214, 160, 0.25);
}

.btn-warning {
    background: linear-gradient(135deg, var(--orange) 0%, #e85d04 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(247, 127, 0, 0.25);
}

.btn-full {
    width: 100%;
    margin-top: 12px;
    padding: 11px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-group .btn {
    flex: 1;
    min-width: 120px;
}

/* ========================================
   表单组件
   ======================================== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-800);
    transition: var(--transition-fast);
    background: var(--gray-50);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .form-input {
    padding-right: 40px;
}

.input-scan-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
    pointer-events: none;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-text {
    font-size: 13px;
    font-weight: 400;
    color: var(--gray-700);
}

/* ========================================
   文件信息
   ======================================== */
.file-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--primary-dark);
}

.file-info-icon {
    font-size: 18px;
}

/* ========================================
   扫描信息卡片
   ======================================== */
.scan-info-card {
    position: sticky;
    bottom: 0;
}

.scan-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.info-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.info-block:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.info-label {
    font-size: 11px;
    color: var(--gray-500);
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    transition: var(--transition);
}

.info-value.actual {
    color: var(--success);
}

.info-value.remain {
    color: var(--orange);
}

.info-value.plan {
    color: var(--primary);
}

.info-value.changed {
    animation: valueChange 0.5s ease;
}

@keyframes valueChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.current-barcode-info {
    padding: 10px 14px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.info-value-text {
    font-weight: 700;
    color: var(--primary-dark);
    font-family: "Courier New", monospace;
    font-size: 14px;
}

/* ========================================
   扫描记录面板
   ======================================== */
.scan-records-panel {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.records-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.records-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.table-wrapper {
    height: 100%;
    overflow: auto;
}

.table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================================
   表格样式
   ======================================== */
.scan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.scan-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.scan-table th {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-700) 100%);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.scan-table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.scan-table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.scan-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
}

.scan-table tbody tr {
    transition: var(--transition-fast);
    cursor: context-menu;
}

.scan-table tbody tr:hover {
    background: var(--primary-bg);
}

.scan-table tbody tr.completed {
    background: var(--success-bg);
}

.scan-table tbody tr.completed:hover {
    background: rgba(6, 214, 160, 0.18);
}

.scan-table tbody tr.new-row {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
        background: rgba(67, 97, 238, 0.15);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        background: transparent;
    }
}

.empty-row td {
    padding: 0 !important;
    border: none !important;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.empty-hint {
    font-size: 13px;
    color: var(--gray-400);
}

/* ========================================
   状态标签
   ======================================== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status-badge.completed {
    background: var(--success-bg);
    color: #04a97c;
}

.status-badge.pending {
    background: var(--warning-bg);
    color: #e85d04;
}

/* ========================================
   右键菜单
   ======================================== */
.context-menu {
    position: fixed;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 6px;
    min-width: 220px;
    z-index: 1000;
    display: none;
    border: 1px solid var(--gray-100);
    animation: menuAppear 0.15s ease;
}

.context-menu.show {
    display: block;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
    transition: var(--transition-fast);
}

.context-menu-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.context-menu-item svg {
    color: var(--gray-400);
    transition: var(--transition-fast);
}

.context-menu-item:hover svg {
    color: var(--primary);
}

/* ========================================
   模态框
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.settings-modal {
    max-width: 420px;
}

.modal-header {
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--gray-50) 0%, #fff 100%);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 90px;
}

/* 模态框内容样式 */
.modal-message {
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-700);
}

.modal-message .highlight {
    color: var(--primary);
    font-weight: 700;
}

.modal-message .warning-text {
    color: var(--danger);
    font-weight: 600;
}

.modal-input-group {
    margin-top: 14px;
}

.modal-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.modal-input-group .form-input {
    font-size: 15px;
}

/* ========================================
   Toast 通知
   ======================================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--primary);
    max-width: 380px;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--orange);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-message {
    color: var(--gray-700);
    line-height: 1.5;
    word-break: break-word;
}

/* ========================================
   扫描动画效果
   ======================================== */
.scan-flash {
    position: fixed;
    inset: 0;
    background: var(--success);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.1s;
}

.scan-flash.flash {
    opacity: 0.08;
    transition: opacity 0.05s;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .operation-panel {
        width: 300px;
    }
    
    .summary-bar {
        padding: 10px 16px;
    }
    
    .summary-divider {
        margin: 0 12px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .operation-panel {
        width: 100%;
        max-height: 40vh;
    }
    
    .summary-bar {
        overflow-x: auto;
        padding: 8px 12px;
    }
    
    .summary-divider {
        margin: 0 8px;
    }
    
    .summary-value {
        font-size: 16px;
    }
    
    .logo-text h1 {
        font-size: 16px;
    }
    
    .logo-sub {
        display: none;
    }
    
    .scan-table {
        font-size: 12px;
    }
    
    .scan-table th,
    .scan-table td {
        padding: 8px 10px;
    }
}
