/* 现代后台风格 - 全局样式 */

/* ============================================
   1. 基础样式重置与全局设置
   ============================================ */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 14px;
    line-height: 1.5715;
    color: rgba(0, 0, 0, 0.85);
    background-color: #f6f7fb;
    margin: 0;
    padding: 0;
}

.min-vh-100 {
    min-height: 100vh;
}

/* ============================================
   2. 页面容器
   ============================================ */

.page-container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

.container {
    max-width: 1200px;
    padding-left: 16px;
    padding-right: 16px;
}

/* ============================================
   3. 页面标题与说明样式
   ============================================ */

h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 18px;
    color: rgba(0, 0, 0, 0.85);
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 18px;
    line-height: 1.2;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px;
    color: rgba(0, 0, 0, 0.85);
}

.hint {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.page-description {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    color: rgba(0, 0, 0, 0.65);
}

.page-description strong {
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
}

/* ============================================
   4. 卡片样式统一
   ============================================ */

.card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(20, 20, 20, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 18px;
    margin-bottom: 24px;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0 0 12px 0;
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.85);
}

.card-body {
    padding: 0;
}

/* ============================================
   5. KPI 卡片样式
   ============================================ */

.kpi-grid {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .kpi-grid {
        flex-direction: column;
    }
}

.kpi {
    flex: 1;
    min-height: 120px;
    padding: 32px 24px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.kpi:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    font-weight: 500;
}

.kpi-value {
    font-size: 28px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin: 0;
    line-height: 1.2;
}

.kpi-unit {
    display: none;
}

.kpi-income .kpi-value {
    color: #1677ff;
}

.kpi-expense .kpi-value {
    color: #ff4d4f;
}

.kpi-gmv .kpi-value {
    color: #5b8ff9;
}

.kpi-gmv .kpi-label::after {
    content: "（仅展示）";
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 4px;
}

.kpi-emphasis {
    background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
    border: 1px solid rgba(24, 144, 255, 0.2);
}

/* ============================================
   6. 金额颜色规范
   ============================================ */

.money-pos {
    color: #52c41a !important;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.money-neg {
    color: #ff4d4f !important;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.money-zero {
    color: #6b7280 !important;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.text-success {
    color: #52c41a !important;
    font-weight: 600;
}

.text-danger {
    color: #ff4d4f !important;
    font-weight: 600;
}

.text-primary {
    color: #1890ff !important;
    font-weight: 600;
}

/* ============================================
   7. 按钮样式规范
   ============================================ */

/* 主操作按钮（蓝色实心） */
.btn-primary,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active {
    background-color: #1890ff;
    border-color: #1890ff;
    color: #ffffff;
    font-weight: 500;
    height: 36px;
    padding: 6px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    border: none;
}

.btn-primary:hover:not(:disabled):not(.disabled) {
    background-color: #40a9ff;
    border-color: #40a9ff;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

.btn-primary:focus:not(:disabled):not(.disabled) {
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.2);
}

/* 次操作按钮（灰色描边） */
.btn-secondary,
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-secondary:not(:disabled):not(.disabled).active {
    background-color: #ffffff;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
    height: 36px;
    padding: 6px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-secondary:hover:not(:disabled):not(.disabled) {
    background-color: #fafafa;
    border-color: #40a9ff;
    color: #40a9ff;
}

.btn-secondary:focus:not(:disabled):not(.disabled) {
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

/* 危险操作按钮（默认浅灰，hover 变红） */
.btn-danger,
.btn-danger:not(:disabled):not(.disabled):active,
.btn-danger:not(:disabled):not(.disabled).active {
    background-color: #ffffff;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.65);
    font-weight: 500;
    height: 36px;
    padding: 6px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-danger:hover:not(:disabled):not(.disabled) {
    background-color: #ff4d4f;
    border-color: #ff4d4f;
    color: #ffffff;
}

.btn-danger:focus:not(:disabled):not(.disabled) {
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.2);
}

/* 小按钮 */
.btn-sm {
    height: 28px;
    padding: 4px 12px;
    font-size: 13px;
}

/* 成功按钮（导出等） */
.btn-success,
.btn-success:not(:disabled):not(.disabled):active,
.btn-success:not(:disabled):not(.disabled).active {
    background-color: #1890ff;
    border-color: #1890ff;
    color: #ffffff;
}

.btn-success:hover:not(:disabled):not(.disabled) {
    background-color: #40a9ff;
    border-color: #40a9ff;
    color: #ffffff;
}

/* 链接样式按钮 */
.btn-link {
    background: none;
    border: none;
    color: #1890ff;
    padding: 0;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.btn-link:hover {
    color: #40a9ff;
    text-decoration: underline;
}

/* ============================================
   8. 表格样式统一
   ============================================ */

.table-wrap {
    overflow-x: auto;
    border-radius: 8px;
}

.table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table thead th {
    background-color: #f3f4f6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    padding: 12px;
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
}

.table thead.sticky-top th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f3f4f6;
}

.table-bordered {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 金额列右对齐 */
.table .text-end,
.table .text-right {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* 操作列样式 */
.table td:last-child {
    white-space: nowrap;
    width: 100px;
}

/* ============================================
   9. 表单样式规范
   ============================================ */

.form-label {
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 6px;
    display: block;
    font-size: 14px;
}

.form-control,
.form-select {
    height: 36px;
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
    border-color: #40a9ff;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
    outline: 0;
}

.form-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 18px;
}

/* ============================================
   10. 说明文字样式（Alert）
   ============================================ */

.alert {
    border-radius: 8px;
    border: 1px solid;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.alert-info {
    background-color: #e6f7ff;
    border-color: #91d5ff;
    color: rgba(0, 0, 0, 0.85);
}

.alert-info strong {
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
}

.alert-warning {
    background-color: #fffbe6;
    border-color: #ffe58f;
    color: rgba(0, 0, 0, 0.85);
}

.alert-danger {
    background-color: #fff2f0;
    border-color: #ffccc7;
    color: rgba(0, 0, 0, 0.85);
}

.alert-success {
    background-color: #f6ffed;
    border-color: #b7eb8f;
    color: rgba(0, 0, 0, 0.85);
}

/* ============================================
   11. 徽章样式（Badge/Tag）
   ============================================ */

.badge {
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    display: inline-block;
}

.bg-success {
    background-color: #52c41a;
    color: #ffffff;
}

.bg-warning {
    background-color: #faad14;
    color: #ffffff;
}

.bg-primary {
    background-color: #1890ff;
    color: #ffffff;
}

.bg-info {
    background-color: #1890ff;
    color: #ffffff;
}

/* ============================================
   12. 导航栏样式优化
   ============================================ */

.navbar {
    height: 52px;
    padding: 0 16px;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 600;
    font-size: 16px;
    color: #ffffff !important;
}

.navbar-dark .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s;
}

.navbar-dark .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.navbar-text {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 13px;
}

/* ============================================
   13. Toast 消息样式
   ============================================ */

.toast {
    min-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-header {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 500;
    padding: 12px 16px;
}

.toast-body {
    background-color: #ffffff;
    padding: 12px 16px;
}

/* ============================================
   14. 加载状态样式
   ============================================ */

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.25em;
}

/* ============================================
   15. 容器与间距
   ============================================ */

.mb-3 {
    margin-bottom: 16px !important;
}

.mb-4 {
    margin-bottom: 24px !important;
}

.mt-3 {
    margin-top: 16px !important;
}

.mt-4 {
    margin-top: 24px !important;
}

/* ============================================
   16. 工具类
   ============================================ */

.text-muted {
    color: #6b7280 !important;
}

.text-center {
    text-align: center !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.gap-2 {
    gap: 8px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-grow-1 {
    flex-grow: 1;
}

/* ============================================
   17. 特定页面优化
   ============================================ */

/* 汇总卡片样式（兼容旧代码） */
.summary-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
}

.summary-card h6 {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-card h3 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 14px;
}

/* 折叠面板 */
.collapsible {
    cursor: pointer;
    user-select: none;
}

.collapsible-content {
    display: none;
    margin-top: 18px;
}

.collapsible-content.show {
    display: block;
}

/* 响应式 */
@media (max-width: 1366px) {
    .page-container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 16px;
    }
}

@media (max-width: 768px) {
    h1, .page-title {
        font-size: 24px;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .card {
        padding: 14px;
    }
}
