/* ============================================================
   供应商管理系统 全局样式
   说明：本文件控制整个系统的外观（颜色、字体、间距）
   ============================================================ */

/* ---------- 1. 字体：使用 D:\字体 文件夹里的阿里普惠体（免费商用字体） ---------- */
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/fonts/AlibabaPuHuiTi-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/fonts/AlibabaPuHuiTi-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'AlibabaPuHuiTi';
    src: url('/fonts/AlibabaPuHuiTi-Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

/* 全局字体设置：改了这里，整个系统的字体都跟着变 */
html {
    font-size: 14px;
}

body {
    font-family: 'AlibabaPuHuiTi', 'Microsoft YaHei', sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    min-height: 100vh;
}

/* ---------- 2. 侧边栏导航 ---------- */
.sidebar {
    width: 220px;
    background: #1e3a5f;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 10px;
    overflow-y: auto;
    z-index: 100;
}
.sidebar .brand {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    padding: 14px 18px 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: block;
}
.sidebar .nav-link {
    color: #c7d3e0;
    padding: 10px 18px;
    font-size: 14px;
    display: block;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.sidebar .nav-link.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: #4da3ff;
}

/* 主内容区（给左侧固定侧边栏让出位置） */
.main-content {
    margin-left: 220px;
    padding: 20px 24px;
    min-height: 100vh;
}

/* 顶部条 */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e3e8ef;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- 3. 页面通用卡片 ---------- */
.page-card {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

/* ---------- 4. 表格：支持调整列宽 ---------- */
/* 每个 <th> 右边出现拖拽把手，拖动能调列宽 */
.table-wrap {
    overflow-x: auto;
}
table.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}
table.data-table th {
    background: #f0f4f9;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #d7e0ea;
    padding: 9px 10px;
    white-space: nowrap;
    position: relative;
    user-select: none;
}
table.data-table td {
    border-bottom: 1px solid #edf1f6;
    padding: 8px 10px;
    vertical-align: middle;
}
/* 鼠标所在行高亮：淡蓝色背景 + 平滑过渡（0.2秒渐变，不突兀） */
table.data-table tbody tr {
    transition: background-color 0.2s ease;
}
table.data-table tbody tr:hover {
    background: #eaf2fb;
}

/* 列宽拖拽把手 */
th.resizable {
    position: relative;
}
th.resizable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
}

/* ---------- 5. 状态徽章颜色 ---------- */
.badge-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.badge-green { background: #e7f7ee; color: #1a7f4b; }
.badge-blue  { background: #e8f1fe; color: #1d63c9; }
.badge-orange{ background: #fff3e2; color: #b25e09; }
.badge-red   { background: #fdeaea; color: #c0392b; }
.badge-gray  { background: #eef1f4; color: #64748b; }

/* ---------- 6. 统计卡片（仪表盘） ---------- */
.stat-card {
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}
.stat-card .num {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
}
.stat-card .label {
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- 7. 提示条 ---------- */
.alert-msg {
    margin-bottom: 14px;
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8e 100%);
}
.login-box {
    width: 360px;
    background: #fff;
    border-radius: 10px;
    padding: 34px 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 分页 */
.pagination .page-link {
    color: #1e3a5f;
}
.pagination .page-item.active .page-link {
    background: #1e3a5f;
    border-color: #1e3a5f;
}

/* 按钮统一 */
.btn-primary {
    background-color: #1e3a5f;
    border-color: #1e3a5f;
}
.btn-primary:hover {
    background-color: #16304e;
    border-color: #16304e;
}

/* ---------- 8. 品牌多选下拉（带搜索） ---------- */
.ms-wrap {
    position: relative;
}
.ms-box {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 6px 10px;
    min-height: 38px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-panel {
    display: none;
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d7e0ea;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 8px;
    z-index: 999;
}
.ms-list {
    max-height: 180px;
    overflow-y: auto;
}
.ms-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}
.ms-item:hover {
    background: #f0f4f9;
}

/* ---------- 9. 搜索下拉（供应商/品牌等选项多时用） ---------- */
.ss-wrap {
    position: relative;
}
.ss-input {
    cursor: pointer;
}
.ss-panel {
    display: none;
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d7e0ea;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 6px;
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
}
.ss-item {
    padding: 6px 8px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}
.ss-item:hover {
    background: #eaf2fb;
    color: #1e3a5f;
}

/* ============================================================
   10. 多附件上传区（新增/编辑表单页）
   ============================================================ */
.att-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}
.att-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 10px 0 2px;
}
.att-list {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.att-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #d7e0ea;
    border-radius: 6px;
    background: #f8fafc;
    font-size: 13px;
}
.att-tag {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 500;
    color: #1e3a5f;
    background: #eaf2fb;
    border-radius: 4px;
    padding: 1px 6px;
}
.att-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1e3a5f;
}
.att-size {
    flex: 0 0 auto;
    font-size: 12px;
    color: #94a3b8;
}
.att-del {
    flex: 0 0 auto;
    border: 1px solid #f0c4c0;
    background: #fff;
    color: #c0392b;
    border-radius: 4px;
    font-size: 12px;
    padding: 2px 8px;
    cursor: pointer;
}
.att-del:hover {
    background: #fdf1f0;
}

/* 已有附件（编辑态勾选删除） */
.att-existing {
    margin-top: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fbfcfe;
}
.att-existing-title {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
}
.att-exist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 3px 0;
    cursor: pointer;
}
.att-exist-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.att-exist-size {
    flex: 0 0 auto;
    font-size: 12px;
    color: #94a3b8;
}

/* ============================================================
   11. 附件查看弹层（列表页）
   ============================================================ */
.attach-count {
    font-size: 13px;
    color: #1e3a5f;
    font-weight: 500;
    margin-bottom: 10px;
}
.attach-body {
    display: flex;
    gap: 14px;
    min-height: 260px;
}
.attach-list {
    flex: 0 0 210px;
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.attach-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
}
.attach-item:hover {
    background: #f0f7ff;
}
.attach-item.active {
    border-color: #1d63c9;
    background: #f0f7ff;
}
.attach-thumb {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1px solid #d7e0ea;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-item.active .attach-thumb {
    border-color: #1d63c9;
    color: #1d63c9;
}
.attach-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.attach-name {
    font-size: 13px;
    color: #1e3a5f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.attach-sub {
    font-size: 12px;
    color: #94a3b8;
}
.attach-detail {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fbfcfe;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.attach-preview-img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 4px;
}
.attach-nopreview {
    width: 56px;
    height: 64px;
    border: 1px solid #d7e0ea;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-pos {
    font-size: 13px;
    color: #64748b;
    min-width: 52px;
    text-align: center;
}
@media (max-width: 768px) {
    .attach-body {
        flex-direction: column;
    }
    .attach-list {
        flex: 1 1 auto;
        max-height: 160px;
    }
}
