/* ============================================
   跨境自动化ERP - 设计系统
   统一配色 / 深色模式 / 组件增强
   ============================================ */

/* ---- 设计变量 ---- */
:root {
    /* 主色调：科技蓝 + 电商橙 */
    --brand-primary: #2563eb;
    --brand-primary-dark: #1d4ed8;
    --brand-accent: #f97316;
    --brand-success: #16a34a;
    --brand-danger: #dc2626;
    --brand-warning: #d97706;

    /* 背景 */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;

    /* 文字 */
    --text-primary: #0f172a;
    --text-secondary: #64748b;

    /* 圆角/阴影 */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-card: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-hover: 0 10px 25px rgba(15,23,42,.12);
}

/* ---- 深色模式 ---- */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --shadow-card: 0 1px 3px rgba(0,0,0,.3);
    --shadow-hover: 0 10px 25px rgba(0,0,0,.4);
}

/* ---- 全局 ---- */
body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    transition: background .3s ease, color .3s ease;
}

.main-content {
    padding: 1.5rem !important;
}

/* ---- 侧边栏 ---- */
.sidebar {
    background: var(--bg-sidebar) !important;
}
.sidebar .nav-link {
    color: #94a3b8;
    border-radius: var(--radius-sm);
    margin: 2px 8px;
    font-size: .9rem;
    transition: all .2s;
}
.sidebar .nav-link:hover {
    color: #fff;
    background: var(--bg-sidebar-hover);
}
.sidebar .nav-link.active {
    color: #fff;
    background: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(37,99,235,.4);
}
.sidebar .nav-section {
    color: #475569;
    letter-spacing: .08em;
}

/* ---- 卡片 ---- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: box-shadow .25s ease, transform .25s ease;
    background: var(--bg-card);
}
.card:hover {
    box-shadow: var(--shadow-hover);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(100,116,139,.12);
    font-weight: 600;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.product-card img {
    transition: transform .3s ease;
}
.product-card:hover img {
    transform: scale(1.03);
}

/* ---- 统计卡片（看板） ---- */
.card.text-center .h4, .card.text-center .h5 {
    font-weight: 700;
}
.card.text-center.border-warning { border-left: 4px solid var(--brand-warning) !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }
.card.text-center.border-info { border-left: 4px solid #0891b2 !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }
.card.text-center.border-success { border-left: 4px solid var(--brand-success) !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }
.card.text-center.border-primary { border-left: 4px solid var(--brand-primary) !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }
.card.text-center.border-danger { border-left: 4px solid var(--brand-danger) !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }
.card.text-center.border-secondary { border-left: 4px solid var(--text-secondary) !important; border-top: none !important; border-right: none !important; border-bottom: none !important; }

/* ---- 表格 ---- */
.table {
    --bs-table-hover-bg: rgba(37,99,235,.04);
    color: var(--text-primary);
}
.table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(100,116,139,.15);
    background: rgba(100,116,139,.04);
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(37,99,235,.04); }

/* ---- 按钮 ---- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}
.btn-primary:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
}
.btn-success { background: var(--brand-success); border-color: var(--brand-success); }
.btn-warning { background: var(--brand-warning); border-color: var(--brand-warning); }
.btn-danger { background: var(--brand-danger); border-color: var(--brand-danger); }

/* ---- 徽章 ---- */
.badge {
    font-weight: 500;
    border-radius: 4px;
}

/* ---- 表单 ---- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: rgba(100,116,139,.25);
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 .2rem rgba(37,99,235,.15);
}

/* ---- 登录页 ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(249,115,22,.15) 0%, transparent 70%);
    top: -100px; right: -100px;
}
.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.2) 0%, transparent 70%);
    bottom: -80px; left: -80px;
}
.login-card {
    position: relative;
    z-index: 1;
    width: 400px;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.login-card .card-header {
    text-align: center;
    padding: 2rem 1rem 0;
    border: none;
}
.login-card .brand-logo {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---- 顶部导航 ---- */
.navbar {
    background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
}

/* ---- 主题切换按钮 ---- */
.theme-toggle {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    transition: all .2s;
}
.theme-toggle:hover {
    background: rgba(255,255,255,.2);
}

/* ---- 深色模式组件适配 ---- */
[data-theme="dark"] .table-light { background: #1e293b !important; color: #e2e8f0; }
[data-theme="dark"] .table-light th { background: #334155 !important; color: #e2e8f0; }
[data-theme="dark"] .bg-light { background: #1e293b !important; }
[data-theme="dark"] .text-muted { color: #94a3b8 !important; }
[data-theme="dark"] .breadcrumb { --bs-breadcrumb-divider-color: #64748b; }
[data-theme="dark"] .modal-content { background: #1e293b; }
[data-theme="dark"] .form-text { color: #94a3b8; }
[data-theme="dark"] hr { border-color: #334155; }

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.6); }

/* ---- 动画 ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.card, .alert, .modal-content { animation: fadeInUp .3s ease; }

/* ---- 帮助页代码块 ---- */
code {
    background: rgba(37,99,235,.08);
    color: var(--brand-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .85em;
}
[data-theme="dark"] code {
    background: rgba(37,99,235,.2);
    color: #93c5fd;
}
