/* ==================== 端口对照表样式 ==================== */

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

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

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

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

.port-table th {
    padding: 12px 16px;
    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;
}

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

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

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

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

/* 各列宽度 */
.port-table th:nth-child(1),
.port-table td:nth-child(1) {
    width: 12%;
}

.port-table th:nth-child(2),
.port-table td:nth-child(2) {
    width: 12%;
}

.port-table th:nth-child(3),
.port-table td:nth-child(3) {
    width: 20%;
}

.port-table th:nth-child(4),
.port-table td:nth-child(4) {
    width: 56%;
}

/* 端口号 */
.col-port {
    text-align: center;
}

.col-port code {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    background: #e8f0fe;
    color: var(--color-primary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-block;
    transition: all 0.15s;
}

.col-port code:hover {
    background: #d2e3fc;
}

.col-port code.copied {
    background: #ceead6;
    color: #137333;
}

/* 协议标签 */
.col-proto {
    text-align: center;
}

.proto-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.proto-tag.tcp {
    background: #e3f2fd;
    color: #1565c0;
}

.proto-tag.udp {
    background: #fff3e0;
    color: #e65100;
}

.proto-tag.both {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* 服务名称 */
.col-service {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
}

/* 描述 */
.col-desc {
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

/* 响应式 */
@media (max-width: 600px) {
    /* 隐藏表格头部 */
    .port-table thead {
        display: none;
    }

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

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

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

    .port-table td {
        padding: 0;
        border: none;
        display: block;
        width: auto;
    }

    /* 端口号 */
    .col-port {
        width: auto !important;
        text-align: center;
        order: 1;
    }

    .col-port code {
        font-size: 13px;
        padding: 4px 10px;
    }

    /* 协议 */
    .col-proto {
        width: auto !important;
        order: 2;
    }

    /* 服务名称 */
    .col-service {
        width: auto !important;
        order: 3;
        flex: 1;
        font-size: 14px;
        font-weight: 600;
    }

    /* 描述 */
    .col-desc {
        width: 100% !important;
        order: 4;
        font-size: 12px;
        margin-top: 4px;
        padding-left: 10px;
        border-left: 3px solid var(--color-primary);
    }

    /* hover */
    .port-table tr:hover td {
        background: transparent;
    }

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

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

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