/* 
 * pages.css - 页面特定样式 
 * 包含：登录页、仪表盘独有样式、账户/智投页面的布局调整
 */

/* --- 登录页 (Login) --- */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('https://s1.hdslb.com/bfs/static/jinkela/long/images/login_bg.png') no-repeat center center;
    background-size: cover;
    position: relative;
}

/* 叠加一层模糊遮罩，如果背景加载失败则显示渐变 */
.login-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(35, 173, 229, 0.2) 0%, rgba(251, 114, 153, 0.2) 100%);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.login-box {
    position: relative;
    z-index: 2;
    width: 400px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(0);
    animation: floatIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(135deg, #23ADE5 0%, #FB7299 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-box .btn-primary {
    width: 100%;
    height: 44px;
    font-size: 16px;
    margin-top: 10px;
}

/* --- 仪表盘 (Dashboard) --- */

/* 指标卡片网格 */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.metrics-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.metric-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    /* 颜色由 theme 类控制 */
    background: var(--theme-bg, rgba(0, 0, 0, 0.05));
    color: var(--theme-color, #666);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.metric-change {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-change.positive {
    color: var(--success-color);
}

.metric-change.negative {
    color: var(--danger-color);
}

.metric-change.neutral {
    color: var(--text-secondary);
}

/* 图表容器 */
.chart-container-wrapper {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    height: 400px;
    /* 固定高度确保一致 */
    margin-top: 24px;
}

/* 月份选择下拉框 */
.month-select {
    padding: 6px 28px 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid transparent;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E8E93' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    min-width: 110px;
    transition: all 0.2s;
}

.month-select:hover {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.08);
}

.month-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.month-select option {
    padding: 8px 12px;
}

/* --- 智投页面 / 账户页面 布局调整 --- */

/* 头部操作栏 (Filter Bar / Toolbar) */
.card-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 批量操作栏优化 */
.batch-actions-bar {
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 客户统计 */
.customer-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.customer-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(35, 173, 229, 0.3);
}

.customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

/* --- 客户统计详情样式 --- */
.customer-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-change {
    font-size: 12px;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* 客户卡片展开状态 */
.customer-card.expanded {
    border-color: rgba(35, 173, 229, 0.3);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-md);
}

.account-detail-table {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    display: none;
    overflow-x: auto;
}

.customer-card.expanded .account-detail-table {
    display: block;
}

.account-row {
    display: grid;
    grid-template-columns: 110px minmax(180px, 2fr) 120px 120px 120px 120px 120px 100px 160px;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    transition: background 0.1s;
}

.account-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.account-row:last-child {
    border-bottom: none;
}

.account-row-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    padding: 8px 16px;
}

.account-row>div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-id {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

/* 数字右对齐 */
.account-cash-balance,
.account-red-packet-balance,
.account-total-balance,
.account-spend-today,
.account-spend-yesterday {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.account-row-header>div:nth-child(3),
.account-row-header>div:nth-child(4),
.account-row-header>div:nth-child(5),
.account-row-header>div:nth-child(6),
.account-row-header>div:nth-child(7) {
    text-align: right;
}

.account-row-header>div:nth-child(8) {
    text-align: center;
}

@media (max-width: 1024px) {
    .metrics-grid,
    .metrics-grid.cols-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .customer-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid.cols-5 {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 24px;
    }

    .chart-container-wrapper {
        height: 320px;
        padding: 14px;
    }

    .batch-actions-bar {
        flex-wrap: wrap;
        padding: 10px 12px;
    }

    .customer-stats-grid {
        grid-template-columns: 1fr;
    }

    .account-row {
        min-width: 980px;
    }
}

/* --- 操作日志 (Action Logs) --- */
.action-logs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
    position: relative;
}

/* --- 页面级移动端精修：仪表盘 + 客户统计 --- */
@media (max-width: 768px) {
    .page-dashboard #globalMonthSelect {
        min-width: 120px !important;
        margin-right: 0 !important;
    }

    .page-dashboard #syncBtn {
        margin-right: 0 !important;
    }

    .page-dashboard .user-area {
        align-items: center;
    }

    .page-dashboard .card-body[style*="height: 420px"],
    .page-dashboard .card-body[style*="height: 450px"] {
        height: 320px !important;
        padding: 12px !important;
    }

    .page-dashboard #customerRankingContainer table {
        min-width: 560px;
    }

    .page-account-stats .customer-name {
        font-size: 16px;
        line-height: 1.35;
    }

    .page-account-stats .customer-account-count {
        font-size: 12px;
    }

    .page-account-stats .stat-value {
        font-size: 16px;
    }

    .page-account-stats .account-row > div::before {
        min-width: 62px;
    }
}

/* 垂直时间线 */
.action-logs-list::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 24px;
    bottom: 24px;
    width: 2px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 0;
}

.action-log-item {
    display: flex;
    flex-direction: column;
    padding-left: 36px;
    position: relative;
    transition: all 0.2s;
}

/* 时间线圆点 */
.action-log-item::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--dot-color, #8E8E93);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 1);
    z-index: 1;
}

.action-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.action-log-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}

.action-log-owners {
    font-weight: 600;
    color: var(--text-primary);
}

.action-log-unit-id {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.action-log-unit-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.action-log-time {
    font-size: 12px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.action-log-body {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-log-content {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
}

.action-log-metrics {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}

.action-log-separator {
    color: rgba(0, 0, 0, 0.1);
}

/* 增强金额变化显示 */
.action-amount-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 10px;
    border-radius: 8px;
    margin-top: 4px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.action-amount-change .old-value {
    text-decoration: line-through;
}

/* 响应式调整 */
@media (max-width: 600px) {
    .action-logs-list::before {
        display: none;
    }

    .action-log-item {
        padding-left: 0;
    }

    .action-log-item::before {
        display: none;
    }

    /* --- 预警信息 (Alerts) --- */
    .alerts-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 24px;
    }

    .alert-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 16px 20px;
        border-radius: 14px;
        font-size: 14px;
        font-weight: 500;
        border: 1px solid transparent;
        transition: transform 0.2s;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    }

    .alert-item:hover {
        transform: scale(1.01);
    }

    .alert-icon {
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.6);
    }

    .alert-message {
        flex: 1;
        line-height: 1.5;
    }

    .alert-info {
        background: rgba(0, 122, 255, 0.08);
        color: #007AFF;
        border-color: rgba(0, 122, 255, 0.1);
    }

    .alert-warning {
        background: rgba(255, 149, 0, 0.08);
        color: #FF9500;
        border-color: rgba(255, 149, 0, 0.1);
    }

    .alert-error {
        background: rgba(255, 59, 48, 0.08);
        color: #FF3B30;
        border-color: rgba(255, 59, 48, 0.1);
    }

    .alert-success {
        background: rgba(52, 199, 89, 0.08);
        color: #34C759;
        border-color: rgba(52, 199, 89, 0.1);
    }

}