/**
 * WP CAD 前端基础样式
 */

/* 容器 */
.wp-cad-wrapper {
    margin: 20px 0;
}

.wp-cad-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 表格 - 固定布局让列宽平均分配 */
.wp-cad-table-responsive {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* 表头 */
.wp-cad-table-responsive th {
    padding: 12px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    vertical-align: middle;
}

/* 型号列 - 自适应宽度 */
.wp-cad-table-responsive th.wp-cad-th-model {
    width: auto;
    text-align: center;
}

/* 下载列 - 自动平均分配剩余空间 */
.wp-cad-table-responsive th.wp-cad-th-file {
    width: auto;
}

/* 内容 */
.wp-cad-table-responsive td {
    padding: 10px 14px;
    vertical-align: middle;
    height: 44px;
}

.wp-cad-table-responsive td.wp-cad-td-model {
    text-align: center;
}

.wp-cad-table-responsive td.wp-cad-td-file {
    text-align: center;
}

/* 下载按钮 - 颜色由内联样式控制 (v2.4.8) */
.wp-cad-download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    /* 不设置 background，让内联样式生效 */
    color: #fff;
    text-decoration: none;
    border-radius: var(--button-border-radius, 4px);
    font-size: 13px;
    font-weight: 500;
    height: 32px;
    box-sizing: border-box;
    cursor: pointer;
    border: none;
}

.wp-cad-download-link:hover {
    opacity: 0.9;
}

.wp-cad-download-link .wp-cad-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.wp-cad-download-link .wp-cad-download-text {
    font-size: 13px;
}

/* 图标 - 使用 mask 方式，白色图标 (v2.4.8) */
.wp-cad-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: rgba(255, 255, 255, 0.95);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/%3E%3C/svg%3E");
}

/* 无文件 - v2.4.10: 高大上的灰色图纸图标 */
.wp-cad-no-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: #f5f5f5;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.wp-cad-no-file:hover {
    opacity: 0.8;
    background-color: #e8e8e8;
}

.wp-cad-no-file-icon {
    width: 18px;
    height: 18px;
    color: #9e9e9e;
}

/* 图例 */
.wp-cad-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
}

.wp-cad-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wp-cad-legend-icon {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* 移动端 */
@media screen and (max-width: 768px) {
    .wp-cad-table-container {
        overflow-x: auto;
    }
    
    .wp-cad-table-responsive {
        width: 100%;
        table-layout: auto;
    }
    
    .wp-cad-table-responsive th,
    .wp-cad-table-responsive td {
        padding: 8px 6px;
        height: 40px;
    }
    
    /* 移动端下载按钮更宽 */
    .wp-cad-download-link {
        display: flex;
        width: 100%;
        max-width: 70px;
        padding: 5px 10px;
        font-size: 12px;
        height: 28px;
    }
    
    /* 下载列平均分配宽度 */
    .wp-cad-table-responsive th.wp-cad-th-file,
    .wp-cad-table-responsive td.wp-cad-td-file {
        width: 25%;
    }
}

@media screen and (max-width: 480px) {
    .wp-cad-table-responsive {
        width: 100%;
        table-layout: auto;
    }
    
    .wp-cad-table-responsive th,
    .wp-cad-table-responsive td {
        padding: 6px 4px;
        height: 36px;
    }
    
    .wp-cad-download-link {
        max-width: 60px;
        padding: 4px 8px;
        font-size: 11px;
        height: 26px;
    }
}


/* v2.4.6: 新增样式 */

/* 表格 caption */
.wp-cad-table-responsive caption.wp-cad-table-caption {
    caption-side: top;
    text-align: left;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* 型号名称单元格 */
.wp-cad-td-model.wp-cad-model-name {
    vertical-align: middle;
    text-align: center;
    font-weight: 500;
}

/* 下载按钮（无内联样式） */
.wp-cad-download-link.wp-cad-file-available {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    height: 32px;
    box-sizing: border-box;
    cursor: pointer;
    border: none;
}

.wp-cad-download-link.wp-cad-file-available:hover {
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}

/* 无文件状态 - v2.4.10: 高大上的灰色图纸图标 */
.wp-cad-no-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: #f5f5f5;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.wp-cad-no-file:hover {
    opacity: 0.8;
    background-color: #e8e8e8;
}

.wp-cad-no-file-icon {
    width: 18px;
    height: 18px;
    color: #9e9e9e;
}

/* 移动端适配 */
@media screen and (max-width: 480px) {
    .wp-cad-table-responsive caption.wp-cad-table-caption {
        font-size: 12px;
        padding: 6px 4px;
    }
    
    .wp-cad-td-model.wp-cad-model-name {
        font-size: 13px;
    }
}
