/* ============================================
   监控看板样式 v6（完全对齐 codebuddy 仪表盘）
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: #f0f4f8;
    color: #1e293b;
    padding: 16px;
}
.dashboard { max-width: 1400px; margin: 0 auto; }

/* ============================================
   渐变头部
   ============================================ */
.header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 28px 36px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; letter-spacing: 1px; }
.header .subtitle { font-size: 14px; opacity: 0.85; }
.header .date-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    margin-top: 8px;
}
.header-right { text-align: right; }
.header-right .clock { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.header-right .live-indicator { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 6px;
    animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50%      { opacity: 0.7; box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
}

/* ============================================
   Section 卡片
   ============================================ */
.section {
    background: white;
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid #2563eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title .section-tag {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 12px;
    border-radius: 12px;
}

/* ============================================
   KPI 卡片
   ============================================ */
.kpi-row { display: grid; gap: 16px; margin-bottom: 24px; }
.kpi-row-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-row-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-row-6 { grid-template-columns: repeat(6, 1fr); }
.kpi-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 18px 20px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.kpi-card .label { font-size: 13px; color: #64748b; margin-bottom: 8px; }
.kpi-card .value { font-size: 28px; font-weight: 700; color: #1e3a5f; }
.kpi-card .unit { font-size: 14px; color: #64748b; font-weight: 400; margin-left: 4px; }
.kpi-card.accent-blue   { border-left: 4px solid #2563eb; }
.kpi-card.accent-green  { border-left: 4px solid #10b981; }
.kpi-card.accent-red    { border-left: 4px solid #ef4444; }
.kpi-card.accent-amber  { border-left: 4px solid #f59e0b; }
.kpi-card.accent-purple { border-left: 4px solid #8b5cf6; }

/* ============================================
   表格
   ============================================ */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e2e8f0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #f1f5f9; }
th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }
td.text-center, th.text-center { text-align: center; }

.summary-table th { background: #eff6ff; }
.summary-table .total-row { background: #fef3c7 !important; font-weight: 700; }
.summary-table .total-row td { color: #92400e; }

/* ============================================
   状态徽章
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-planned   { background: #fef3c7; color: #92400e; }
.status-inflight  { background: #dbeafe; color: #1e40af; }
.status-unknown   { background: #f1f5f9; color: #475569; }

/* ============================================
   机库标签
   ============================================ */
.hangar-tag {
    display: inline-block;
    background: #2563eb;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* ============================================
   空域情况看板
   ============================================ */
.airspace-board {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.airspace-board-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    width: 100%;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.airspace-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.15s;
}
.airspace-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.airspace-card .ac-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}
.airspace-card .ac-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.ac-badge.ac-approved  { background: #d1fae5; color: #065f46; }
.ac-badge.ac-pending   { background: #fef3c7; color: #92400e; }
.ac-badge.ac-none      { background: #fee2e2; color: #991b1b; }
.ac-badge.ac-limited   { background: #ffedd5; color: #9a3412; }
.ac-badge.ac-unknown   { background: #f1f5f9; color: #64748b; }
.airspace-card .ac-time {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

/* ============================================
   底部
   ============================================ */
.footer {
    text-align: center;
    padding: 16px;
    color: #94a3b8;
    font-size: 12px;
}

/* ============================================
   图表区域
   ============================================ */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
.chart-grid .chart-full { grid-column: 1 / -1; }
.chart-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}
.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 12px;
}
.chart-container { width: 100%; height: 280px; }

/* ============================================
   空状态
   ============================================ */
.empty-tip {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

/* ============================================
   告警弹窗（右上角滑入）
   ============================================ */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.alert-popup {
    width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    pointer-events: auto;
    animation: alertSlideIn 0.4s ease-out forwards;
    border-left: 5px solid #2563eb;
}
.alert-popup.alert-takeoff  { border-left-color: #f59e0b; }
.alert-popup.alert-landing  { border-left-color: #10b981; }
.alert-popup.alert-abnormal { border-left-color: #ef4444; }

.alert-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 8px;
    font-size: 16px;
    font-weight: 700;
    color: #1e3a5f;
}
.alert-popup.alert-takeoff  .alert-header { color: #92400e; }
.alert-popup.alert-landing  .alert-header { color: #065f46; }
.alert-popup.alert-abnormal .alert-header { color: #991b1b; }

.alert-icon { font-size: 24px; animation: iconShake 0.5s ease-in-out 3; }

.alert-body { padding: 0 18px 14px; font-size: 14px; color: #334155; line-height: 1.8; }
.alert-body .alert-row { display: flex; gap: 8px; }
.alert-body .alert-label { color: #64748b; min-width: 70px; }
.alert-body .alert-value { font-weight: 600; color: #1e293b; }

.alert-progress {
    height: 3px;
    background: #e2e8f0;
    overflow: hidden;
}
.alert-progress-bar {
    height: 100%;
    background: #2563eb;
    animation: progressShrink 8s linear forwards;
}
.alert-popup.alert-takeoff  .alert-progress-bar { background: #f59e0b; }
.alert-popup.alert-landing  .alert-progress-bar { background: #10b981; }
.alert-popup.alert-abnormal .alert-progress-bar { background: #ef4444; }

@keyframes alertSlideIn {
    from { transform: translateX(440px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}
@keyframes alertSlideOut {
    to { transform: translateX(440px); opacity: 0; }
}
.alert-popup.removing { animation: alertSlideOut 0.3s ease-in forwards; }

@keyframes iconShake {
    0%, 100% { transform: rotate(0); }
    25%      { transform: rotate(-8deg); }
    75%      { transform: rotate(8deg); }
}
@keyframes progressShrink {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ============================================
   滚动条
   ============================================ */
::-webkit-scrollbar       { height: 6px; width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================
   响应式适配
   ============================================ */

/* 平板 */
@media (max-width: 1024px) {
    .kpi-row-5 { grid-template-columns: repeat(3, 1fr); }
    .kpi-row-4 { grid-template-columns: repeat(2, 1fr); }
    .chart-grid { grid-template-columns: 1fr; }
    .chart-grid .chart-full { grid-column: 1; }
}

/* 小平板/大手机 */
@media (max-width: 768px) {
    body { padding: 10px; }
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px 22px;
    }
    .header-right { text-align: left; align-self: flex-end; }
    .header h1 { font-size: 20px; }
    .header .subtitle { font-size: 12px; }
    .header-right .clock { font-size: 22px; }
    .section { padding: 16px 14px; }
    .section-title { font-size: 15px; }
    .kpi-row { gap: 10px; }
    .kpi-row-4, .kpi-row-5 { grid-template-columns: repeat(2, 1fr); }
    .kpi-card { padding: 14px 12px; }
    .kpi-card .value { font-size: 22px; }
    .kpi-card .label { font-size: 12px; }
    .chart-container { height: 240px; }
    .alert-popup { width: calc(100vw - 24px); max-width: 380px; }
    .alert-container { top: 10px; right: 10px; left: 10px; }
    .airspace-card { padding: 6px 10px; }
    .airspace-card .ac-name { font-size: 12px; }
    th, td { padding: 8px 10px; font-size: 12px; }
}

/* 手机 */
@media (max-width: 480px) {
    body { padding: 8px; }
    .header { padding: 16px 18px; border-radius: 10px; }
    .header h1 { font-size: 17px; letter-spacing: 0; }
    .header .subtitle { font-size: 11px; }
    .header .date-badge { font-size: 11px; padding: 3px 10px; }
    .header-right .clock { font-size: 18px; }
    .header-right .live-indicator { font-size: 11px; }
    .section { padding: 12px 10px; border-radius: 10px; }
    .section-title { font-size: 14px; padding-left: 10px; }
    .section-title .section-tag { font-size: 11px; }
    .kpi-row-4, .kpi-row-5 { grid-template-columns: 1fr 1fr; }
    .kpi-card { padding: 12px 10px; border-radius: 10px; }
    .kpi-card .value { font-size: 20px; }
    .kpi-card .unit { font-size: 12px; }
    .kpi-card .label { font-size: 11px; }
    .chart-box { padding: 12px 10px; }
    .chart-title { font-size: 13px; }
    .chart-container { height: 200px; }
    .alert-popup { width: calc(100vw - 16px); max-width: none; }
    .alert-header { font-size: 14px; padding: 10px 14px 6px; }
    .alert-body { font-size: 13px; padding: 0 14px 10px; }
    .airspace-board { padding: 10px 8px; gap: 8px; }
    .airspace-card { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; width: 100%; }
    th, td { padding: 6px 8px; font-size: 11px; }
    .footer { font-size: 11px; padding: 12px; }
}
