/* ==================== 全局样式 ==================== */
:root {
    --primary-color: #2B579A;
    --primary-light: #3B6BB5;
    --primary-dark: #1E3F70;
    --alert-color: #dc3545;
    --alert-bg: #fff5f5;
    --warning-color: #f0ad4e;
    --success-color: #28a745;
    --bg-color: #f5f7fa;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
}

/* ==================== 导航栏 ==================== */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.navbar-custom .navbar-brand {
    font-weight: 600;
    font-size: 1.2rem;
}

.nav-text {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ==================== 登录页 ==================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3F70 0%, #2B579A 50%, #3B6BB5 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 35px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.login-header h3 {
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 5px;
}

.btn-login {
    padding: 10px;
    font-size: 1rem;
    font-weight: 500;
    background: var(--primary-color);
    border: none;
}

.btn-login:hover {
    background: var(--primary-dark);
}

/* ==================== 卡片 ==================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0 !important;
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 4px;
}

.stat-blue { background: linear-gradient(135deg, #2B579A, #3B6BB5); }
.stat-red { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.stat-green { background: linear-gradient(135deg, #1e8449, #27ae60); }
.stat-orange { background: linear-gradient(135deg, #d68910, #f39c12); }

/* ==================== 比价表格 ==================== */
.comparison-table {
    font-size: 0.9rem;
}

.comparison-table th {
    background: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
    padding: 10px 12px;
}

.comparison-table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.comparison-table .alert-row {
    background: var(--alert-bg) !important;
}

.comparison-table .alert-row td:first-child {
    border-left: 3px solid var(--alert-color);
}

.diff-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.diff-badge.high {
    background: #fde8e8;
    color: #c0392b;
}

.diff-badge.normal {
    background: #e8f5e9;
    color: #27ae60;
}

.diff-badge.none {
    background: #fff3cd;
    color: #856404;
}

/* ==================== 部门标签 ==================== */
.dept-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e8eaf6;
    color: #3f51b5;
}

/* ==================== 录入页面 ==================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.product-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(43, 87, 154, 0.15);
}

.product-card.active {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.product-card .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.product-card .unit {
    font-size: 0.8rem;
    color: #888;
}

.product-card .entered {
    font-size: 0.75rem;
    color: var(--success-color);
}

/* ==================== 分类筛选 ==================== */
.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.category-tab {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.category-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==================== 手机端适配 ==================== */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .comparison-table {
        font-size: 0.85rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 6px;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .nav-text {
        display: none;
    }

    /* 表格横向滚动 */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ==================== 趋势图 ==================== */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* ==================== 搜索框 ==================== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 35px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

/* ==================== 日期选择器 ==================== */
.date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-picker input[type="date"] {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* ==================== 加载中 ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
