/* 库存管理增强样式 */

/* ========== Tab Navigation Styles ========== */
.tab-button {
    transition: all 0.2s ease-in-out;
}

.tab-button:hover {
    background-color: #f9fafb;
}

.tab-button.active {
    background-color: white;
    color: #2563eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* ========== Enhanced Statistics Cards ========== */
.stats-card {
    transition: transform 0.2s ease-in-out, shadow 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* 统计卡片响应式布局优化 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Procurement Management Styles ========== */
.procurement-filter-btn {
    transition: all 0.2s ease-in-out;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.procurement-filter-btn:hover {
    background-color: #f9fafb;
}

.procurement-filter-btn.active {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.procurement-item {
    position: relative;
    background-color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease-in-out;
}

.procurement-item:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.procurement-item-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* ========== Stocktaking Management Styles ========== */
.stocktaking-item {
    transition: all 0.2s ease-in-out;
}

.stocktaking-item.completed {
    background-color: #f0fdf4;
    border-left: 4px solid #10b981;
}

.stocktaking-item.has-difference {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
}

.stocktaking-item.pending {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
}

/* 进度指示器 */
.progress-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.progress-indicator.not-started {
    background-color: #f3f4f6;
    color: #374151;
}

.progress-indicator.in-progress {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.progress-indicator.completed {
    background-color: #d1fae5;
    color: #065f46;
}

.progress-indicator.has-discrepancy {
    background-color: #fef3c7;
    color: #92400e;
}

/* ========== Scan Interface Styles ========== */
.scan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in-out;
}

.scan-viewfinder {
    width: 300px;
    height: 300px;
    border: 2px solid white;
    border-radius: 0.5rem;
    position: relative;
    background-color: transparent;
}

.scan-viewfinder::before,
.scan-viewfinder::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid #10b981;
}

.scan-viewfinder::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 0.5rem;
}

.scan-viewfinder::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 0.5rem;
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ========== Modal Enhancements ========== */
.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* 采购申请模态框样式 */
.procurement-modal .modal-content {
    max-width: 64rem; /* max-w-4xl */
}

.procurement-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

/* ========== Enhanced Table Styles ========== */
.table-container {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.table-row {
    transition: background-color 0.2s ease-in-out;
}

.table-row:hover {
    background-color: #f9fafb;
}

/* 表格操作按钮优化 */
.table-action-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    margin-right: 0.5rem;
}

.table-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ========== Status Badge Enhancements ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.status-draft {
    background-color: #f3f4f6;
    color: #374151;
}

.status-badge.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.status-approved {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.status-rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.status-ordered {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.status-badge.status-received {
    background-color: #e0e7ff;
    color: #3730a3;
}

.status-badge.status-completed {
    background-color: #d1fae5;
    color: #065f46;
}

/* ========== Loading and Empty States ========== */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

/* ========== Responsive Improvements ========== */
@media (max-width: 1024px) {
    .procurement-modal .modal-content {
        max-width: 90vw;
        margin: 1rem;
    }
    
    .procurement-item-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tab-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 640px) {
    .procurement-filter-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .tab-button {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* ========== Print Styles ========== */
@media print {
    .tab-button,
    .table-action-btn,
    .modal,
    .scan-overlay {
        display: none !important;
    }
    
    .tab-content {
        display: block !important;
    }
    
    .stats-card {
        break-inside: avoid;
    }
}

/* ========== Accessibility Improvements ========== */
.tab-button:focus,
.procurement-filter-btn:focus,
.table-action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .tab-button.active {
        border: 2px solid #1d4ed8;
    }
    
    .status-badge {
        border: 1px solid currentColor;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .tab-content,
    .modal-content,
    .procurement-item,
    .stats-card {
        animation: none;
        transition: none;
    }
}
