/* 捷东CMS 后台样式（old 系统风：左侧通顶边栏 + 内容区上方顶栏）
 * 配色：青绿 #3bc0c3 / 侧栏深蓝 #1a2942 / 背景浅灰 #f1f5f7
 */
:root {
    --jd-primary:          #3bc0c3;
    --jd-primary-dark:     #2fa9ac;
    --jd-sidebar-bg:       #1a2942;
    --jd-sidebar-item:     #9aa8bf;
    --jd-sidebar-hover:    #ffffff;
    --jd-sidebar-active:   #3bc0c3;
    --jd-sidebar-active-bg: rgba(255, 255, 255, .08);
    --jd-body-bg:          #f1f5f7;
    --jd-topbar-bg:        #ffffff;
    --jd-topbar-h:         70px;
    --jd-sidebar-w:        240px;
    --jd-sidebar-w-sm:     70px;
    --jd-border:           #eef1f4;
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
}
body {
    background: var(--jd-body-bg);
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
        "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    margin: 0;
}

/* ===== 左侧通顶边栏 ===== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--jd-sidebar-w);
    background: var(--jd-sidebar-bg);
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}

.sidebar-brand {
    height: var(--jd-topbar-h);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1.1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
}
.brand-logo {
    height: 32px;
    width: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255, 255, 255, .08);
    flex-shrink: 0;
}
.brand-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3bc0c3, #1d8e91);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0;
}
.brand-text {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: .5px;
    line-height: 1.2;
}
.brand-text small {
    display: block;
    font-size: .7rem;
    font-weight: 400;
    color: var(--jd-sidebar-item);
    letter-spacing: 0;
}

/* ===== 侧边栏菜单 ===== */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .6rem .75rem 1rem;
}
.sidebar-menu ul,
.sidebar-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-menu li { position: relative; }
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .85rem;
    color: var(--jd-sidebar-item);
    text-decoration: none;
    border-radius: .35rem;
    transition: color .15s, background .15s;
    line-height: 1.4;
}
.sidebar-menu a:hover,
.sidebar-menu a:focus {
    color: var(--jd-sidebar-hover);
    background: rgba(255, 255, 255, .05);
}
.sidebar-menu .menu-icon {
    font-size: 1.1rem;
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-menu .menu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-menu .menu-arrow {
    font-size: .75rem;
    opacity: .7;
    transition: transform .2s;
    flex-shrink: 0;
}

/* 激活态 */
.sidebar-menu .active > a,
.sidebar-menu li.active > a,
.sidebar-menu a.active {
    color: var(--jd-sidebar-active);
    background: var(--jd-sidebar-active-bg);
}
.sidebar-menu .open > a .menu-arrow { transform: rotate(90deg); }

/* 子菜单 */
.sidebar-menu .submenu {
    display: none;
    padding-left: 1.1rem;
    margin-top: .15rem;
}
.sidebar-menu .open > .submenu { display: block; }
.sidebar-menu .submenu a {
    padding: .5rem .85rem .5rem 2.2rem;
    font-size: .875rem;
}
.sidebar-menu .submenu .menu-icon { display: none; }

/* ===== 顶栏（仅覆盖内容区） ===== */
.app-topbar {
    position: fixed;
    top: 0;
    left: var(--jd-sidebar-w);
    right: 0;
    height: var(--jd-topbar-h);
    background: var(--jd-topbar-bg);
    border-bottom: 1px solid var(--jd-border);
    box-shadow: 0 1px 3px rgba(20, 30, 50, .05);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
}
.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #555;
    padding: .25rem .4rem;
    line-height: 1;
}
.sidebar-toggle:hover { color: var(--jd-primary); }
.topbar-right {
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* ===== 主内容区 ===== */
.app-main {
    margin-left: var(--jd-sidebar-w);
    padding-top: var(--jd-topbar-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.app-main > .container-fluid {
    flex: 1;
    padding: 1.25rem;
}

/* ===== 页脚 ===== */
.app-footer {
    padding: 1rem 1.25rem;
    color: #888;
    font-size: .8rem;
    text-align: center;
    border-top: 1px solid var(--jd-border);
    background: #fff;
}

/* ===== 移动端 ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1035;
    display: none;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-topbar { left: 0; }
    .app-main { margin-left: 0; }
}
@media (min-width: 992px) {
    .sidebar-overlay { display: none !important; }
}

/* ===== Bootstrap 主题覆盖 ===== */
.btn-primary {
    --bs-btn-bg: var(--jd-primary);
    --bs-btn-border-color: var(--jd-primary);
    --bs-btn-hover-bg: var(--jd-primary-dark);
    --bs-btn-hover-border-color: var(--jd-primary-dark);
    --bs-btn-active-bg: var(--jd-primary-dark);
    --bs-btn-active-border-color: var(--jd-primary-dark);
}
.btn-outline-primary {
    --bs-btn-color: var(--jd-primary);
    --bs-btn-border-color: var(--jd-primary);
    --bs-btn-hover-bg: var(--jd-primary);
    --bs-btn-hover-border-color: var(--jd-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--jd-primary);
    --bs-btn-active-border-color: var(--jd-primary);
    --bs-btn-active-color: #fff;
}
.text-primary { color: var(--jd-primary) !important; }

/* ===== 卡片 ===== */
.card {
    border: none;
    border-radius: .5rem;
    box-shadow: 0 1px 3px rgba(20, 30, 50, .06);
    background: #fff;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--jd-border);
    font-weight: 600;
    border-radius: .5rem .5rem 0 0 !important;
    padding: 1rem 1.25rem;
}

/* ===== 表格（旧系统浅灰表头） ===== */
.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}
.table thead th {
    background: #f8f9fa;
    font-size: .8rem;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid var(--jd-border);
    padding: .75rem .85rem;
    white-space: nowrap;
}
.table tbody td {
    padding: .75rem .85rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--jd-border);
    color: #444;
}
.table tbody tr:last-child td { border-bottom: none; }
.table td .btn { white-space: nowrap; }

/* ===== 统计卡片 ===== */
.stat-card {
    border-left: 4px solid var(--jd-primary);
    background: #fff;
    padding: 1.25rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: #1a2942; }
.stat-card .stat-label { color: #70809a; font-size: .9rem; }

/* ===== 徽标 ===== */
.badge-soft-primary {
    background: rgba(59, 192, 195, .12);
    color: var(--jd-primary-dark);
}

/* ===== 登录页（分屏） ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: #fff;
}
.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}
.login-visual {
    flex: 1;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #fff;
    background: linear-gradient(135deg, #1a2942 0%, #2a3c5e 50%, #1a2942 100%);
    position: relative;
}
.login-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233bc0c3' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: .6;
}
.login-visual-content {
    position: relative;
    z-index: 1;
}
.login-visual h2 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: .5rem;
}
.login-visual p { opacity: .7; margin: 0; }

.login-form-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #fff;
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}
.login-card h4 {
    color: #444;
    font-weight: 500;
    margin-bottom: 1.75rem;
}
.login-card .form-label {
    color: #666;
    font-size: .875rem;
    margin-bottom: .35rem;
}
.login-card .form-control {
    border-color: #e2e5e8;
    padding: .65rem .9rem;
}
.login-card .form-control:focus {
    border-color: var(--jd-primary);
    box-shadow: 0 0 0 .2rem rgba(59, 192, 195, .15);
}
.login-card .btn-primary {
    padding: .65rem;
    font-size: .95rem;
}
.login-footer {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #999;
    font-size: .8rem;
}

@media (min-width: 768px) {
    .login-visual { display: flex; }
    .login-form-area { flex: 0 0 55%; max-width: 600px; }
}
@media (min-width: 1200px) {
    .login-form-area { flex: 0 0 480px; }
}

/* ===== 统一操作提示 toast（替代原生 alert） ===== */
.jd-toast-wrap {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}
.jd-toast {
    min-width: 220px;
    max-width: 360px;
    padding: .75rem 1rem;
    border-radius: .5rem;
    color: #fff;
    font-size: .875rem;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(20, 30, 50, .18);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: auto;
}
.jd-toast.show { opacity: 1; transform: translateX(0); }
.jd-toast.success { background: #2fa9ac; }
.jd-toast.error   { background: #e25563; }
.jd-toast.info    { background: #5b7fb5; }
.jd-toast.warning { background: #e0a458; }

/* ===== 移动端：表格 → 卡片（窄屏 ≤ 767.98px 时启用） ===== */
/* 视图侧只需：<table class="table-card-mobile"> + 每个 <td data-label="列名"> */
@media (max-width: 767.98px) {
    /* mobile 不再横滚：解除水平滚动容器对内部 table 的限制 */
    .table-responsive { overflow-x: visible !important; }

    .table-card-mobile {
        border: 0;
        border-collapse: separate;
        border-spacing: 0;
    }
    .table-card-mobile thead { display: none; }

    .table-card-mobile,
    .table-card-mobile tbody,
    .table-card-mobile tr,
    .table-card-mobile td {
        display: block;
        width: 100% !important;
    }

    .table-card-mobile tbody tr {
        background: #fff;
        border: 1px solid var(--jd-border);
        border-radius: .5rem;
        margin-bottom: .75rem;
        padding: .35rem .85rem;
        box-shadow: 0 1px 3px rgba(20, 30, 50, .06);
    }

    .table-card-mobile td {
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .55rem 0;
        border: 0;
        border-bottom: 1px solid #f1f3f5;
        white-space: normal;
    }
    .table-card-mobile td:last-child {
        border-bottom: 0;
        padding-top: .65rem;
    }

    /* 列名作为左标签，宽度固定 5rem，右边是字段值 */
    .table-card-mobile td::before {
        content: attr(data-label);
        flex: 0 0 5rem;
        color: #70809a;
        font-size: .8rem;
        font-weight: 600;
    }

    /* 操作列：右侧排列，按钮小一号；隐藏列名标签 */
    .table-card-mobile td.text-end {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .table-card-mobile td.text-end::before { display: none; }

    .table-card-mobile .btn-sm {
        padding: .25rem .55rem;
        font-size: .8rem;
    }
}

/* ===== 绉诲姩绔細鏄庣粏琛ㄥ悎璁¤锛堚墹767.98锛夊崱鐗囧寲閫傞厤 ===== */
@media (max-width: 767.98px) {
    .table-card-mobile tfoot tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: .65rem .9rem;
        margin-top: .25rem;
        background: #f7f9fc;
        border: 1px solid #e2e8ee;
        border-radius: .5rem;
        box-shadow: 0 1px 3px rgba(20, 30, 50, .06);
    }
    .table-card-mobile tfoot th {
        display: inline-block !important;
        width: auto !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    .table-card-mobile tfoot th:first-child {
        color: #475569;
        font-weight: 600;
    }
}