/* 自定义样式 */

/* 页面整体样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 卡片样式 */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 卡片主体样式 */
.card-body {
    padding: 0.75rem;
}

/* 卡片标题样式 */
.card-title {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    min-height: 2.6em;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 商品列表卡片网格样式 */
#productList {
    min-height: 300px;
}

/* 卡片中的图片样式 */
.card-img-top {
    max-height: 120px !important;
    object-fit: cover;
    border-radius: 6px 6px 0 0 !important;
}

/* 卡片列表响应式调整 */
@media (max-width: 768px) {
    #productList .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    #productList .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (min-width: 993px) {
    #productList .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* 卡片内列表项样式 */
.card .list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

.card .list-group-item:first-child {
    border-top: none;
}

.card .list-group-item:last-child {
    border-bottom: none;
}

/* 表格样式 */
table {
    font-size: 14px;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.table td {
    vertical-align: middle;
}

/* 商品行样式 */
.product-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.product-row:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 商品行中的按钮样式 */
.product-row .btn {
    cursor: pointer;
}

.product-row .btn:hover {
    transform: none;
    box-shadow: none;
}

/* 按钮样式 */
.btn {
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

/* 卡片中的按钮样式 */
.card .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.card .btn i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* 搜索框样式 */
#searchInput, #categoryFilter {
    border-radius: 4px;
    transition: all 0.2s ease;
}

#searchInput:focus, #categoryFilter:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 加载动画样式 */
#loadingSpinner {
    min-height: 300px;
}

/* 无数据提示样式 */
#noProducts {
    min-height: 300px;
}

/* 模态框样式 */
.modal-content {
    border-radius: 8px;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-weight: 600;
}

/* 表单样式 */
.form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-control {
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

/* 分页样式 */
.pagination {
    margin: 0;
}

.page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.page-link {
    color: #0d6efd;
    transition: all 0.2s ease;
}

.page-link:hover {
    color: #0a58ca;
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* 操作按钮组样式 */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* 商品详情样式 */
#productDetailContent {
    line-height: 1.6;
}

#productDetailContent h6 {
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

#productDetailContent p {
    margin-bottom: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 3px;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* 商品列表为空时的样式 */
#noProducts {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 页面标题样式 */
h1.h3 {
    font-weight: 600;
    color: #212529;
}

/* 页面信息样式 */
#pageInfo {
    font-size: 14px;
}

/* 商品标题截断样式 */
.product-title {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 商品详情模态框样式 */
#productDetailModal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* 加载动画改进 */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 搜索区域样式 */
#searchInput {
    width: 100%;
}

/* 分类筛选样式 */
#categoryFilter {
    width: 100%;
}

/* 搜索按钮样式 */
#searchBtn {
    width: 100%;
}

/* 模态框表单样式 */
#productForm .mb-3 {
    margin-bottom: 1rem;
}

/* 确认删除模态框样式 */
#deleteModal .modal-body {
    padding: 1.5rem;
}

#deleteModal .modal-footer {
    padding: 1rem 1.5rem;
}

/* 规格对应图片卡片样式 */
.spec-image-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.spec-image-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.spec-image-card .card-body {
    padding: 1rem;
}

.spec-image-card img {
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.spec-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 6px;
}

.spec-image-cell .position-relative:hover .spec-image-overlay {
    opacity: 1;
}

.spec-image-cell .position-relative {
    position: relative;
}

.spec-edit-form {
    margin-top: 0.5rem;
}

.spec-edit-form .form-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.spec-edit-form .form-control {
    font-size: 13px;
    padding: 0.375rem 0.5rem;
}

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

.spec-item {
    padding-bottom: 8px;
}

.spec-item:last-child {
    border-bottom: none !important;
    padding-bottom: 0;
    margin-bottom: 0;
}
