/* ============================================================
   监控预览（视频监控）
   ============================================================ */
.video-preview-page {
    padding: 4px;
}

.vp-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .18);
    border: 1px solid #eef1f6;
    overflow: hidden;
}

.vp-card + .vp-card {
    margin-top: 16px;
}

.vp-card-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.vp-head-blue {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.vp-head-slate {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.vp-head-dark {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.vp-card-head .head-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vp-card-body {
    padding: 12px;
}

/* 分组列表 */
.vp-group-list {
    min-height: 180px;
}

.vp-group-empty,
.vp-device-empty {
    color: #94a3b8;
    text-align: center;
    padding: 32px 12px;
    font-size: 13px;
}

.vp-group {
    border: 1px solid #eef1f6;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.vp-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    background: #f8fafc;
    user-select: none;
    transition: background .2s;
}

.vp-group-head:hover {
    background: #eef4ff;
}

.vp-group-head .vp-group-name {
    font-weight: 600;
    color: #334155;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp-group-head .vp-group-count {
    font-size: 12px;
    color: #94a3b8;
}

.vp-group-head .vp-arrow {
    transition: transform .2s;
    color: #94a3b8;
    font-size: 11px;
}

.vp-group-head.open .vp-arrow {
    transform: rotate(90deg);
}

.vp-device-list {
    margin: 0;
    padding: 4px 6px 8px;
    list-style: none;
    border-top: 1px solid #f1f5f9;
}

.vp-device {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background .15s, box-shadow .15s;
}

.vp-device:hover {
    background: #eef4ff;
}

.vp-device.in-use {
    background: #e6f6ec;
    box-shadow: inset 3px 0 0 #16a34a;
}

.vp-device .vp-device-name {
    flex: 1;
    color: #334155;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp-device.in-use .vp-device-name {
    color: #15803d;
    font-weight: 600;
}

.vp-device .vp-device-ip {
    color: #94a3b8;
    font-size: 12px;
}

.vp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.vp-status-dot.online {
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .12);
}

.vp-status-dot.offline {
    background: #cbd5e1;
}

.vp-in-use-tip {
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
    flex: none;
}

/* 画面分割网格 */
.vp-grid-wrap {
    background: #0b1220;
    border-radius: 8px;
    padding: 8px;
}

.vp-grid {
    display: grid;
    gap: 6px;
}

.vp-grid-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.vp-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vp-grid-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vp-grid-16 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vp-grid-25 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.vp-slot {
    position: relative;
    background: #000;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    min-height: 90px;
}

.vp-slot-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #52657a;
    font-size: 12px;
    letter-spacing: .5px;
}

.vp-stream,
.vp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.vp-video {
    object-fit: contain;
    background: #000;
}

.vp-stream-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 8px 5px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    color: #fff;
    font-size: 12px;
    pointer-events: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp-state-hint {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: #b6c2d1;
    font-size: 13px;
    background: rgba(10, 16, 28, .68);
    text-align: center;
    padding: 12px;
    pointer-events: none;
}

.vp-stream.vp-loading .vp-state-hint,
.vp-stream.vp-error .vp-state-hint,
.vp-stream.vp-nourl .vp-state-hint {
    display: flex;
}

/* 工具栏 */
.vp-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vp-toolbar .ant-btn-group .ant-btn {
    min-width: 40px;
}

.vp-hint-text {
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    font-weight: 400;
}

.vp-main-col {
    padding-left: 16px;
}

@media (max-width: 992px) {
    .vp-main-col {
        padding-left: 0;
        margin-top: 16px;
    }
}
.vp-hint-row {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f0f9ff;
    color: #0c4a6e;
    font-size: 12px;
}
/* ===== 预览区域比例调整：画面按分割数铺满可用高度，消除下方空白 ===== */
.video-preview-page {
    display: flex;
    flex-direction: column;
}

.vp-grid-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 235px);
    min-height: 380px;
}

.vp-grid {
    flex: 1;
    height: 100%;
    min-height: 0;
}

.vp-grid-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
    grid-template-rows: repeat(1, minmax(0, 1fr));
}

.vp-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.vp-grid-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
}

.vp-grid-16 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
}

.vp-grid-25 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
}

.vp-slot {
    aspect-ratio: auto;
    height: 100%;
    min-height: 0;
}
/* ===== 分屏格子：1px 分隔线、格子间无空隙、无重复双线 ===== */
.vp-grid-wrap {
    padding: 1px;
    background: #2a3547;
}

.vp-grid {
    gap: 1px;
    background: #2a3547;
}

.vp-slot {
    border: none;
    border-radius: 0;
}
/* 自定义画面控制按钮：暂停/播放只走此按钮，双击画面不再触发暂停 */
.vp-ctl-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 5;
    display: none;
    padding: 4px 12px;
    border: none;
    border-radius: 14px;
    background: rgba(15, 23, 42, .68);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    backdrop-filter: blur(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.vp-slot:hover .vp-ctl-btn {
    display: block;
}

.vp-ctl-btn:hover {
    background: rgba(37, 99, 235, .82);
}
/* 云台控制盘 */
.vp-ptz {
    position: absolute;
    right: 10px;
    bottom: 40px;
    z-index: 6;
    display: none;
    grid-template-columns: repeat(3, 28px);
    grid-template-rows: repeat(3, 28px);
    gap: 2px;
    padding: 5px;
    border-radius: 8px;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}

.vp-stream:not(.vp-playing) .vp-ptz,
.vp-stream:not(.vp-playing) .vp-ptz-zoom {
    display: none !important;
}

.vp-slot:hover .vp-ptz {
    display: grid;
}

.vp-ptz-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vp-ptz-btn:hover {
    background: rgba(37, 99, 235, .85);
}

.vp-ptz-btn[data-action="stop"] {
    background: rgba(220, 38, 38, .55);
    font-size: 10px;
}

.vp-ptz-zoom {
    position: absolute;
    right: 6px;
    top: 46px;
    z-index: 6;
    display: none;
    flex-direction: column;
    gap: 2px;
}

.vp-slot:hover .vp-ptz-zoom {
    display: flex;
}

.vp-ptz-zoom-btn {
    background: rgba(15, 23, 42, .72);
    font-size: 15px;
}