/**
 * NOVA 服装 OEM 网站自定义样式
 * 包含：地图弹窗样式、动画类、响应式优化、移动端触摸优化
 */

/* ========== 地图弹窗样式 ========== */
.custom-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-size: 13px;
    color: #121212;
    min-width: 180px;
    text-align: center;
}

.custom-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.5);
}

.custom-div-icon {
    background: transparent;
    border: none;
}

/* ========== 动画辅助类（需要!important覆盖Tailwind） ========== */
.visible {
    visibility: visible !important;
}

.opacity-100 {
    opacity: 1 !important;
}

.translate-y-0 {
    transform: translateY(0) !important;
}

/* ========== 语言选择按钮响应式优化 ========== */
@media (max-width: 639px) {
    #currentLang {
        display: inline !important;
        font-size: 0.875rem;
    }
    
    #langDropdownBtn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0.5rem;
    }
    
    #langDropdownBtn .fa-globe {
        font-size: 1rem;
    }
    
    #langDropdownBtn .fa-chevron-down {
        font-size: 0.75rem;
    }
}

/* ========== 移动端触摸体验优化样式 ========== */

/* ========== 客户评价滚动交互优化 ========== */

/* PC 端：悬停时显示可滚动提示 */
#reviewsCarousel {
    cursor: default;
}

#reviewsCarousel.is-hovering {
    cursor: ns-resize;
}

/* 滚动容器样式 - 隐藏滚动条 */
.reviews-scroll-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.reviews-scroll-container::-webkit-scrollbar {
    display: none;
}

/* 案例展示水平滚动容器样式 */
.cases-scroll-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overflow-y: hidden !important;
    overflow-x: auto !important;
    overscroll-behavior: contain;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 1rem;
    margin: 0;
}

.cases-scroll-container::-webkit-scrollbar {
    display: none;
}

/* 案例卡片样式 */
.case-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* 移动端触摸优化 - 使用更高优先级选择器 */
@media (max-width: 768px) {
    .reviews-scroll-container,
    .cases-scroll-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: auto;
    }
    
    /* 案例卡片移动端固定宽度 */
    .cases-scroll-container .case-card {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        flex-shrink: 0;
    }
    
    .review-card {
        touch-action: auto;
    }
    
    /* 案例展示容器优化 */
    #casesCarousel {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    
    /* 滚动容器移动端触摸设置 */
    #casesViewport {
        touch-action: auto;
    }
    
    /* 确保案例内容容器正确计算宽度 */
    #casesContent {
        box-sizing: border-box;
        padding-right: 1rem;
        width: max-content;
        display: flex;
        gap: 1.5rem;
    }
}

/* 轮播触摸反馈 */
.carousel-touching {
    cursor: grabbing !important;
}

.carousel-touching .card-hover {
    transform: none !important;
    box-shadow: none !important;
}

/* 触摸滑动时禁用焦点样式，防止跳动 */
.carousel-touching * {
    outline: none !important;
    box-shadow: none !important;
}

/* 防止案例卡片获取焦点时页面滚动 */
#casesCarousel > div:focus {
    outline: none;
}

/* 触摸目标优化 - 允许水平触摸滑动 */
#casesCarousel {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* 滚动容器触摸设置 */
#casesViewport {
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
}

/* 移动端按钮尺寸优化 - 符合 48px 最小触摸标准 */
@media (max-width: 639px) {
    #prevCase, #nextCase {
        width: 48px;
        height: 48px;
    }
    
    #prevCase {
        left: 0.75rem;
    }
    
    #nextCase {
        right: 0.75rem;
    }
    
    /* 移动端案例卡片间距优化 */
    #casesCarousel.cases-scroll-container {
        gap: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 移动端案例卡片宽度优化 */
    .cases-scroll-container .case-card {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }
    
    /* 确保滚动容器有正确的 padding */
    .cases-scroll-container {
        padding: 0 1rem;
        box-sizing: border-box;
        width: 100%;
    }
    
    /* 确保内容容器有足够的右边距，最后一个卡片完整显示 */
    #casesContent {
        padding-right: 1rem;
        box-sizing: border-box;
    }
    
    /* 移动端标题文字大小优化 */
    #cases h2 {
        font-size: 1.75rem;
    }
}

/* 平板端优化 */
@media (min-width: 640px) and (max-width: 1023px) {
    #casesCarousel.cases-scroll-container {
        gap: 1.25rem;
    }
    
    /* 保持轮播视口铺满容器，避免平板宽度下只剩 320px 视口造成大面积留白 */
    #casesViewport {
        width: 100%;
        max-width: 100%;
    }

    .cases-scroll-container .case-card {
        width: 320px;
        min-width: 320px;
        max-width: 320px;
    }
    
    #prevCase, #nextCase {
        width: 44px;
        height: 44px;
    }
}

/* 桌面端优化 */
@media (min-width: 1024px) {
    #casesCarousel.cases-scroll-container {
        gap: 1.5rem;
    }
}

/* ========== 服务流程步骤优化 ========== */

/* 步骤标题最小高度，防止英文换行重叠 */
.step-item h4 {
    min-height: 3.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    word-break: break-word;
    hyphens: auto;
    margin-bottom: 0.5rem;
}

/* 步骤描述文字样式 */
.step-item p {
    line-height: 1.5;
    word-break: break-word;
    hyphens: auto;
    min-height: 5.5rem;
}

/* 步骤项最小高度，确保有足够空间 */
.step-item {
    min-height: 270px;
}

/* ========== 移动端服务流程横线优化 ========== */
/* 在移动端（2×2 布局）隐藏步骤连接线 */
@media (max-width: 767px) {
    .step-line {
        display: none !important;
    }
}

/* 移动端步骤优化 */
@media (max-width: 639px) {
    .step-item h4 {
        min-height: 3.2rem;
        font-size: 0.85rem;
        line-height: 1.25;
        margin-bottom: 0.4rem;
    }
    
    .step-item p {
        font-size: 0.8rem;
        line-height: 1.45;
        min-height: 4.5rem;
    }
    
    .step-item {
        min-height: 235px;
    }
}

/* 平板端步骤优化 */
@media (min-width: 640px) and (max-width: 1023px) {
    .step-item h4 {
        min-height: 3.5rem;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .step-item p {
        font-size: 0.85rem;
        line-height: 1.5;
        min-height: 5rem;
    }
    
    .step-item {
        min-height: 250px;
    }
}

/* ========== 多语言界面流程步骤优化（合并版） ========== */
/* 使用 :is() 选择器合并所有语言的相同样式 */

/* 所有语言界面：增加流程容器最大宽度 */
html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) #about .max-w-3xl {
    max-width: 1024px;
}

/* 所有语言界面：优化卡片内边距 */
html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item {
    padding: 0 0.5rem;
}

/* 所有语言界面：调整标题和描述样式 */
html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item h4 {
    min-height: 2.8rem;
    font-size: 1rem;
    line-height: 1.2;
}

html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item p {
    min-height: 4.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item {
    min-height: 250px;
}

/* 所有语言界面移动端优化 - 保持全宽 */
@media (max-width: 768px) {
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) #about .max-w-3xl {
        max-width: 100%;
    }
    
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item h4 {
        min-height: 3rem;
        font-size: 0.85rem;
    }
    
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item p {
        font-size: 0.75rem;
        min-height: 4.2rem;
    }
}

/* 所有语言界面平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) #about .max-w-3xl {
        max-width: 900px;
    }
    
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item h4 {
        min-height: 3rem;
        font-size: 0.95rem;
    }
    
    html:is([lang="en"], [lang="th"], [lang="ms"], [lang="ko"], [lang="zh"], [lang="zh-tw"], [lang="ja"]) .step-item p {
        font-size: 0.85rem;
        min-height: 4.5rem;
    }
}

/* ========== FAQ 轮播样式 ========== */

/* FAQ 滚动容器样式 - 隐藏滚动条 */
.faq-scroll-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.faq-scroll-container::-webkit-scrollbar {
    display: none;
}

/* FAQ 卡片样式 */
.faq-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-card:hover {
    transform: translateY(-2px);
}

/* FAQ 卡片内部样式 */
.faq-card .bg-white {
    transition: box-shadow 0.3s ease;
}

.faq-card:hover .bg-white {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* FAQ 问题图标样式 */
.faq-card .fa-question-circle {
    transition: transform 0.3s ease;
}

.faq-card:hover .fa-question-circle {
    transform: scale(1.1);
}

/* 移动端 FAQ 优化 */
@media (max-width: 768px) {
    .faq-scroll-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: auto;
    }
    
    .faq-card {
        touch-action: auto;
    }
    
    /* 移动端 FAQ 卡片内部样式优化 */
    .faq-card .bg-white {
        padding: 0.875rem;
    }
    
    .faq-card h4 {
        font-size: 0.9rem;
    }
    
    .faq-card p {
        font-size: 0.8rem;
    }
}

/* 轮播触摸反馈 */
#faqCarousel.is-hovering {
    cursor: ns-resize;
}

/* ========== 回到顶部按钮移动端优化 ========== */
/* 移动端调整按钮位置，避免与在线咨询按钮重叠 */
@media (max-width: 768px) {
    :root {
        --mobile-fab-right: calc(env(safe-area-inset-right, 0px) + 1.5rem);
        --mobile-fab-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
        --mobile-fab-gap: 0.5rem;
        --mobile-fab-size: 3rem;
    }

    #backToTop {
        right: var(--mobile-fab-right);
        bottom: var(--mobile-fab-bottom);
    }
    
    #consultBtn {
        right: var(--mobile-fab-right);
        bottom: calc(var(--mobile-fab-bottom) + var(--mobile-fab-size) + var(--mobile-fab-gap));
    }

    footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    footer > .container {
        padding-right: calc(var(--mobile-fab-size) + var(--mobile-fab-right) + 0.75rem);
    }
}

/* ========== 页脚导航响应式优化 ========== */
/* 针对 415px 断点优化页脚导航布局 */

/* 小于 415px 时允许导航按钮换行显示 */
@media (max-width: 414px) {
    footer .flex.space-x-6 {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    footer .flex.space-x-6 a {
        text-align: center;
        min-width: 3rem;
        white-space: normal;
        word-break: keep-all;
    }
}

/* 415px 及以上保持单排显示 */
@media (min-width: 415px) {
    footer .flex.space-x-6 {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
}

/* ========== 复制提示Toast样式 ========== */
.copy-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
}

.copy-toast--visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.copy-toast--success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

.copy-toast--error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
}

/* 移动端Toast样式优化 */
@media (max-width: 640px) {
    .copy-toast {
        bottom: 1.5rem;
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
        border-radius: 0.5rem;
    }
}
