/* ===== charge 公开查询页专属样式（Element 浅色主题）===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f5f7fa;
    color: #303133;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}
img { -webkit-user-drag: none; }

/* ===== Layout ===== */
.charge-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;   /* 移动端自适应地址栏高度 */
    background: #f5f7fa;
}

/* ===== 顶部导航栏（和 admin 一致：白底 + 底边分割） ===== */
.charge-header {
    height: 56px;
    background-color: #fff;
    border-bottom: 1px solid #e4e7ed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}
.charge-header__left { display: flex; align-items: center; gap: 10px; }
.charge-header__logo { border-radius: 4px; }
.charge-header__title { font-size: 16px; font-weight: 600; color: #303133; }

/* ===== 主内容区 ===== */
.charge-main {
    flex: 1;
    padding: 20px 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* 中间容器：50% 宽度，居中 */
.charge-container {
    width: 50%;
    min-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== 筛选区 ===== */
.charge-filter {
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    padding: 16px 20px;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-row + .filter-row { margin-top: 12px; }
.filter-label {
    width: 40px;
    font-size: 13px;
    color: #909399;
    flex-shrink: 0;
}

/* ===== 站点列表区（白背景 + 圆角 + 内边距） ===== */
.charge-stations {
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 6px;
    border-bottom: 1px solid #f0f2f5;
}
.stations-title {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stations-title .el-icon { color: #409EFF; }
.stations-count {
    font-size: 12px;
    color: #909399;
    font-weight: 400;
    margin-left: 4px;
}

/* ===== 单个站点卡片 ===== */
.station-card {
    background: #fafbfc;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    padding: 12px 16px 14px;
}
.station-card__head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #ebeef5;
}
.station-card__meta { flex: 1; min-width: 0; }
.station-card__name {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.station-card__name .el-icon { color: #409EFF; font-size: 15px; }
.station-card__info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #606266;
    line-height: 20px;
}
.station-meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
/* 修复图标偏上：统一垂直居中 */
.station-meta .el-icon {
    font-size: 12px;
    color: #909399;
    vertical-align: middle;
}

/* ===== 端口区 ===== */
.station-card__ports { padding-top: 10px; }

/* 加载/汇总条 */
.ports-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #606266;
    margin-bottom: 10px;
}
.ports-status .el-icon-loading { color: #409EFF; margin-right: 4px; }
/* 汇总胶囊：仅作用于三个统计 span，不再用后代选择器污染 el-tag 的垂直居中 */
.summary-charging,
.summary-idle,
.summary-offline {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 10px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 12px;
    line-height: 1;
}
.summary-charging { background: #fdf6ec; color: #E6A23C; }
.summary-idle    { background: #f0f9eb; color: #67C23A; }
.summary-offline { background: #f4f4f5; color: #909399; }
/* 来源标签：强制文字在椭圆内垂直居中 */
.ports-source .el-tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    line-height: 1;
}

/* 数据来源（新获取/缓存）+ 实际回源时间，靠右侧展示 */
.ports-source {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    font-weight: 400;
}
.ports-source__time {
    color: #909399;
    font-weight: 400;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
    white-space: nowrap;
}

/* 12 端口网格 */
.ports-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.port-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    background: #fafafa;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    font-family: inherit;
}
.port-dot:hover:not(:disabled) {
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.port-dot:active:not(:disabled) { transform: scale(.94); }
.port-dot:disabled {
    cursor: not-allowed;
    opacity: .6;
}
.port-dot__num {
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 3px;
}
.port-dot__status {
    font-size: 11px;
    line-height: 1;
    opacity: .85;
}

/* 端口状态变体 */
.port-dot--empty {
    background: #f5f7fa;
    color: #C0C4CC;
    border-color: #ebeef5;
}
.port-dot--offline {
    background: #f4f4f5;
    color: #909399;
    border-color: #e9e9eb;
}
.port-dot--idle {
    background: #f0f9eb;
    color: #67C23A;
    border-color: #e1f3d8;
}
.port-dot--charging {
    background: #fdf6ec;
    color: #E6A23C;
    border-color: #faecd8;
}

.station-card__ports-empty {
    padding: 14px 0 4px;
    color: #C0C4CC;
    font-size: 12px;
    text-align: center;
}

/* ===== 端口详情对话框（上下左右居中） ===== */
.charge-port-dialog {
    margin-top: 0 !important;
    top: 50%;
    transform: translateY(-50%);
}

.port-detail { padding: 4px 0; }
.port-detail__status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 14px;
}
.port-detail__status--offline  { background: #f4f4f5; color: #909399; }
.port-detail__status--idle     { background: #f0f9eb; color: #67C23A; }
.port-detail__status--charging { background: #fdf6ec; color: #E6A23C; }

/* ===== 页脚：2 行（主版权 + 来源/免责/更新合并） ===== */
.charge-footer {
    flex-shrink: 0;
    padding: 12px 24px 14px;
    text-align: center;
    background: #fff;
    border-top: 1px solid #e4e7ed;
    line-height: 1.8;
}
.charge-footer__main {
    font-size: 12px;
    color: #909399;
}
.charge-footer__sub {
    font-size: 11px;
    color: #C0C4CC;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.charge-footer__sub .el-icon-warning-outline {
    color: #E6A23C;
    font-size: 12px;
    margin-right: 2px;
}
.charge-footer__divider { color: #DCDFE6; }

/* ===== 移动端适配（≤ 768px） ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* Header：收紧 padding（叠加刘海屏安全区） */
    .charge-header {
        height: 48px;
        padding: 0 calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
    }
    .charge-header__logo { width: 28px; height: 28px; }
    .charge-header__title { font-size: 14px; font-weight: 600; }

    /* 主内容区：全宽，去掉 min-width */
    .charge-main { padding: 12px 0; }
    .charge-container {
        width: 100%;
        min-width: 0;
        margin: 0 auto;
        padding: 0 10px;
        gap: 10px;
    }

    /* 筛选区：手机上 label 在上、radio-button 在下换行显示 */
    .charge-filter { padding: 12px; border-radius: 6px; }
    .filter-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .filter-row + .filter-row { margin-top: 10px; }
    .filter-label { width: auto; font-size: 12px; color: #909399; }
    .filter-row .el-radio-group {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .charge-filter .el-radio-button {
        display: block;
        margin-right: 0 !important;
        border-radius: 16px !important;   /* 圆角胶囊 */
    }
    .charge-filter .el-radio-button__inner {
        padding: 6px 14px;
        font-size: 13px;
        border: 1px solid #DCDFE6 !important;
        border-radius: 16px !important;
        background: #fff;
        box-shadow: none !important;
    }
    .charge-filter .el-radio-button__orig-radio:checked + .el-radio-button__inner {
        background-color: #409EFF;
        border-color: #409EFF !important;
        color: #fff;
        box-shadow: -1px 0 0 0 #409EFF !important;
    }
    /* 去掉 Element 相邻按钮的连接线，圆角独立 */
    .charge-filter .el-radio-button:first-child .el-radio-button__inner,
    .charge-filter .el-radio-button:last-child .el-radio-button__inner {
        border-radius: 16px !important;
    }

    /* 站点列表 */
    .charge-stations {
        padding: 12px;
        border-radius: 6px;
        gap: 10px;
    }
    .stations-header { padding: 0 0 8px; }
    .stations-title { font-size: 14px; }

    /* 站点卡片 */
    .station-card {
        padding: 12px;
        border-radius: 6px;
    }
    .station-card__head {
        flex-direction: column;
        gap: 4px;
    }
    .station-card__name { font-size: 14px; margin-bottom: 4px; }
    .station-card__info { gap: 10px; font-size: 11px; line-height: 18px; }
    .station-card__info .el-tag { display: none; }  /* 手机上隐藏重复 tag */

    /* 汇总条 */
    .ports-status { flex-wrap: wrap; gap: 6px; font-size: 11px; margin-bottom: 8px; }
    .summary-charging, .summary-idle, .summary-offline { height: 18px; padding: 0 8px; font-size: 11px; }
    .ports-source .el-tag { height: 18px; padding: 0 7px; }
    /* 数据来源+时间：手机上独占一行，避免长日期撑宽溢出 */
    .ports-source { margin-left: 0; width: 100%; justify-content: flex-start; }

    /* 端口网格：手机保持 6 列（12 口 = 2 行），整体紧凑，仅保证可看可点 */
    .ports-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
    }
    .port-dot { padding: 4px 1px; border-radius: 4px; min-height: 34px; touch-action: manipulation; }
    .port-dot__num { font-size: 13px; margin-bottom: 1px; }
    .port-dot__status { font-size: 9px; }

    /* 页脚（叠加底部安全区） */
    .charge-footer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); line-height: 1.6; }
    .charge-footer__main { font-size: 11px; }
    .charge-footer__sub { font-size: 10px; flex-wrap: wrap; gap: 2px; }

    /* 对话框：接近全屏 */
    .charge-port-dialog {
        width: calc(100% - 24px) !important;
        max-width: 480px;
        margin-top: 0 !important;
        top: 50%;
        transform: translateY(-50%);
    }
    .charge-port-dialog .el-dialog__body {
        height: auto !important;
        max-height: 70vh;
        padding: 14px 16px 10px;
        overflow-y: auto;
    }
    .charge-port-dialog .el-dialog {
        border-radius: 10px;
    }

    /* 端口详情：el-descriptions 在手机上更紧凑 */
    .port-detail__status { margin-bottom: 10px; font-size: 12px; padding: 3px 10px; }
}

/* ===== 超小屏（≤ 360px）端口网格更紧凑（仍 6 列） ===== */
@media (max-width: 360px) {
    .ports-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
    .port-dot { padding: 3px 1px; min-height: 30px; }
    .port-dot__num { font-size: 12px; }
    .port-dot__status { font-size: 8px; }
    .station-card__info { gap: 8px; font-size: 10px; }
    .station-meta .el-icon { display: none; }  /* 隐藏设备/SUID 前图标省空间 */
}

/* ===== 桌面端交互约束：禁用文本拖选（有精确指针设备） ===== */
@media (hover: hover) and (pointer: fine) {
    body,
    .charge-layout,
    .charge-header,
    .charge-main,
    .charge-filter,
    .charge-stations,
    .station-card,
    .charge-footer {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* ===== 桌面端自定义右键菜单 ===== */
.ctx-menu {
    position: fixed;
    z-index: 3000;
    min-width: 168px;
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,.14);
    padding: 5px;
    font-size: 13px;
    user-select: none;
}
.ctx-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    color: #303133;
    white-space: nowrap;
}
.ctx-menu__item:hover { background: #ecf5ff; color: #409EFF; }
.ctx-menu__item .el-icon { font-size: 14px; color: inherit; }
.ctx-menu__divider { height: 1px; background: #ebeef5; margin: 4px 2px; }
