/* 页面头部行（返回按钮 + 标题） */
.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;
}

.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;
}

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

/* 树形菜单头部（可点击展开） */
.menu-tree-header {
    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;
}

.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 {
    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;
}

.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;
}

.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 {
    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 {
    justify-content: center;
    padding: 11px 0;
}

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

.sidebar.collapsed .menu-tree-item {
    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;
}

/* 商品表格样式 */
.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;
    }
}
