/* ==================== HTML实体字符对照表样式 ==================== */

/* 容器 */
.entity-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 分组 */
.entity-section {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
}

.entity-section-title {
    padding: 14px 16px;
    background: var(--color-bg-secondary);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
}

/* 表格 */
.entity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.entity-table th {
    padding: 12px 14px;
    background: var(--color-bg-secondary);
    font-weight: 600;
    color: var(--color-text);
    text-align: left;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.entity-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    vertical-align: middle;
}

.entity-table tr:last-child td {
    border-bottom: none;
}

.entity-table tr:hover td {
    background: var(--color-bg-secondary);
}

/* 点击复制效果 */
.entity-table tr.copied td {
    background: #e6f4ea;
}

/* 各列样式 */
.col-char {
    width: 60px;
    text-align: center;
    font-size: 24px;
    color: var(--color-text);
}

.col-name {
    min-width: 140px;
    font-weight: 500;
    color: var(--color-text);
}

.col-entity,
.col-dec,
.col-hex {
    min-width: 100px;
}

.col-entity code,
.col-dec code,
.col-hex code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: #e8f0fe;
    color: var(--color-primary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-block;
    transition: all 0.15s;
}

.col-entity code:hover,
.col-dec code:hover,
.col-hex code:hover {
    background: #d2e3fc;
    transform: translateY(-1px);
}

.col-entity code.copied,
.col-dec code.copied,
.col-hex code.copied {
    background: #ceead6;
    color: #137333;
}

.col-desc {
    color: var(--color-text-secondary);
    font-size: 13px;
    min-width: 120px;
}

/* 无实体名称标记 */
.col-entity code:has(:only-child:is(-)) {
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    cursor: default;
}

/* ==================== 移动端响应式 - 卡片布局 ==================== */
@media (max-width: 600px) {
    /* 隐藏表格头部 */
    .entity-table thead {
        display: none;
    }

    /* 表格变为容器 */
    .entity-table,
    .entity-table tbody {
        display: block;
        width: 100%;
    }

    /* 每行变为卡片 */
    .entity-table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 12px;
        border-bottom: 1px solid var(--color-border-light);
        gap: 8px;
    }

    .entity-table tr:last-child {
        border-bottom: none;
    }

    /* 字符显示区 */
    .col-char {
        width: auto;
        text-align: center;
        font-size: 28px;
        padding: 0 12px 0 0;
        border-right: 1px solid var(--color-border-light);
        order: 1;
    }

    /* 名称 */
    .col-name {
        min-width: auto;
        font-size: 14px;
        font-weight: 500;
        flex: 1;
        order: 2;
    }

    /* 说明 */
    .col-desc {
        font-size: 12px;
        color: var(--color-text-secondary);
        width: 100%;
        order: 4;
        margin-top: 4px;
    }

    /* 编码区域 - 水平排列 */
    .col-entity,
    .col-dec,
    .col-hex {
        min-width: auto;
        order: 3;
    }

    .col-entity code,
    .col-dec code,
    .col-hex code {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* hover 效果调整 */
    .entity-table tr:hover td {
        background: transparent;
    }

    .entity-table tr:hover {
        background: var(--color-bg-secondary);
    }

    .entity-table tr.copied {
        background: #e6f4ea;
    }

    .entity-table tr.copied td {
        background: transparent;
    }

    /* 表格单元格通用 */
    .entity-table td {
        padding: 0;
        border: none;
        display: block;
    }
}
