/* ===== 全局布局 ===== */
:root {
    --sidebar-width: 232px;
    --bg-light-custom: #f5f7fb;
}

body {
    background-color: var(--bg-light-custom);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .nav-link {
    color: #4a5568;
    font-size: 0.925rem;
    transition: all 0.15s ease;
}

.sidebar .nav-link:hover {
    background-color: #eef2ff;
    color: #2563eb;
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ===== 主内容区 ===== */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* ===== 统计卡片 ===== */
.stat-card {
    transition: transform 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ===== 图表 ===== */
.chart-box {
    height: 300px;
    position: relative;
}

/* ===== 登录页 ===== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #dbeafe 100%);
    padding: 16px;
}

.login-wrap {
    width: 100%;
    max-width: 860px;
}

.login-card .login-brand {
    background: linear-gradient(160deg, #1d4ed8, #3b82f6 55%, #60a5fa);
}

/* ===== 表单错误 ===== */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #dc3545;
}

/* ===== 表格行 hover ===== */
.table > :not(caption) > * > * {
    padding: 0.7rem 0.75rem;
}

/* ===== 分页 ===== */
.page-link {
    color: #2563eb;
}

.page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* ===== 移动端适配 ===== */
@media (max-width: 991.98px) {
    .content {
        padding-top: 1rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

/* ===== 侧边栏分组标题 ===== */
.nav-section-label {
    font-size: 0.72rem;
    color: #9ca3af;
    padding: 6px 12px 2px;
    letter-spacing: 1px;
}

/* ===== 视频监控 ===== */
.loc-item {
    color: #4a5568;
    transition: background 0.15s;
}

.loc-item:hover {
    background-color: #eef2ff;
}

.loc-item.active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
}

.video-grid {
    min-height: calc(100vh - 220px);
    background: #0b1220;
    display: grid;
    gap: 3px;
    padding: 3px;
    transition: all 0.2s ease;
}

.video-grid.grid-1 { grid-template-columns: repeat(1, 1fr); }
.video-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }

.video-cell {
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 150px;
}

.video-cell .cam-title {
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 6px;
}

.video-cell .cam-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-cell .cam-close {
    color: #fff;
    font-size: 0.65rem;
    padding: 0 4px;
}

.video-cell .cam-body {
    flex: 1;
    position: relative;
    min-height: 0;
}

.video-cell video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-cell .cam-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fca5a5;
    z-index: 2;
}

.video-cell .cam-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    opacity: 0.4;
}

@media (max-width: 991.98px) {
    .video-grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 脱机地图 ===== */
.offline-map {
    position: relative;
    width: 100%;
    min-height: 70vh;
    background: #f0f7ef;
}

.map-tooltip {
    position: absolute;
    z-index: 6;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    padding: 10px 14px;
    max-width: 300px;
}

.offline-map svg {
    border-radius: 0.75rem;
    display: block;
}
