/* 全局样式重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 登录界面优化 */
#loginModal .modal-content {
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

#loginModal .modal-body {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    color: #333;
}

/* 表格样式优化 */
.table-header-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.table-header-custom th {
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: all 0.2s ease;
    border: none;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.table tbody tr:first-child td {
    border-top: none;
}

/* 库存状态样式 */
.stock-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.stock-high {
    background-color: #d1f2eb;
    color: #0f5132;
}

.stock-medium {
    background-color: #fff3cd;
    color: #664d03;
}

.stock-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* 条码样式 */
.barcode-text {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid #dee2e6;
}

/* 操作按钮样式 */
.action-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border: none;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 产品序号样式 */
.product-index {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

/* 导航栏优化 */
.navbar {
    backdrop-filter: blur(10px);
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
}

/* 搜索栏动画 */
#searchBar {
    transition: all 0.3s ease;
}

/* 模态框层级修复 */
#stockAdjustModal {
    z-index: 1060 !important;
}

/* 低库存模态框正常层级 */
#lowStockModal {
    z-index: 1050;
}

/* 扫码界面样式 */
.scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.scanner-container {
    width: 100%;
    max-width: 400px;
    height: 100%;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.scanner-header h5 {
    font-size: 1.2rem;
    font-weight: 600;
}

.scanner-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scanner-viewfinder {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 20px;
}

.scanner-viewfinder video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 扫码框架动画 */
.scanner-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scanner-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00ff88;
    border-radius: 2px;
}

.scanner-corner-tl {
    top: 20px;
    left: 20px;
    border-right: none;
    border-bottom: none;
}

.scanner-corner-tr {
    top: 20px;
    right: 20px;
    border-left: none;
    border-bottom: none;
}

.scanner-corner-bl {
    bottom: 20px;
    left: 20px;
    border-right: none;
    border-top: none;
}

.scanner-corner-br {
    bottom: 20px;
    right: 20px;
    border-left: none;
    border-top: none;
}

/* 扫描线动画 */
.scanner-line {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
    animation: scannerLine 2s ease-in-out infinite;
}

@keyframes scannerLine {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(240px);
        opacity: 0;
    }
}

/* 扫码信息区域 */
.scanner-info {
    text-align: center;
    max-width: 300px;
}

.scanner-info p {
    margin-bottom: 15px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .scanner-container {
        padding: 15px;
    }
    
    .scanner-viewfinder {
        width: 250px;
        height: 250px;
    }
    
    .quick-action-card .card-body {
        padding: 1rem !important;
    }
    
    .quick-action-card h6 {
        font-size: 0.9rem;
    }
    
    .quick-action-card small {
        font-size: 0.8rem;
    }
    
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    #stockOverview .col-4 {
        margin-bottom: 0.75rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .scanner-viewfinder {
        width: 220px;
        height: 220px;
    }
    
    .scanner-line {
        animation-duration: 1.5s;
    }
    
    .quick-action-card .card-body {
        padding: 0.75rem !important;
    }
    
    .quick-action-card [style*="width: 50px"] {
        width: 40px !important;
        height: 40px !important;
    }
    
    .modal-dialog {
        margin: 1rem 0.5rem;
        max-width: none;
    }
}

/* 卡片视图样式 */
.product-card {
    transition: all 0.3s ease;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: white;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #0d6efd;
}

.product-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0 !important;
    padding: 0.75rem 1rem;
}

.product-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0;
}

.product-card .card-body {
    padding: 1rem;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.product-info-label {
    color: #6c757d;
    font-weight: 500;
}

.product-info-value {
    color: #495057;
    font-weight: 400;
}

.stock-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stock-high {
    background-color: #d1e7dd;
    color: #0f5132;
}

.stock-medium {
    background-color: #fff3cd;
    color: #664d03;
}

.stock-low {
    background-color: #f8d7da;
    color: #721c24;
}

/* 表格视图优化 */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    font-weight: 600;
    color: #495057;
    padding: 1rem 0.75rem;
}

.table tbody td {
    padding: 0.875rem 0.75rem;
    border-color: #f1f3f4;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* 视图切换按钮 */
.btn-group .btn {
    border-radius: 8px;
}

.btn-group .btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.btn-group .btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* 模态框优化 */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid #f1f3f4;
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f1f3f4;
    padding: 1rem 1.5rem;
}

/* 表单优化 */
.form-control {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 0.875rem;
    transition: all 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* 按钮优化 */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* 警告提示优化 */
.alert {
    border: none;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.alert-success {
    background: linear-gradient(135deg, #d1e7dd 0%, #badbcc 100%);
    color: #0f5132;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffecb5 100%);
    color: #664d03;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #055160;
}

/* 库存概览卡片 */
#stockOverview .card {
    transition: all 0.3s ease;
    border-radius: 12px;
    background: white;
    border: 1px solid #e9ecef;
}

#stockOverview .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#stockOverview .card h5 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

#stockOverview .card small {
    font-weight: 500;
    color: #6c757d;
}

/* 商品列表卡片 */
#productListCard {
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

#productListCard .card-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid #f1f3f4;
}

/* 平板端优化 */
@media (min-width: 768px) and (max-width: 991.98px) {
    .quick-action-card .card-body {
        padding: 1.25rem !important;
    }
    
    .scanner-viewfinder {
        width: 320px;
        height: 320px;
    }
}

/* 动画效果 */


/* 滚动条优化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f3f4;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #a8b3ba;
}

/* 加载状态 */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* 条码输入框特殊样式 */
input[type="text"][maxlength="13"] {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* 扫码按钮动画 */
.btn-outline-primary:hover i.bi-qr-code-scan {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 数字显示优化 */
.text-primary,
.text-success,
.text-warning {
    font-weight: 600;
}

/* 品牌标识样式 */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

/* 输入组优化 */
.input-group {
    flex-wrap: nowrap;
}

.input-group-text {
    border-color: #dee2e6;
    background-color: #f8f9fa;
}

.input-group .form-control:not(:last-child) {
    border-right: none;
}

.input-group .form-control:not(:first-child) {
    border-left: none;
}

/* 表格操作按钮 */
.btn-group-sm > .btn, .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin: 1px;
}

/* 自动完成输入框样式 */
input[list] {
    position: relative;
}

input[list]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* 提示文本样式 */
.form-text.autocomplete-hint {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.form-text.autocomplete-hint i {
    margin-right: 0.25rem;
    color: #667eea;
}

/* Toast提示优化 */
.toast {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    min-width: 300px;
    max-width: 400px;
}

.toast .toast-body {
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.toast .bi {
    font-size: 1.1rem;
}

/* Toast动画优化 */
.toast.show {
    animation: toastSlideIn 0.3s ease-out;
}

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

.toast.hide {
    animation: toastSlideOut 0.3s ease-in;
}

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

/* 移动端Toast适配 */
@media (max-width: 576px) {
    #toastContainer {
        left: 0.75rem !important;
        right: 0.75rem !important;
        top: 1rem !important;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}