/* ===== 电商数据分析平台 H5 全局样式 ===== */

:root {
    --primary-color: #2c7a5e;
    --primary-dark: #1a3d33;
    --secondary-color: #4a9e7a;
    --accent-color: #6bcf7f;
    --light-bg: #e8f5f0;
    --sidebar-width: 240px;
    --page-bg: #f4f7f6;
    --text-main: #2c3e3a;
    --text-muted: #6c7a76;
    --border-color: #e2eae7;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif;
    background-color: var(--page-bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ===== 布局骨架 ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== 侧边栏 ===== */
/* 用 .row > .sidebar 提高优先级，覆盖 Bootstrap col-md-2 的栅格宽度 */
.row > .sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    max-width: var(--sidebar-width);
    padding: 0;
    background: linear-gradient(180deg, #1a3d33 0%, #2c7a5e 100%);
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, .12);
    z-index: 100;
}

.row > .main-content {
    flex: 1;
    min-width: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 26px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.sidebar-header h4 {
    color: #ffffff;
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    letter-spacing: .5px;
}

.sidebar-header .sub {
    color: rgba(255, 255, 255, .6);
    font-size: 12px;
    margin-top: 6px;
}

.sidebar .nav {
    flex-direction: column;
    padding: 16px 0;
    margin: 0;
    gap: 2px;
    list-style: none;
}

.sidebar .nav-item {
    list-style: none;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, .82) !important;
    padding: 13px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: all .18s ease;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, .1);
    color: #ffffff !important;
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, .18);
    color: #ffffff !important;
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

/* ===== 主内容区 ===== */
.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 顶部条（页面里用的是 Bootstrap navbar） */
.main-content > .navbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.main-content > .navbar .nav-link {
    font-size: 13px;
    color: var(--text-muted) !important;
    padding: 4px 12px;
}

.main-content > .navbar .nav-link:hover {
    color: var(--primary-color) !important;
}

/* 内容区 */
.section {
    padding: 24px 26px 40px;
    flex: 1;
}

.section > .container {
    max-width: 100%;
    padding: 0;
}

/* ===== 章节标题 ===== */
.section-title {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

/* ===== 卡片 ===== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(26, 61, 51, .07);
    margin-bottom: 20px;
    background: #fff;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-dark);
    padding: 14px 18px;
}

.card-header h5, .card-header h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

/* ===== 数据卡片 ===== */
.data-card {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(26, 61, 51, .07);
    border-left: 4px solid var(--primary-color);
}

.data-card h6 {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 8px;
    font-weight: 500;
}

.data-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.data-card .change {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===== 统计渐变卡片 ===== */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(44, 122, 94, .22);
}

.stats-card h3 {
    font-size: 13px;
    margin: 0 0 8px;
    opacity: .88;
    font-weight: 500;
}

.stats-card .big-number {
    font-size: 26px;
    font-weight: 700;
}

.stats-card .small-number {
    font-size: 12px;
    opacity: .85;
    margin-top: 4px;
}

/* ===== 表格 ===== */
.table {
    margin-bottom: 0;
    font-size: 14px;
}

.table thead th {
    background-color: var(--light-bg);
    color: var(--primary-dark);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 13px;
}

.table td {
    vertical-align: middle;
    border-color: var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(107, 207, 127, .1);
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: #d7ece3 !important;
}

/* ===== 按钮 ===== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ===== AI 分析 ===== */
.ai-overview-card {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 14px 16px;
}

.ai-overview-card h6 {
    color: var(--primary-dark);
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
}

.ai-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-success { background-color: #d4edda; color: #155724; }
.status-info { background-color: #d1ecf1; color: #0c5460; }
.status-warning { background-color: #fff3cd; color: #856404; }
.status-danger { background-color: #f8d7da; color: #721c24; }

.ai-analysis {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.ai-analysis h6 {
    color: var(--primary-color);
    font-size: 14px;
    margin: 0 0 10px;
    font-weight: 600;
}

.ai-analysis .result {
    background-color: #ffffff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.ai-analysis .result p {
    margin: 0 0 6px;
    font-size: 13.5px;
}

.ai-analysis .result p:last-child {
    margin-bottom: 0;
}

.ai-analysis ul {
    margin: 0;
    padding-left: 20px;
}

.ai-analysis li {
    font-size: 13.5px;
    margin-bottom: 6px;
    color: var(--text-main);
}

/* ===== 图表容器 ===== */
.chart-container {
    position: relative;
    height: 300px;
}

/* ===== 数据上传 ===== */
.upload-panel .form-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.upload-panel .card {
    margin-bottom: 0;
    height: 100%;
}

/* ===== 欢迎区 ===== */
.welcome-section {
    margin-bottom: 26px;
}

.welcome-section h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0 0 8px;
}

.welcome-section p {
    color: var(--text-muted);
    margin: 0;
    font-size: 14px;
}

/* ===== 快速访问卡片 ===== */
.quick-access-card {
    transition: transform .18s ease, box-shadow .18s ease;
    height: 100%;
}

.quick-access-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(26, 61, 51, .14);
}

.card-icon {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.quick-access-card .card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.quick-access-card .card-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* ===== 通知 ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    animation: slideIn .25s ease;
}

.notification.info { background-color: #0d6efd; }
.notification.success { background-color: #198754; }
.notification.danger { background-color: #dc3545; }
.notification.warning { background-color: #ffc107; color: #333; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== 响应式：窄屏侧边栏收窄 ===== */
@media (max-width: 992px) {
    :root { --sidebar-width: 68px; }
    .sidebar-header h4,
    .sidebar-header .sub { display: none; }
    .sidebar .nav-link {
        justify-content: center;
        padding: 14px 10px;
        font-size: 0;
        gap: 0;
    }
    .sidebar .nav-link i { font-size: 17px; }
    .section { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 576px) {
    .section { padding: 16px 12px 30px; }
    .data-card .value { font-size: 20px; }
    .stats-card .big-number { font-size: 22px; }
}