/* ==========================================================================
   UYAAI Catalog Hub Page - Mobile First Layout (90% Mobile Traffic)
   ========================================================================== */

/* 1. 基础全局样式复位 */
.uyaai-hub-container {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding: 20px 15px 40px;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fcfcfc;
    color: #333;
}

.uyaai-hub-container *, .uyaai-hub-container *::before, .uyaai-hub-container *::after {
    box-sizing: border-box;
}

/* 2. Header 品牌与标语 */
.uyaai-hub-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 10px;
}

.uyaai-hub-logo {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #000;
}

.uyaai-hub-tagline {
    font-size: 13px;
    color: #888;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 3. 双卡片封面网格 (移动端全屏垂直排列，PC端并排) */
.uyaai-hub-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* 卡片基础骨架 */
.uyaai-hub-card {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    background-color: #fff;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}

/* 移动端轻微点击反馈，PC端悬浮效果 */
.uyaai-hub-card:active, .uyaai-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* 卡片背景图控制 (极致长宽比适配，防图片拉伸变形) */
.uyaai-card-bg {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10; /* 适合移动端展示封面 */
    background-color: #eaeaea;
    overflow: hidden;
}

.uyaai-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.uyaai-hub-card:hover .uyaai-cover-img {
    transform: scale(1.05);
}

/* 卡片文本信息区域 */
.uyaai-card-info {
    padding: 20px;
}

.uyaai-card-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    background-color: #000;
    color: #fff;
    border-radius: 3px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.uyaai-card-product .uyaai-card-badge {
    background-color: #0070f3; /* 产品画册使用蓝色，区分公司介绍 */
}

.uyaai-card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #111;
}

.uyaai-card-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    margin: 0 0 15px;
}

/* 按钮模拟器 */
.uyaai-card-btn-fake {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #000;
}

.uyaai-card-product .uyaai-card-btn-fake {
    color: #0070f3;
}

/* 4. 底部核心 B2B 优势展示 */
.uyaai-hub-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 15px;
    background-color: #f1f3f5;
    border-radius: 8px;
    text-align: center;
}

.uyaai-feature-item {
    display: flex;
    flex-direction: column;
}

.uyaai-feature-item strong {
    font-size: 15px;
    color: #111;
    margin-bottom: 2px;
}

.uyaai-feature-item span {
    font-size: 12px;
    color: #666;
}


/* ==========================================================================
   Responsive Breakpoints (PC 端主页面双卡片网格样式优化)
   ========================================================================== */
@media (min-width: 768px) {
    .uyaai-hub-grid {
        flex-direction: row; /* 横向双列并排 */
    }
    
    .uyaai-hub-card {
        flex: 1; /* 平分屏幕 */
    }
    
    .uyaai-card-bg {
        aspect-ratio: 16 / 9;
    }
    
    .uyaai-hub-features {
        grid-template-columns: repeat(2, 1fr); /* 底部优势横向平分 */
        gap: 30px;
        padding: 25px;
    }
    
    .uyaai-feature-item {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }
    
    .uyaai-feature-item strong {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    .uyaai-feature-item span {
        font-size: 13px;
    }
}


/* ==========================================================================
   五、 弹出式区域选择对话框样式优化 (重构定位)
   ========================================================================== */
.uyaai-dialog-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    margin: 0 !important; /* 清除浏览器默认定位 */
    border: none;
    padding: 0;
    border-radius: 16px;
    max-width: 90%;
    width: 420px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    outline: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.uyaai-dialog-modal[open] {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 弹窗原生遮罩（背景模糊磨砂镜面反馈） */
.uyaai-dialog-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.uyaai-modal-content {
    position: relative;
    padding: 30px 20px 25px;
    background-color: #fff;
    text-align: center;
}

/* 🎯 优化一：让选择国家弹窗完美垂直居中（视觉上往上微调提至 47%，最符合人眼直觉） */
#uyaai-region-modal {
    top: 47%; 
}

/* 关闭按钮 */
.uyaai-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 5px;
}

.uyaai-modal-close:hover {
    color: #333;
}

.uyaai-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #111;
}

.uyaai-modal-subtitle {
    font-size: 13px;
    color: #777;
    margin: 0 0 25px;
    line-height: 1.4;
}

/* 国家网格 */
.uyaai-region-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.uyaai-region-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 10px;
    border: 1px solid #eef0f2;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    background-color: #fafbfc;
    transition: all 0.2s ease;
}

.uyaai-region-card:active, .uyaai-region-card:hover {
    border-color: #0070f3;
    background-color: #f4f9ff;
    transform: translateY(-2px);
}

.uyaai-flag {
    font-size: 24px;
    margin-bottom: 6px;
    line-height: 1;
}

.uyaai-country-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    margin-bottom: 2px;
}

.uyaai-warehouse-tag {
    font-size: 9px;
    font-weight: 700;
    color: #0070f3;
    text-transform: uppercase;
}


/* ==========================================================================
   六、 全新升级：近乎全屏、自适应各种宽高、控件永不溢出的画册阅读器样式
   ========================================================================== */

.uyaai-viewer-dialog {
    width: 92vw;
    max-width: 1200px;
    height: 90vh;
    height: 90dvh; /* 现代高精自适应高度 */
    max-height: 90vh;
    max-height: 90dvh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}

.uyaai-viewer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px 30px 20px; /* 顶部给予 40px padding，给绝对定位的关闭按钮留出安全区域 */
    position: relative;
    box-sizing: border-box;
}

.uyaai-viewer-content .uyaai-modal-title {
    margin: 0 0 15px 0;
    flex-shrink: 0; 
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    color: #111111;
}

/* 自适应图片视口 */
.uyaai-image-viewport {
    flex: 1;
    min-height: 0; /* 强制触发弹性盒压缩，阻断大图顶飞控件 */
    width: 100%;
    background-color: #f7f8fa;
    border-radius: 12px;
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 保持长宽比例，不裁剪、不拉伸 */
.uyaai-image-viewport img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    transition: opacity 0.2s ease-in-out;
}

/* 底部翻页栏 */
.uyaai-viewer-controls {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
    margin-top: auto;
}

.uyaai-viewer-btn {
    background-color: #f1f3f5;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #333333;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.uyaai-viewer-btn:hover:not(:disabled) {
    background-color: #0070f3;
    color: #ffffff;
}

.uyaai-viewer-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background-color: #f1f3f5;
    color: #999;
}

.uyaai-viewer-indicator {
    font-size: 14px;
    font-weight: 700;
    color: #555555;
    user-select: none;
}

/* 阅读器右上角关闭 [X] 定位 */
.uyaai-viewer-content .uyaai-modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #888888;
    cursor: pointer;
    padding: 5px;
    z-index: 10;
    transition: color 0.2s;
}

.uyaai-viewer-content .uyaai-modal-close:hover {
    color: #000000;
}


/* ==========================================================================
   七、 移动端极致适配（Mobile Defensive Layout）
   ========================================================================== */
@media (max-width: 768px) {
    .uyaai-viewer-dialog {
        width: 95vw;
        height: 90vh; /* 限制为 90dvh，上下留出 5% 呼吸空间，防止顶满屏幕 */
        height: 90dvh;
        max-height: 90vh;
        max-height: 90dvh;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(1);
    }
    
    .uyaai-viewer-content {
        padding: 40px 12px 12px 12px; /* 移动端安全边距 */
    }
    
    /* 🛡️ 绝对防御：图片区域在手机上最多只能占用“弹窗高度 - 110px”的空间 */
    /* 无论图片有多长，都会被卡在 110px 安全高度之外，彻底杜绝按钮被顶飞的现象 */
    .uyaai-image-viewport {
        max-height: calc(100% - 110px) !important;
        margin-bottom: 12px;
    }
    
    .uyaai-viewer-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .uyaai-viewer-indicator {
        font-size: 12px;
    }

    .uyaai-viewer-content .uyaai-modal-close {
        top: 8px;
        right: 12px;
        font-size: 22px;
    }
}

/* 💡 优化抽屉内自定义标签名称的文本折行与截断，防止名字过长撑坏布局 */
.uyaai-thumb-num {
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    color: #666666;
    text-align: center;
    line-height: 1.25;
    word-break: break-word; /* 允许单词内部换行，防止超长无空格英文字符撑开宽度 */
    display: -webkit-box;
    -webkit-line-clamp: 2;   /* 超出两行自动截断并显示省略号 (...) */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 28px;            /* 锁定文字高度，防止一栏文字多、一栏文字少导致网格卡片高矮不一 */
}

/* ==========================================================================
   八、 画册阅读器左侧抽屉 (Index Drawer) & 索引按钮样式 (补丁)
   ========================================================================== */

/* 1. 索引按钮 (Index Button) - 绝对定位在左上角 */
.uyaai-viewer-index-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    transition: background-color 0.2s ease;
    line-height: 1;
}

.uyaai-viewer-index-btn:hover {
    background-color: #0070f3;
}

.uyaai-viewer-index-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* 2. 抽屉主容器 - 默认隐藏在左侧，通过 transform 实现平滑滑出 */
.uyaai-viewer-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 99; /* 必须高于弹窗内其他元素 */
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border-right: 1px solid #eef0f2;
}

/* 抽屉激活状态 */
.uyaai-viewer-drawer.open {
    transform: translateX(0);
}

/* 3. 抽屉头部 */
.uyaai-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eef0f2;
    flex-shrink: 0;
}

.uyaai-drawer-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: #111111;
}

.uyaai-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999999;
    cursor: pointer;
    padding: 5px;
}

.uyaai-drawer-close:hover {
    color: #111111;
}

/* 4. 抽屉主体 - 缩略图网格容器 */
.uyaai-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 双列布局 */
    gap: 12px;
}

/* 自定义滚动条 */
.uyaai-drawer-body::-webkit-scrollbar {
    width: 6px;
}

.uyaai-drawer-body::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 3px;
}

.uyaai-drawer-body::-webkit-scrollbar-thumb:hover {
    background-color: #cccccc;
}

/* 5. 缩略图卡片 */
.uyaai-drawer-thumb {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 4px;
    background-color: #fafbfc;
    transition: all 0.2s ease;
}

.uyaai-drawer-thumb:hover {
    background-color: #f1f3f5;
}

/* 当前活动页高亮 */
.uyaai-drawer-thumb.active {
    border-color: #0070f3;
    background-color: #f4f9ff;
}

/* 缩略图图片容器比例固定 */
.uyaai-thumb-img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #eaeaea;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.uyaai-thumb-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   九、 移动端抽屉响应式优化
   ========================================================================== */
@media (max-width: 768px) {
    /* 移动端索引按钮位置微调，避免与弹窗边缘冲突 */
    .uyaai-viewer-index-btn {
        top: 10px;
        left: 12px;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .uyaai-viewer-index-btn svg {
        width: 12px;
        height: 12px;
    }

    /* 移动端抽屉自动拓宽至 80% 宽度，提升缩略图清晰度 */
    .uyaai-viewer-drawer {
        width: 80%;
    }
}

/* 强制修复缓存插件导致的图片重叠现象 */
#viewer-img {
    background-color: #ffffff !important;
    position: relative;
    z-index: 10;
}

/* ==========================================================================
   底部触发横幅与多选弹窗样式
   ========================================================================== */
.uyaai-hub-download-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f7f9fc;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    padding: 25px 30px;
    margin: 40px auto 0;
    max-width: 1200px;
}

.uyaai-banner-text h3 { margin: 0 0 5px; font-size: 18px; color: #111; }
.uyaai-banner-text p { margin: 0; font-size: 14px; color: #666; }

.uyaai-banner-btn {
    background-color: #111;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.uyaai-banner-btn:hover { background-color: #0070f3; }
.uyaai-banner-btn:active { transform: scale(0.98); }

/* 多选复选框样式 */
.uyaai-catalog-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
    background: #fcfcfc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.uyaai-catalog-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.uyaai-catalog-checkboxes input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer; accent-color: #0070f3;
}

/* 解锁后的下载面板 */
.uyaai-success-icon { font-size: 40px; margin-bottom: 10px; }
.uyaai-unlocked-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.uyaai-final-download-btn {
    display: block;
    background-color: #f1f3f5;
    color: #0070f3;
    text-decoration: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid #eef0f2;
}

.uyaai-final-download-btn:hover {
    background-color: #0070f3;
    color: #fff;
    border-color: #0070f3;
}

/* Fluent Form 微调防御 (防止表单默认样式破坏弹窗) */
.uyaai-ff-wrapper .fluentform { margin-bottom: 0 !important; }
.uyaai-ff-wrapper .ff-btn-submit { width: 100%; border-radius: 8px !important; }

@media (max-width: 768px) {
    .uyaai-hub-download-banner { flex-direction: column; text-align: center; gap: 15px; padding: 20px 15px; }
    .uyaai-catalog-checkboxes { grid-template-columns: 1fr; }
}