/* 全局样式重置与基础配置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-size: 14px;
    font-family: "Microsoft Yahei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #333;
    background-color: #f8f9fa;
}

/* 布局样式 - 适配侧边栏+主内容的后台布局 */
.sidebar {
    width: 220px;
    height: 100vh;
    background-color: #212529;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 60px;
}

/* 主内容区适配侧边栏宽度 - 核心修改：减少左边距/内边距让内容左移 */
#mainContent {
    margin-left: 220px; /* 原默认值，先明确设置 */
    padding-left: 10px; /* 新增：减少内容区左侧内边距，可根据需要调整（比如5px/0px） */
    transition: all 0.3s ease;
}

.sidebar.collapsed + #mainContent {
    margin-left: 60px; /* 侧边栏收缩时的左边距 */
    padding-left: 10px; /* 同步调整收缩状态下的内边距 */
}

/* 侧边栏菜单样式 */
.sidebar .nav {
    padding-top: 20px;
}

.sidebar .nav-item {
    margin-bottom: 5px;
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background-color: #343a40;
    border-left-color: #FF0033;
}

.sidebar .nav-link i {
    font-size: 16px;
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 侧边栏收缩后隐藏文字，仅显示图标 */
.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 18px;
}

/* 页头样式 */
.header {
    height: 60px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    transition: all 0.3s ease;
}

.sidebar.collapsed + .header {
    left: 60px;
}

/* 页头样式 */
.header {
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    width: calc(100% - 220px); /* 核心：自动占满剩余宽度 */
    z-index: 99;
    transition: all 0.3s ease;
    padding-left: 10px; /* 新增：页头也同步左移，保持视觉统一 */
}

.sidebar.collapsed + .header {
    left: 60px;
    width: calc(100% - 60px); /* 侧边栏收缩时同步调整宽度 */
    padding-left: 10px; /* 收缩状态下页头左侧内边距 */
}

/* 修复导航栏内边距 */
.header .navbar {
    padding: 0;
    height: 100%;
}

.header .navbar-brand {
    margin: 0;
    padding: 0;
    line-height: 60px;
}

/* 内容区通用样式 - 核心修改：减少顶部内边距+左侧内边距 */
.container-fluid {
    padding-top: 70px;
    padding-left: 15px; /* 原默认可能是20px，调小让列表左移，可改为10px/5px */
    padding-right: 15px; /* 保持右侧对称 */
}

.card {
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.card-header {
    border-bottom: 1px solid #eee;
    background-color: #fff;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* 表格样式优化 */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    font-weight: 600;
    color: #495057;
    border-top: none;
}

.table td, .table th {
    border-color: #eee;
    vertical-align: middle;
}

.table-hover > tbody > tr:hover {
    background-color: #f8f9fa;
}

/* 分页组件样式 */
.pagination {
    margin: 0;
    justify-content: center;
}

.pagination .page-item .page-link {
    color: #F2F233;
    border-radius: 4px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #FF0033;
    border-color: #F2F233;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* 按钮样式优化 */
.btn {
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* 表单样式优化 */
.form-control {
    border-radius: 4px;
    border: 1px solid #ced4da;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* 徽章样式优化 */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 4px;
}

/* 模态框样式优化 */
.modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    border-bottom: 1px solid #eee;
}

/* 页脚样式 */
.footer {
    height: 50px;
    line-height: 50px;
    background-color: #fff;
    text-align: center;
    color: #666;
    font-size: 13px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.collapsed {
        transform: translateX(0);
        width: 60px;
    }

    .sidebar.show {
        transform: translateX(0);
        width: 220px;
    }

    .header {
        left: 0;
        padding-left: 10px; /* 移动端页头也左移 */
    }

    .sidebar.collapsed + .header,
    .sidebar.show + .header {
        left: 60px;
    }

    #mainContent {
        margin-left: 0 !important;
        padding-left: 10px; /* 移动端内容区左移 */
    }
}

/* 加载中样式 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,123,255,.3);
    border-radius: 50%;
    border-top-color: #F2F233;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 提示文本样式 */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* 操作按钮组间距优化 */
.btn-group > .btn {
    margin-right: 5px;
}

.btn-group > .btn:last-child {
    margin-right: 0;
}

/* 批量操作模态框样式 */
#batchOperateModal .modal-body {
    padding: 20px;
}

#batchOperateModal .form-group {
    margin-bottom: 15px;
}

/* 图片预览样式增强 */
.preview-img {
    object-fit: cover;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.preview-img:hover {
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

/* 规格项样式优化 */
.spec-item {
    background-color: #fff;
    transition: all 0.2s ease;
}

.spec-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 搜索表单间距优化 */
.search-form .row {
    margin-bottom: 15px;
}

/* 状态标签样式 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-tag.success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-tag.danger {
    background-color: #f8d7da;
    color: #842029;
}

.status-tag.warning {
    background-color: #fff3cd;
    color: #664d03;
}

/* 面包屑样式 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 15px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
}

/* 错误提示样式 */
.text-danger {
    color: #dc3545 !important;
}

/* 成功提示样式 */
.text-success {
    color: #198754 !important;
}

/* 警告提示样式 */
.text-warning {
    color: #ffc107 !important;
}

/* 信息提示样式 */
.text-info {
    color: #0dcaf0 !important;
}