:root {
    --primary: #00f2fe;
    --secondary: #4facfe;
    --accent: #00ff88;
    --warning: #fbbf24;
    --danger: #ff4757;
    --bg: #0b0f19;
    --card-bg: rgba(23, 31, 50, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(79, 172, 254, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.orbitron {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
}

.dashboard-container {
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid var(--border);
}

.logo-section h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-panel {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.top-row {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
}

.robot-viewer {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--secondary), var(--primary));
}

.robot-card h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.data-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.data-group h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-left: 2px solid var(--secondary);
    padding-left: 0.5rem;
}

.data-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.data-item .val {
    color: var(--primary);
    font-weight: 600;
}

.visual-section {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.robot-image-container {
    height: 300px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

.robot-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8);
    transition: 0.5s;
}

.robot-image-container:hover img {
    filter: brightness(1);
    transform: scale(1.05);
}

.robot-image-container::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0, 242, 254, 0.2), transparent);
    animation: scan 4s linear infinite;
}

@keyframes scan {
    0% {
        top: -100%;
    }

    100% {
        top: 100%;
    }
}

.robot-image-container .overlay-text {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    backdrop-filter: blur(5px);
    border: 1px solid var(--border);
}

.chart-section {
    width: 100%;
}

/* History Chart Card */
.history-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

select {
    background: #1a2234;
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300f2fe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

select option {
    background: #0b0f19;
    color: var(--text);
    padding: 10px;
}

/* Date/Time Input Styling */
input[type="datetime-local"] {
    background: #1a2234;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem;
    border-radius: 8px;
    outline: none;
    color-scheme: dark;
}

.accent-text {
    color: var(--accent);
}

.warning-text {
    color: var(--warning);
}

.alarm-banner {
    background: linear-gradient(90deg, #ff4757, #ff6b81);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    animation: slideDown 0.5s ease-out, pulse-red 2s infinite;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 71, 87, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

.alarm-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alarm-count {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* ===== 演示版徽标 ===== */
.demo-badge {
    margin-top: 6px;
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: #0b0f19;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    padding: 3px 10px;
    border-radius: 999px;
}

/* ===== AI 数据分析 & 设备预测区 ===== */
.ai-section {
    display: grid;
    grid-template-columns: 1.15fr 1.15fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.ai-section__head {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.35rem 0.4rem;
}

.ai-section__title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.ai-section__title h3 {
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-section__spark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent);
    animation: pulse 1.8s infinite;
}

.ai-section__live {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.35);
    padding: 2px 10px;
    border-radius: 999px;
}

.ai-section__model {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* 健康度环 */
.ai-health {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.25rem;
    align-items: center;
}

.ai-ring-wrap {
    position: relative;
    width: 150px;
    height: 150px;
}

.ai-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ai-ring__bg,
.ai-ring__fg {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}

.ai-ring__bg {
    stroke: rgba(255, 255, 255, 0.08);
}

.ai-ring__fg {
    stroke: url(#healthGrad);
    stroke-dasharray: 326.7;
    stroke-dashoffset: 5.8;
    transition: stroke-dashoffset 0.8s ease;
    filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.5));
}

.ai-ring__center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.ai-ring__num {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.ai-ring__unit {
    font-size: 0.9rem;
    color: var(--text-muted);
    align-self: flex-end;
    margin-bottom: 8px;
}

.ai-health__info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-health__label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.ai-health__sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.ai-chip {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.ai-chip--ok {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
}

.ai-chip--warn {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.4);
}

.ai-chip--bad {
    color: var(--danger);
    background: rgba(255, 71, 87, 0.12);
    border-color: rgba(255, 71, 87, 0.4);
}

/* 预测性维护 */
.ai-predict {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.ai-card__h {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-left: 2px solid var(--secondary);
    padding-left: 0.5rem;
}

.ai-maint {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.ai-maint__row {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.ai-maint__sev {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 999px;
    margin-top: 1px;
}

.ai-maint__sev--warn {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.14);
}

.ai-maint__sev--info {
    color: var(--primary);
    background: rgba(0, 242, 254, 0.12);
}

.ai-maint__sev--ok {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
}

.ai-maint__text {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text);
}

.ai-maint__text b {
    color: var(--primary);
}

.ai-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-top: 0.3rem;
}

.ai-metric {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    text-align: center;
}

.ai-metric__num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
}

.ai-metric__label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 工艺智能分析 */
.ai-insight {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.ai-score {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-score__row {
    display: grid;
    grid-template-columns: 78px 1fr 42px;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.8rem;
}

.ai-score__label {
    color: var(--text-muted);
}

.ai-score__val {
    text-align: right;
    font-weight: 700;
    color: var(--primary);
}

.ai-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.ai-bar__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
}

.ai-bar__fill--accent {
    background: linear-gradient(90deg, #00c489, var(--accent));
}

.ai-insight__text {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text);
    background: rgba(0, 242, 254, 0.05);
    border: 1px solid rgba(0, 242, 254, 0.18);
    border-left: 3px solid var(--primary);
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
}

/* AI 预测趋势图 */
.ai-trend-card::before {
    background: linear-gradient(to bottom, var(--accent), var(--primary));
}

.ai-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ai-legend i {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

/* ===== 响应式 ===== */
@media (max-width: 1500px) {
    .ai-section {
        grid-template-columns: 1fr 1fr;
    }

    .ai-section__head {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .ai-section {
        grid-template-columns: 1fr;
    }

    .ai-health {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .ai-ring-wrap {
        margin: 0 auto;
    }

    .ai-chips {
        justify-content: center;
    }
}

/* 存在活跃报警：整条横幅红黑交替闪烁，远距离也能注意到 */
.alarm-banner.blink {
    animation: slideDown 0.5s ease-out, pulse-red 2s infinite, flash-red 1.1s steps(1, end) infinite;
}

@keyframes flash-red {

    0%,
    49% {
        background: linear-gradient(90deg, #ff4757, #ff6b81);
    }

    50%,
    100% {
        background: linear-gradient(90deg, #6d0a12, #a3141f);
    }
}
