/* 页面头部行（返回按钮 + 标题） */
.page-header-row {
    display: flex;
    align-items: center;
}

.page-header-row .card-title {
    margin: 0;
}

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

:root {
    /* 主色调 - 科技蓝 */
    --primary: #1890ff;
    --primary-light: #e6f7ff;
    --primary-dark: #0050b3;

    /* 辅助色 */
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #13c2c2;

    /* 中性色 */
    --bg: #f0f2f5;
    --white: #ffffff;
    --border: #e8e8e8;
    --text: #333333;
    --text-secondary: #666666;
    --text-light: #999999;

    /* 布局尺寸 */
    --header-height: 60px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s;
}

.menu-toggle:hover {
    background: var(--bg);
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.header-center {
    flex: 1;
    text-align: center;
}

.page-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.3s;
}

.user-info:hover {
    background: var(--bg);
}

.user-info i {
    font-size: 20px;
    color: var(--primary);
}

/* ===== 主体区域 ===== */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.menu {
    padding: 8px 0;
}

/* ===== 独立菜单项（无子菜单） ===== */
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
    font-size: 14px;
    text-decoration: none;
}

.menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.menu-item i {
    width: 18px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-item span {
    font-size: 14px;
    white-space: nowrap;
    flex: 1;
}

/* ===== 树形菜单组（有子菜单） ===== */
.menu-tree {
    margin: 0;
}

/* 树形菜单头部（可点击展开） */
.menu-tree-header {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
    border-left: 3px solid transparent;
    position: relative;
    text-decoration: none;
}

.menu-tree-header:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-tree-header i {
    width: 18px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-tree-header span {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
}

.tree-arrow {
    font-size: 11px;
    transition: transform 0.3s ease;
    color: var(--text-light);
    flex-shrink: 0;
}

/* 学校管理树形缩进 - 每级缩进 20px */
.tree-node {
    margin-left: 0 !important;
}
.tree-node .tree-node-children {
    padding-left: 20px !important;
}
.tree-node .tree-node-children .tree-node-header {
    padding-left: 4px;
}
.tree-node-item {
    padding: 6px 8px 6px 28px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.2s;
}
.tree-node-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.tree-node-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.2s;
}
.tree-node-header:hover {
    background: var(--primary-light);
}
.tree-icon {
    width: 16px;
    text-align: center;
    color: var(--primary);
    flex-shrink: 0;
}

.menu-tree-header.expanded .tree-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

/* 树形菜单子项容器 */
.menu-tree-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease;
    background: #fafbfc;
}

.menu-tree-items.expanded {
    max-height: 1000px;
}

/* 树形菜单子项 */
.menu-tree-item {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 52px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    font-size: 13px;
    border-left: 3px solid transparent;
    position: relative;
    text-decoration: none;
}

.menu-tree-item::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.menu-tree-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-tree-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.menu-tree-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.menu-tree-item span {
    font-size: 13px;
    white-space: nowrap;
}

/* 二级子菜单分组 */
.menu-tree-subgroup {
    margin: 0;
}

/* ===== 进销存管理二级菜单美化 ===== */
#tree-inventory .menu-tree-item {
    text-decoration: none;
    margin: 4px 12px 4px 44px;
    padding: 10px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-left: 3px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

#tree-inventory .menu-tree-item::before {
    display: none;
}

#tree-inventory .menu-tree-item:hover {
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f9ff 100%);
    color: #1890ff;
    border-color: #91d5ff;
    border-left-color: #1890ff;
    box-shadow: 0 4px 12px rgba(24,144,255,0.15);
    transform: translateX(4px);
}

#tree-inventory .menu-tree-item.active {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #ffffff;
    border-color: #1890ff;
    border-left-color: #0050b3;
    box-shadow: 0 4px 12px rgba(24,144,255,0.3);
}

#tree-inventory .menu-tree-item.active i {
    color: #ffffff;
}

#tree-inventory .menu-tree-item i {
    width: 20px;
    font-size: 15px;
    color: #64748b;
    transition: color 0.3s;
}

#tree-inventory .menu-tree-item:hover i {
    color: #1890ff;
}

#tree-inventory .menu-tree-item span {
    font-size: 13px;
    font-weight: 500;
}

/* 进销存菜单图标颜色 - 统一使用默认色调 */
#tree-inventory .menu-tree-item i {
    color: #64748b;
}

#tree-inventory .menu-tree-item.active i {
    color: #ffffff !important;
}

.menu-tree-subgroup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 52px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
    font-size: 13px;
    border-left: 3px solid transparent;
    position: relative;
    user-select: none;
}

.menu-tree-subgroup-header:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.menu-tree-subgroup-header .tree-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s;
}

.menu-tree-subgroup-header.expanded .tree-arrow {
    transform: rotate(180deg);
}

.menu-tree-subgroup-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

.menu-tree-subgroup-items.expanded {
    max-height: 500px;
}

.menu-tree-subgroup-items .menu-tree-item {
    text-decoration: none;
    padding-left: 64px;
    font-size: 12px;
}

.menu-tree-subgroup-items .menu-tree-item::before {
    left: 44px;
}

/* ===== 侧边栏折叠状态 ===== */
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-tree-header span,
.sidebar.collapsed .menu-tree-item span,
.sidebar.collapsed .tree-arrow {
    display: none;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .menu-tree-header {
    text-decoration: none;
    justify-content: center;
    padding: 11px 0;
}

.sidebar.collapsed .menu-tree-items {
    display: none;
}

.sidebar.collapsed .menu-tree-item {
    text-decoration: none;
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .menu-tree-item::before {
    display: none;
}

/* ===== 主内容区 ===== */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.content > * {
    width: 100%;
    max-width: 1400px;
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-light);
}

.loading-placeholder i {
    font-size: 40px;
    margin-bottom: 15px;
}

/* ===== 商城管理样式 ===== */

/* 商品 Tab 切换 */
.mall-goods-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 15px;
}

.mall-goods-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.mall-goods-tab:hover {
    color: #666;
}

.mall-goods-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* ===== 进销存基础信息 Tab 按钮美化 ===== */
#inv-basic-tabs.mall-goods-tabs {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    gap: 12px;
}

#inv-basic-tabs .mall-goods-tab {
    padding: 12px 24px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

#inv-basic-tabs .mall-goods-tab i {
    font-size: 16px;
}

#inv-basic-tabs .mall-goods-tab[data-tab="warehouse"] {
    border-color: #d6bcfa;
    color: #722ed1;
}

#inv-basic-tabs .mall-goods-tab[data-tab="warehouse"]:hover {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border-color: #a855f7;
    box-shadow: 0 4px 12px rgba(168,85,247,0.25);
    transform: translateY(-2px);
}

#inv-basic-tabs .mall-goods-tab[data-tab="supplier"] {
    border-color: #86efac;
    color: #16a34a;
}

#inv-basic-tabs .mall-goods-tab[data-tab="supplier"]:hover {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #22c55e;
    box-shadow: 0 4px 12px rgba(34,197,94,0.25);
    transform: translateY(-2px);
}

#inv-basic-tabs .mall-goods-tab[data-tab="brand"] {
    border-color: #fdba74;
    color: #ea580c;
}

#inv-basic-tabs .mall-goods-tab[data-tab="brand"]:hover {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    border-color: #f97316;
    box-shadow: 0 4px 12px rgba(249,115,22,0.25);
    transform: translateY(-2px);
}

#inv-basic-tabs .mall-goods-tab[data-tab="product"] {
    border-color: #6ee7b7;
    color: #059669;
}

#inv-basic-tabs .mall-goods-tab[data-tab="product"]:hover {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16,185,129,0.25);
    transform: translateY(-2px);
}

#inv-basic-tabs .mall-goods-tab.active {
    border-width: 2px;
    border-bottom-width: 4px;
}

#inv-basic-tabs .mall-goods-tab.active[data-tab="warehouse"] {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    color: #ffffff;
    border-color: #6b21a8;
    box-shadow: 0 6px 16px rgba(147,51,234,0.35);
}

#inv-basic-tabs .mall-goods-tab.active[data-tab="supplier"] {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    border-color: #166534;
    box-shadow: 0 6px 16px rgba(22,163,74,0.35);
}

#inv-basic-tabs .mall-goods-tab.active[data-tab="brand"] {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: #ffffff;
    border-color: #9a3412;
    box-shadow: 0 6px 16px rgba(234,88,12,0.35);
}

#inv-basic-tabs .mall-goods-tab.active[data-tab="product"] {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border-color: #065f46;
    box-shadow: 0 6px 16px rgba(5,150,105,0.35);
}

/* ===== 库存管理 Tab 按钮美化 ===== */
#inv-stock-tabs.mall-goods-tabs {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    gap: 12px;
}

#inv-stock-tabs .mall-goods-tab {
    padding: 12px 24px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

#inv-stock-tabs .mall-goods-tab i {
    font-size: 16px;
}

#inv-stock-tabs .mall-goods-tab[data-tab="query"] {
    border-color: #93c5fd;
    color: #2563eb;
}

#inv-stock-tabs .mall-goods-tab[data-tab="query"]:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59,130,246,0.25);
    transform: translateY(-2px);
}

#inv-stock-tabs .mall-goods-tab[data-tab="transfer"] {
    border-color: #c4b5fd;
    color: #7c3aed;
}

#inv-stock-tabs .mall-goods-tab[data-tab="transfer"]:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139,92,246,0.25);
    transform: translateY(-2px);
}

#inv-stock-tabs .mall-goods-tab[data-tab="check"] {
    border-color: #fca5a5;
    color: #dc2626;
}

#inv-stock-tabs .mall-goods-tab[data-tab="check"]:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239,68,68,0.25);
    transform: translateY(-2px);
}

#inv-stock-tabs .mall-goods-tab.active {
    border-width: 2px;
    border-bottom-width: 4px;
}

#inv-stock-tabs .mall-goods-tab.active[data-tab="query"] {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-color: #1e40af;
    box-shadow: 0 6px 16px rgba(37,99,235,0.35);
}

#inv-stock-tabs .mall-goods-tab.active[data-tab="transfer"] {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #ffffff;
    border-color: #5b21b6;
    box-shadow: 0 6px 16px rgba(124,58,237,0.35);
}

#inv-stock-tabs .mall-goods-tab.active[data-tab="check"] {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    border-color: #991b1b;
    box-shadow: 0 6px 16px rgba(220,38,38,0.35);
}

/* 商品表格样式 */
.goods-no {
    font-family: monospace;
    font-size: 12px;
    color: #999;
}

.goods-name {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.goods-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.goods-thumb-placeholder {
    width: 48px;
    height: 48px;
    background: #f5f5f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 18px;
    flex-shrink: 0;
}

.name-text {
    font-weight: 500;
    color: #333;
    font-size: 13px;
    line-height: 1.4;
}

.brand-text {
    display: inline-block;
    font-size: 11px;
    color: #999;
    margin-right: 5px;
}

.tag-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    background: #f0f5ff;
    color: #1890ff;
    border-radius: 3px;
    margin-right: 4px;
}

.type-tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    background: #f5f5f5;
    border-radius: 3px;
}

.price-original {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.price-current {
    font-size: 14px;
    font-weight: 600;
    color: #e74c3c;
}

.discount-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 4px;
    background: #fff3e0;
    color: #e74c3c;
    border-radius: 2px;
    margin-left: 5px;
}

.stock-num {
    font-weight: 600;
    font-size: 13px;
}

.stock-low {
    color: #e74c3c;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.status-success {
    background: #e8f5e9;
    color: #4caf50;
}

.status-danger {
    background: #ffebee;
    color: #f44336;
}

.status-warning {
    background: #fff8e1;
    color: #ff9800;
}

.action-cell {
    white-space: nowrap;
}

/* 分页样式 */
.pagination-info {
    font-size: 13px;
    color: #999;
    margin-right: 10px;
}

/* 订单 Tab 切换 */
.mall-order-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 15px;
}

.mall-order-tab {
    padding: 8px 14px;
    border: none;
    background: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.mall-order-tab:hover {
    color: #666;
}

.mall-order-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* 订单表格样式 */
.order-no {
    font-family: monospace;
    font-size: 12px;
    color: #666;
}

.customer-name {
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.customer-phone {
    font-size: 12px;
    color: #999;
}

.order-items-cell {
    font-size: 12px;
    color: #666;
    max-width: 200px;
}

.order-item-line {
    padding: 2px 0;
}

.order-item-more {
    color: #1890ff;
    font-size: 11px;
}

.order-time {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

/* 状态颜色 */
.status-info {
    background: #e8f4fd;
    color: #2196f3;
}

.status-primary {
    background: #f3e5f5;
    color: #9c27b0;
}

.status-purple {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* 商城表单样式 */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: var(--header-height);
        bottom: 0;
        width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.collapsed {
        left: -260px;
        width: 260px;
    }

    .header-center {
        display: none;
    }

    /* 移动端侧边栏遮罩 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

    .sidebar.open ~ .sidebar-overlay,
    .sidebar-overlay.active {
        display: block;
    }

    /* 内容区在移动端占满 */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        overflow-x: auto;
    }

    /* 移动端筛选栏可滚动 */
    .card-body {
        overflow-x: auto;
    }

    /* 表格在移动端可横向滚动 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 800px;
    }
}
