/* ========================================
   生猪AI智能防治体系 - 监控大屏样式
   ======================================== */

/* CSS变量定义 */
:root {
    /* 主色调 - 深色科技风 */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-panel: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(15, 23, 42, 0.9));
    --bg-card: rgba(30, 41, 59, 0.8);

    /* 强调色 */
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #06b6d4);

    /* 状态色 */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #6366f1;

    /* 文字色 */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* 边框 */
    --border-color: rgba(59, 130, 246, 0.3);
    --border-glow: rgba(59, 130, 246, 0.5);

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

    /* 尺寸 */
    --header-height: 70px;
    --footer-height: 40px;
    --panel-gap: 16px;
    --border-radius: 12px;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* 手机端基础：允许滚动 */
@media (max-width: 768px) {
    html, body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }
}

/* Dashboard容器 */
.dashboard {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

@media (max-width: 768px) {
    .dashboard {
        height: auto;
        min-height: 100vh;
    }
}

/* ========== 顶部标题栏 ========== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 36px;
    filter: drop-shadow(0 0 10px rgba(255, 183, 197, 0.5));
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.header-center .datetime {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.weather {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.weather-icon {
    font-size: 20px;
}

.weather-temp {
    font-size: 16px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-info:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.avatar {
    font-size: 20px;
}

/* ========== 主内容区 ========== */
.main-content {
    display: flex;
    flex: 1;
    padding: var(--panel-gap);
    gap: var(--panel-gap);
    overflow: hidden;   /* 整体不溢出，子列自己滚动 */
    min-height: 0;      /* flex子项必须，允许子项缩小 */
}

/* 面板基础样式 */
.panel {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    /* overflow: hidden 已移除，改为 panel-body 内部控制滚动 */
    transition: all 0.3s ease;
    position: relative;  /* 供放大功能定位 */
}

.panel:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-body {
    padding: 16px;
    overflow-y: auto;
    max-height: 420px;      /* 防止内容无限撑高，超出可滚动 */
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

/* ========== 左侧面板 ========== */
.left-panel {
    display: flex;
    flex-direction: column;
    width: 320px;
    gap: var(--panel-gap);
    overflow-y: auto;       /* 左侧整列可滚动 */
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.2) transparent;
}

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.stat-card.healthy {
    border-left: 3px solid var(--color-success);
}

.stat-card.warning {
    border-left: 3px solid var(--color-warning);
}

.stat-icon {
    font-size: 28px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 图表容器 */
.chart-container {
    width: 100%;
    height: 180px;
}

/* ========== 中央区域 ========== */
.center-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: var(--panel-gap);
}

.map-panel {
    flex: 1;
}

.trend-panel {
    height: 220px;
}

.trend-panel .chart-container {
    height: 160px;
}

/* 地图占位 */
.farm-map {
    width: 100%;
    height: 100%;
    min-height: 280px;
    position: relative;
}

.map-placeholder {
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px),
        radial-gradient(ellipse at center, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    background-size: 40px 40px, 40px 40px, 100% 100%;
    border-radius: 8px;
    position: relative;
}

.farm-marker {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: markerFloat 3s ease-in-out infinite;
}

.farm-marker:nth-child(2) {
    animation-delay: 0.5s;
}

.farm-marker:nth-child(3) {
    animation-delay: 1s;
}

.farm-marker:nth-child(4) {
    animation-delay: 1.5s;
}

.farm-marker:nth-child(5) {
    animation-delay: 2s;
}

@keyframes markerFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.farm-marker:hover {
    transform: scale(1.1);
    z-index: 10;
}

.marker-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.marker-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 4px;
    white-space: nowrap;
}

.marker-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-top: 2px;
}

.marker-status.healthy {
    background: var(--color-success);
    color: white;
}

.marker-status.warning {
    background: var(--color-warning);
    color: white;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========== 右侧面板 ========== */
.right-panel {
    display: flex;
    flex-direction: column;
    width: 340px;
    gap: var(--panel-gap);
    overflow-y: auto;       /* 右侧整列可滚动 */
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.2) transparent;
}

/* 预警面板 */
.alert-panel {
    max-height: 280px;
}

.alert-panel .panel-body {
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
}

.badge-danger {
    background: var(--color-danger);
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.alert-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.alert-item.level-red {
    border-left-color: var(--color-danger);
}

.alert-item.level-orange {
    border-left-color: var(--color-warning);
}

.alert-item.level-yellow {
    border-left-color: #eab308;
}

.alert-icon {
    font-size: 18px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.alert-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 诊断面板 */
.diagnosis-panel .panel-body {
    padding: 8px;
}

.diagnosis-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diagnosis-item {
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.diagnosis-item:hover {
    border-color: var(--accent-primary);
}

.diagnosis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.diagnosis-id {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Consolas', monospace;
}

.confidence {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.confidence.high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.confidence.medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
}

.diagnosis-result {
    margin-bottom: 6px;
}

.disease-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-warning);
}

.diagnosis-symptoms {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.diagnosis-actions {
    display: flex;
    gap: 8px;
}

/* 环境监测 */
.env-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.env-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    text-align: center;
}

.env-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.env-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.env-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.env-status {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
}

.env-status.normal {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.env-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
}

.btn-handle {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
    font-size: 11px;
    padding: 4px 10px;
}

.btn-handle:hover {
    background: var(--color-danger);
    color: white;
}

.panel-actions .btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.panel-actions .btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ========== 底部状态栏 ========== */
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--footer-height);
    padding: 0 24px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.beian-link {
    color: var(--text-primary) !important;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}

.beian-link:hover {
    color: var(--accent-primary) !important;
    opacity: 1;
}

.footer-center {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--color-success);
    box-shadow: 0 0 10px var(--color-success);
    animation: pulse 2s ease-in-out infinite;
}

.separator {
    color: var(--text-muted);
}

/* ========== 滚动条样式 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ========== 响应式适配 ========== */
@media (max-width: 1400px) {
    .left-panel {
        width: 280px;
    }

    .right-panel {
        width: 300px;
    }

    .main-content {
        grid-template-columns: 280px 1fr 280px;
    }
}

@media (max-width: 1200px) {

    .left-panel,
    .right-panel {
        width: 260px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== 手机端响应式（≤768px） ========== */
@media (max-width: 768px) {

    /* Header */
    .header {
        height: auto;
        min-height: 56px;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-left {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .logo {
        font-size: 24px;
    }

    .header h1 {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 隐藏中间日期时间（手机空间不足） */
    .header-center {
        display: none;
    }

    /* 右侧只保留导航按钮，隐藏天气和用户信息 */
    .weather {
        display: none;
    }

    .user-info {
        display: none;
    }

    .header-right {
        gap: 8px;
        flex-wrap: wrap;
    }

    .nav-btn {
        font-size: 11px;
        padding: 6px 10px;
        margin-right: 0;
    }

    /* 主内容区：改为竖向单列 */
    .main-content {
        flex-direction: column;
        overflow: visible;
        padding: 10px;
        gap: 10px;
        height: auto;
    }

    /* 左右侧面板撑满宽度 */
    .left-panel,
    .right-panel {
        width: 100%;
        flex-direction: column;
    }

    /* 图表容器高度适配 */
    .chart-container {
        height: 220px;
    }

    /* 趋势面板 */
    .trend-panel {
        height: auto;
    }

    .trend-panel .chart-container {
        height: 200px;
    }

    /* 地图高度适中 */
    .farm-map {
        min-height: 220px;
    }

    /* 统计卡片 2列 */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 预警面板不限高 */
    .alert-panel {
        max-height: none;
    }

    .alert-panel .panel-body {
        max-height: none;
    }

    /* 诊断列表：按钮不换行 */
    .diagnosis-actions {
        flex-wrap: wrap;
    }

    /* 底部状态栏：竖排 */
    .footer {
        height: auto;
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 14px;
        gap: 4px;
    }

    .footer-center,
    .footer-right {
        font-size: 11px;
    }
}

/* ========== 导航按钮 ========== */
.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    margin-right: 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-btn.prrsv-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.nav-btn.prrsv-btn:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.nav-btn.treatment-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.nav-btn.treatment-btn:hover {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: var(--color-warning);
    color: white;
}

.badge-success {
    background: var(--color-success);
    color: white;
}

/* ========== 登录页面 ========== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: 
        radial-gradient(ellipse at center, rgba(59, 130, 246, 0.15) 0%, transparent 60%),
        var(--bg-primary);
}

.login-box {
    width: 400px;
    padding: 40px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--text-muted);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 10px;
}

/* ========== 管理员后台特有样式 ========== */
.admin-tools {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tool-group select, .tool-group input[type="date"] {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--text-muted);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.data-table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.data-table th {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-secondary);
    font-weight: 600;
}

.data-table tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

/* ========== AI防治建议 ========== */
.ai-advice-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.advice-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.5);
    border-left: 4px solid transparent;
    font-size: 14px;
    line-height: 1.5;
}

.advice-item.danger {
    border-left-color: var(--color-danger);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(30, 41, 59, 0) 100%);
    color: #fca5a5;
}

.advice-item.warning {
    border-left-color: var(--color-warning);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(30, 41, 59, 0) 100%);
    color: #fcd34d;
}

.advice-item.success {
    border-left-color: var(--color-success);
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(30, 41, 59, 0) 100%);
    color: #6ee7b7;
}

.table-row-anomaly {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* ============================================================
   悟能 - 赛博朋克AI助手
   ============================================================ */
#wuneng-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* 悬浮球外壳 */
.wuneng-orb-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 5px;
}

.wuneng-orb {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}
.wuneng-orb:hover { transform: scale(1.1); }
.wuneng-orb::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: orb-spin 4s linear infinite;
}

/* 待机态 - 蓝色脉冲 */
.orb-idle {
    background: radial-gradient(circle at 35% 35%, #3b82f6, #1e3a5f);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.2);
    animation: orb-pulse-idle 2.5s ease-in-out infinite;
}
.orb-idle::before { border-color: rgba(59, 130, 246, 0.5) transparent; }

/* 聆听态 - 绿色蓬勃 */
.orb-listening {
    background: radial-gradient(circle at 35% 35%, #10b981, #064e3b);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.8), 0 0 50px rgba(16, 185, 129, 0.3);
    animation: orb-pulse-listen 0.8s ease-in-out infinite;
}
.orb-listening::before { border-color: rgba(16, 185, 129, 0.7) transparent; }

/* 思考态 - 紫色闪动 */
.orb-thinking {
    background: radial-gradient(circle at 35% 35%, #8b5cf6, #2d1b69);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.9), 0 0 60px rgba(139, 92, 246, 0.3);
    animation: orb-pulse-think 0.4s ease-in-out infinite;
}
.orb-thinking::before { border-color: rgba(139, 92, 246, 0.8) transparent; }

/* 回应态 - 橙金流光 */
.orb-speaking {
    background: radial-gradient(circle at 35% 35%, #f59e0b, #7c2d12);
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.8), 0 0 50px rgba(245, 158, 11, 0.3);
    animation: orb-pulse-speak 0.6s ease-in-out infinite;
}
.orb-speaking::before { border-color: rgba(245, 158, 11, 0.7) transparent; }

@keyframes orb-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes orb-pulse-idle {
    0%, 100% { box-shadow: 0 0 18px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 32px rgba(59, 130, 246, 0.9); }
}
@keyframes orb-pulse-listen {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); transform: scale(1); }
    50% { box-shadow: 0 0 40px rgba(16, 185, 129, 1); transform: scale(1.04); }
}
@keyframes orb-pulse-think {
    0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); }
    50% { box-shadow: 0 0 50px rgba(139, 92, 246, 1); }
}
@keyframes orb-pulse-speak {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 40px rgba(245, 158, 11, 1); transform: scale(1.03); }
}

.wuneng-status-label {
    font-size: 10px;
    color: #64748b;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: nowrap;
}

/* 麦克风按钮 */
.wuneng-mic-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    align-self: flex-end;
}
.wuneng-mic-btn:hover { background: rgba(16, 185, 129, 0.3); transform: scale(1.1); }

/* 聊天窗口 */
.wuneng-chat-window {
    width: 300px;
    max-height: 420px;
    background: rgba(2, 12, 27, 0.92);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(16px);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2), 0 20px 60px rgba(0,0,0,0.5);
}

.wuneng-chat-header {
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.15));
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wuneng-title {
    font-size: 12px;
    font-weight: 600;
    color: #93c5fd;
    letter-spacing: 1px;
}
.wuneng-close-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}
.wuneng-close-btn:hover { color: #94a3b8; }

.wuneng-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.wuneng-msg {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 90%;
    word-break: break-all;
}
.wuneng-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(79, 70, 229, 0.25));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}
.wuneng-msg-assistant {
    align-self: flex-start;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #e2e8f0;
}

.wuneng-input-row {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(30, 41, 59, 0.8);
}
.wuneng-text-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
}
.wuneng-text-input:focus { border-color: rgba(59, 130, 246, 0.7); }
.wuneng-send-btn {
    background: rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    color: #93c5fd;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    transition: background 0.2s;
}
.wuneng-send-btn:hover { background: rgba(59, 130, 246, 0.55); }

/* ============================================================
   手势控制按钮
   ============================================================ */
.gesture-toggle-btn {
    position: fixed;
    bottom: 100px;
    right: 100px;
    z-index: 9995;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 20px;
    padding: 6px 14px;
    color: #a5b4fc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}
.gesture-toggle-btn:hover { background: rgba(99, 102, 241, 0.2); }
.gesture-toggle-btn.active {
    border-color: rgba(16, 185, 129, 0.6);
    color: #6ee7b7;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* 聊天框内联麦克风按钮 */
.wuneng-mic-inline-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}
.wuneng-mic-inline-btn:hover { background: rgba(16, 185, 129, 0.3); }

/* 移动端响应式调整 */
@media (max-width: 480px) {
    #wuneng-widget {
        bottom: 16px;
        right: 16px;
    }
    .wuneng-chat-window {
        width: calc(100vw - 32px);
        max-height: 55vh;
        position: fixed;
        bottom: 100px;
        right: 16px;
        left: 16px;
    }
    .wuneng-orb {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    .gesture-toggle-btn {
        bottom: 80px;
        right: 16px;
        font-size: 11px;
        padding: 5px 10px;
    }
}

/* ============================================================
   返回监控中心按钮（prrsv/treatment 页面）
   ============================================================ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 20px;
    color: #93c5fd;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.back-link:hover {
    background: rgba(59, 130, 246, 0.35);
    border-color: rgba(59, 130, 246, 0.9);
    color: #fff;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
    transform: translateX(-2px);
}

/* ============================================================
   双击卡片放大 - 遮罩层
   ============================================================ */
.panel-expand-overlay {
    position: fixed;
    inset: 0;
    z-index: 19000;
    background: rgba(2, 10, 25, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayIn 0.25s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.panel-expand-overlay .panel-expanded {
    position: relative;
    width: min(90vw, 900px);
    max-height: 85vh;
    background: var(--bg-panel);
    border: 1px solid rgba(59, 130, 246, 0.6);
    border-radius: var(--border-radius);
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.3), 0 30px 80px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cardExpandIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardExpandIn {
    from { transform: scale(0.75); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.panel-expand-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(99, 102, 241, 0.5);
    background: rgba(15, 23, 42, 0.9);
    color: #a5b4fc;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.panel-expand-close:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.7);
    color: #fca5a5;
}

/* 放大状态下 panel-body 不再限制高度 */
.panel-expanded .panel-body {
    max-height: calc(85vh - 60px);
    flex: 1;
}

/* 双击时显示提示角标 */
.panel::after {
    content: '⤢';
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 12px;
    color: rgba(99, 102, 241, 0.3);
    pointer-events: none;
    transition: opacity 0.2s;
    opacity: 0;
}
.panel:hover::after {
    opacity: 1;
}