/**
 * Dynamic SKU Table - Admin Styles
 * 用于产品编辑页面的样式定义
 */

/* Meta Box容器样式 - 使用WordPress默认样式 */
#dst_product_certification .inside {
    padding: 15px;
}

/* 认证字段容器 - 完全独立 */
.dst-certification-container {
    margin-bottom: 15px;
    clear: both;
    border: 1px solid transparent;
}

/* 确保认证字段编辑器正常显示 */
.dst-certification-container .wp-editor-wrap {
    margin-bottom: 10px;
    width: 100%;
}

.dst-certification-container .wp-editor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 确保描述文字在正确的位置 */
.dst-certification-container .description {
    margin-top: 10px;
    font-style: normal;
    color: #666;
    clear: both;
}

#dst_product_media .inside {
    padding: 15px;
}

/* 检测认证Meta Box样式 - 使用WordPress标准方法 */
#dst_product_certification .wp-editor-wrap {
    margin-bottom: 10px;
}

#dst_product_certification .description {
    margin: 10px 0 0 0;
    color: #666;
    font-style: italic;
}

/* 媒体容器样式 */
.dst-media-container {
    max-width: 100%;
}

.dst-media-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    min-height: 120px;
    border: 2px dashed #ddd;
    padding: 15px;
    border-radius: 4px;
    background: #f9f9f9;
}

.dst-media-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.dst-media-item img,
.dst-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dst-media-item .remove-item {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}

.dst-media-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-style: italic;
}

.dst-media-actions {
    margin-top: 15px;
}

.dst-media-actions .button {
    margin-right: 10px;
}

/* 检测认证直接渲染样式 */
.dst-certification-section {
    margin: 30px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dst-certification-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

/* 前端Tab样式 */
.dst-empty-media-notice,
.dst-empty-certification-notice {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    text-align: center;
    border-radius: 4px;
    margin: 20px 0;
}

.dst-empty-media-notice p,
.dst-empty-certification-notice p {
    margin: 10px 0;
}

.dst-certification-container {
    margin-top: 20px;
    line-height: 1.6;
}

.dst-certification-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
}

.dst-certification-container table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
}

.dst-certification-container th,
.dst-certification-container td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.dst-certification-container th {
    background-color: #f9f9f9;
    font-weight: bold;
}

/* 防止样式冲突 */
.dst-certification-container p,
.dst-certification-container div,
.dst-certification-container span {
    max-width: 100%;
    word-wrap: break-word;
}

.dst-certification-container iframe {
    max-width: 100%;
    height: auto;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
    .dst-media-gallery {
        gap: 10px;
        padding: 10px;
    }

    .dst-media-item {
        width: 100px;
        height: 100px;
    }

    .dst-certification-container table {
        font-size: 14px;
    }

    .dst-certification-container th,
    .dst-certification-container td {
        padding: 6px 8px;
    }
}


/* 确保meta box标题栏样式正确 */
#dst_product_certification .hndle,
#dst_product_media .hndle {
    font-size: 14px;
    font-weight: 600;
}

/* 防止内容溢出 */
.dst-certification-container {
    overflow-x: auto;
    max-width: 100%;
}

/* 修复表格在小屏幕上的显示 */
@media screen and (max-width: 600px) {
    .dst-certification-container table {
        font-size: 12px;
    }

    .dst-certification-container th,
    .dst-certification-container td {
        padding: 4px 6px;
        word-break: break-word;
    }
}

/* 前端媒体展示样式 */
.dst-media-videos-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.dst-media-tabs-vertical {
    width: 150px;
    flex-shrink: 0;
}

.dst-media-thumbnail-nav {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f9f9f9;
}

.dst-media-thumbnail-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    transition: all 0.3s ease;
    text-align: center;
}

.dst-media-thumbnail-item:last-child {
    border-bottom: none;
}

.dst-media-thumbnail-item:hover {
    background: #f0f0f0;
}

.dst-media-thumbnail-item.active {
    background: #0073aa;
}

.dst-media-thumbnail-item.active .dst-thumbnail-title {
    color: white;
}

.dst-media-thumbnail-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.dst-video-thumbnail {
    position: relative;
    width: 100%;
    height: 80px;
    margin-bottom: 8px;
}

.dst-video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.dst-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.dst-video-placeholder {
    width: 100%;
    height: 80px;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #666;
    font-size: 12px;
}

.dst-thumbnail-title {
    font-size: 12px;
    line-height: 1.3;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dst-media-content {
    flex: 1;
}

.dst-media-item-content {
    display: none;
}

.dst-media-item-content.active {
    display: block;
}

.dst-media-image-container {
    text-align: center;
    margin-bottom: 15px;
}

.dst-media-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dst-media-video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 15px;
}

.dst-media-video-container iframe,
.dst-media-video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .dst-certification-section {
        margin: 20px 0;
        padding: 15px;
        border-radius: 6px;
    }

    .dst-certification-section h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .dst-media-videos-container {
        flex-direction: column;
    }
    .dst-media-tabs-vertical {
        width: 100%;
    }
    .dst-media-thumbnail-nav {
        display: flex;
        overflow-x: auto;
        border: none;
        background: transparent;
        padding: 10px 0;
    }
    .dst-media-thumbnail-item {
        border: 1px solid #ddd;
        border-radius: 4px;
        margin-right: 10px;
        flex-shrink: 0;
        min-width: 100px;
    }
    .dst-media-thumbnail-item:last-child {
        margin-right: 0;
    }
}