/* Dashboard metrics, group cards and chart refinements. */
/* ===== 指标卡 ===== */
.metric-card {
    background: var(--fx-panel);
    border: 1px solid var(--fx-border);
    border-radius: 8px;
    padding: 13px 14px;
    min-width: 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--fx-elevation-sm);
    transition:
        background-color var(--fx-theme-transition),
        border-color 0.15s ease,
        color var(--fx-theme-transition),
        box-shadow 0.15s ease;
}

.metric-card:hover {
    box-shadow: var(--fx-elevation-md);
    border-color: color-mix(in srgb, var(--fx-primary) 32%, var(--fx-border));
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    min-height: 20px;
}

.metric-card-label {
    color: var(--fx-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.metric-card-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--fx-text-muted);
}

.metric-card-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fx-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-success) 24%, transparent);
    animation: status-pulse 2s ease-in-out infinite;
}

.metric-card-status .status-dot.offline {
    background: var(--fx-text-muted);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-text-muted) 18%, transparent);
    animation: none;
}

.metric-card-status .status-dot.error {
    background: var(--fx-error);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-error) 24%, transparent);
}

.metric-card-status .status-dot.warning {
    background: var(--fx-warning);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-warning) 24%, transparent);
}

@keyframes status-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-success) 24%, transparent);
    }
    50% {
        box-shadow: 0 0 0 6px color-mix(in srgb, var(--fx-success) 8%, transparent);
    }
}

.metric-card-value-unit {
    font-size: 14px;
    color: var(--fx-text-muted);
    font-weight: 500;
    margin-left: 4px;
}

.metric-card-trend-up {
    color: var(--fx-success);
}

.metric-card-trend-down {
    color: var(--fx-error);
}

.metric-card a {
    color: inherit;
    text-decoration: none;
}

/* ===== 驾驶舱样式 ===== */
.dashboard-metrics {
    margin-bottom: 16px;
}

.dashboard-panel {
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
}

.dashboard-panel:hover {
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.dashboard-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--fx-border);
    margin-bottom: 0;
}

.dashboard-panel-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fx-text);
}

.dashboard-panel-header h2 .anticon {
    color: var(--fx-primary);
    font-size: 16px;
}

.dashboard-panel-header .entity-link {
    font-size: 13px;
}

.dashboard-panel .ant-table-wrapper .ant-table {
    border-radius: 0 0 8px 8px;
}

/* ===== 分组卡片 ===== */
.thing-dashboard-group.group-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid var(--fx-border);
}

.thing-dashboard-group.group-card:hover {
    border-color: color-mix(in srgb, var(--fx-primary) 32%, var(--fx-border));
    box-shadow: 0 3px 10px color-mix(in srgb, var(--fx-text) 8%, transparent);
}

.group-card-stripe {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--fx-primary) 0%, color-mix(in srgb, var(--fx-primary) 60%, transparent) 100%);
}

.thing-dashboard-group.group-card:nth-child(4n+2) .group-card-stripe {
    background: linear-gradient(180deg, var(--fx-success) 0%, color-mix(in srgb, var(--fx-success) 60%, transparent) 100%);
}

.thing-dashboard-group.group-card:nth-child(4n+3) .group-card-stripe {
    background: linear-gradient(180deg, var(--fx-warning) 0%, color-mix(in srgb, var(--fx-warning) 60%, transparent) 100%);
}

.thing-dashboard-group.group-card:nth-child(4n+4) .group-card-stripe {
    background: linear-gradient(180deg, #722ed1 0%, color-mix(in srgb, #722ed1 60%, transparent) 100%);
}

.group-card-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 10px 22px;
    width: 100%;
}

.group-card-content h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.group-card-content p {
    margin: 4px 0 0;
    color: var(--fx-text-muted);
    font-size: 12px;
}

.dashboard-widget h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fx-text);
    margin: 0 0 10px;
    padding-left: 4px;
    border-left: 3px solid var(--fx-primary);
    padding: 2px 0 2px 8px;
}

.dashboard-widget h3 .anticon {
    color: var(--fx-primary);
}

.dashboard-widget {
    padding: 14px 18px;
    border-bottom: 1px dashed var(--fx-border);
}

.dashboard-widget:last-child {
    border-bottom: none;
}

/* ===== 趋势图增强 ===== */
.trend-chart-enhanced {
    position: relative;
}

.trend-chart-enhanced svg {
    border-radius: 6px;
    background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--fx-primary) 3%, transparent) 100%);
}

.trend-grid {
    stroke: var(--fx-border);
    stroke-width: 0.1;
    stroke-dasharray: 0.5 0.5;
    opacity: 0.7;
}

.trend-axis-line {
    stroke: var(--fx-border);
    stroke-width: 0.2;
}

.trend-series-line {
    fill: none;
    stroke-width: 0.5;
    transition: stroke-width 0.2s ease;
    filter: drop-shadow(0 0 0.5px color-mix(in srgb, currentColor 50%, transparent));
}

.trend-series-line:hover {
    stroke-width: 0.8;
}

.trend-series-line.point {
    stroke-width: 0.4;
}

.trend-series-line.stat {
    stroke-width: 0.6;
    stroke-dasharray: 1.5 0.8;
}

.trend-series-line.stat.avg {
    stroke-dasharray: 0;
}

.trend-hover-line {
    stroke: var(--fx-primary);
    stroke-width: 0.15;
    stroke-dasharray: 0.4 0.4;
    opacity: 0.6;
}

.trend-tooltip {
    position: absolute;
    transform: translate(-50%, -100%);
    margin-top: -8px;
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    min-width: 140px;
    max-width: 280px;
}

.trend-tooltip::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: rgba(15, 23, 42, 0.95);
}

.trend-tooltip-time {
    font-weight: 600;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.trend-tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.trend-tooltip-row i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.trend-tooltip-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-tooltip-value {
    font-weight: 600;
    color: #ffffff;
    margin-left: auto;
}

.trend-series-legend .trend-legend-item {
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.trend-series-legend .trend-legend-item:hover {
    background: var(--fx-nav-hover);
}

.trend-series-legend .trend-legend-item.is-hidden {
    opacity: 0.38;
    text-decoration: line-through;
}

.trend-series-legend .trend-legend-item.is-hidden:hover {
    opacity: 0.72;
}

.trend-all-hidden {
    position: absolute;
    left: 50%;
    top: calc(50% - 13px);
    transform: translate(-50%, -50%);
    padding: 8px 12px;
    color: var(--fx-text-muted);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}
