/* 商品卡片样式 */
.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* 商品图片容器 */
.product-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    cursor: pointer;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-image-container:hover .product-image {
    transform: scale(1.1);
}

/* 图片放大预览 */
.image-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-preview.active {
    opacity: 1;
    visibility: visible;
}

.preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-preview {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 1001;
}

.close-preview:hover {
    color: #ccc;
}

/* 商品信息 */
.product-info {
    padding: 16px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.product-supplier {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.product-dates {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

/* 到期提醒样式 */
.expiry-warning {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 12px;
    text-align: center;
}

.expiry-warning.red {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.expiry-warning.yellow {
    background-color: #fef9c3;
    color: #ca8a04;
    border: 1px solid #fef08a;
}

.expiry-warning.green {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* 搜索输入框样式 */
#search-input {
    transition: all 0.3s ease;
}

#search-input:focus {
    width: 250px;
}

/* 模态框动画 */
#product-modal,
#supplier-modal {
    animation: fadeIn 0.3s ease;
}

#product-modal > div,
#supplier-modal > div {
    animation: slideIn 0.3s ease;
}

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

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

/* 表格样式优化 */
table {
    transition: all 0.3s ease;
}

tr:hover {
    background-color: #f9fafb;
}

/* 按钮样式优化 */
button {
    transition: all 0.3s ease;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #products-grid {
        grid-template-columns: 1fr;
    }
    
    .flex.justify-between.items-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    #search-input {
        width: 100%;
    }
    
    #search-input:focus {
        width: 100%;
    }
}

@media (max-width: 640px) {
    nav {
        padding: 0 12px;
    }
    
    nav h1 {
        font-size: 16px;
    }
    
    nav button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    main {
        padding: 12px;
    }
    
    h2 {
        font-size: 18px;
    }
}