/* 自定义工具类 */
.content-auto {
    content-visibility: auto;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.product-card {
    @apply bg-white rounded-xl shadow-md overflow-hidden transition-all duration-300 hover:shadow-xl hover:-translate-y-1;
}

.section-padding {
    @apply py-16 md:py-24;
}

/* 英雄区域文字优化样式 */
.hero-title {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.hero-subtitle {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-description {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* 优化按钮样式 */
.hero-button {
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.hero-button:hover {
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.4);
    transform: translateY(-2px);
}

/* 修复首页背景色问题 */
body {
    background-color: #ffffff; /* 确保背景为白色 */
}

/* 风格切换样式 */
.style-elegant {
    --tw-primary: #F9C642;
    --tw-secondary: #333333;
}

.style-modern {
    --tw-primary: #4A90E2;
    --tw-secondary: #1D3557;
}

.style-default {
    --tw-primary: #E63946;
    --tw-secondary: #1D3557;
}

/* 语言选择器样式优化 */
#languageDropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    /* 确保在移动端也正确显示 */
    left: auto;
    width: auto;
    min-width: 160px;
    max-height: 240px; /* 限制最大高度 */
    /* 添加阴影效果 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    /* 确保在其他元素上方显示 */
    z-index: 1000;
    pointer-events: none; /* 初始状态下不响应事件 */
    overflow-y: auto; /* 添加滚动条 */
}

#languageDropdown:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto; /* 显示时响应事件 */
}

/* 确保语言选择器按钮在小屏幕下不换行 */
#languageButton {
    white-space: nowrap;
    min-width: 60px;
    font-size: 0.75rem; /* text-xs */
    /* 确保按钮在各种背景上都可见 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    user-select: none;
    z-index: 1001;
}

/* 语言选择器图标样式 */
#languageButton svg {
    max-width: 12px;
    max-height: 12px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #languageButton {
        min-width: 50px;
        padding: 0.25rem 0.5rem;
        font-size: 0.625rem; /* 更小的字体在移动端 */
    }
    
    #languageDropdown {
        min-width: 160px;
        right: 0;
        left: auto;
        max-height: 200px; /* 移动端限制最大高度 */
    }
}

/* 修复按钮点击区域问题 */
button {
    cursor: pointer;
    user-select: none;
    outline: none;
}

/* 确保所有按钮都有明确的z-index */
button {
    z-index: 1;
}

/* 特别处理语言选择器按钮 */
#languageButton,
#languageDropdown button {
    z-index: 1001;
}

/* 确保轮播按钮可见 */
.carousel-button {
    z-index: 10;
    cursor: pointer;
    user-select: none;
}

/* 修复可能的pointer-events问题 */
* {
    /* 确保所有元素默认响应事件 */
    pointer-events: auto;
}

/* 但隐藏元素不响应事件 */
.hidden,
.invisible {
    pointer-events: none;
}

/* 确保固定定位元素响应事件 */
.fixed {
    pointer-events: auto;
}

/* 样式切换器特定样式 */
#style-switcher .flex.items-center {
    display: flex !important;
    visibility: visible !important;
}

/* 确保在移动端也可见 */
@media (max-width: 768px) {
    #language-selector *, #style-switcher * {
        visibility: visible !important;
        display: block !important;
    }
    
    /* 移动端语言选择器优化 */
    #languageDropdown {
        position: absolute;
        top: 100%;
        right: 0;
        left: auto;
        width: 100%;
        max-width: 180px;
        margin: 0;
        border-radius: 0 0 8px 8px;
    }
    
    /* 移动端语言按钮优化 */
    #languageButton {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* 进一步确保元素可见 */
#language-selector *, #style-switcher * {
    visibility: visible !important;
    display: block !important;
}

/* 特别确保样式切换器容器可见 */
#style-switcher .flex.items-center {
    display: flex !important;
    opacity: 1 !important;
}

/* 按钮样式优化 */
button[data-lang] {
    transition: all 0.2s ease;
}

button[data-lang]:hover {
    background-color: rgba(0,0,0,0.05);
}

/* 轮播海报样式修复 */
#hero {
    width: 100%;
    max-width: 100%;
    height: 100vh;
}

.carousel-container {
    width: 100%;
    height: 100%;
}

.carousel {
    width: 100%;
    height: 100%;
}

.carousel-item {
    width: 100%;
    height: 100%;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 确保轮播容器占满整个屏幕宽度 */
#hero .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
}

/* 确保hero部分占满整个屏幕 */
#hero {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

/* 确保整个页面布局为整屏幕宽度显示 */
.container {
    max-width: 100%;
    padding-left: 2rem;
    padding-right: 2rem;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

/* 防止水平滚动 */
body, html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* 调整英雄区域文字间距，防止重叠 */
#hero .carousel-caption h3 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

#hero .carousel-caption p {
    line-height: 1.5;
    margin-bottom: 0;
}

#hero .container h1 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

#hero .container p {
    line-height: 1.5;
    margin-bottom: 2rem;
}

/* 优化专利证书展示模块 */
#certificates {
    height: 850px;
}

#certificates .container.mx-auto.px-4 {
    max-width: 80%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin: 0 auto;
}

/* 确保证书轮播容器相对定位 */
.certificate-slider {
    position: relative;
    overflow: hidden;
    padding: 0 50px;
}

.certificate-prev {
    left: 0;
}

.certificate-next {
    right: 0;
}

/* 调整证书轮播图箭头位置 */
.certificate-prev,
.certificate-next {
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    z-index: 10;
    margin-top: 0;
    /* 添加额外的居中调整 */
    display: flex;
    align-items: center;
    justify-content: center;
    /* 进一步优化垂直居中 */
    align-self: center;
}

#certificates .swiper-slide {
    height: auto !important;
}

/* 确保证书轮播容器相对定位 */
.certificate-slider {
    position: relative;
}

#certificates .swiper-slide .bg-white {
    height: auto;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

#certificates .swiper-slide .w-48.h-48 {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#certificates .swiper-slide .w-48.h-48 img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

#certificates .swiper-slide .text-xl {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

#certificates .swiper-slide .text-gray-600.mb-4 {
    margin-bottom: 0.25rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#certificates .swiper-slide .inline-block {
    align-self: center;
    margin-top: 0.5rem;
}

/* 优化证书轮播图导航箭头 */
.certificate-prev, .certificate-next {
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.certificate-prev:hover, .certificate-next:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.certificate-prev::after, .certificate-next::after {
    font-size: 20px;
    color: #333;
    font-weight: bold;
}

/* 响应式优化 */
@media (max-width: 768px) {
    #certificates {
        height: auto;
    }
    
    #certificates .container.mx-auto.px-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    #certificates .swiper-slide .bg-white {
        padding: 0.5rem;
    }
    
    #certificates .swiper-slide .text-xl {
        font-size: 1rem;
    }
    
    #certificates .swiper-slide .w-48.h-48 {
        margin-bottom: 0.25rem;
    }
    
    #certificates .swiper-slide .text-gray-600.mb-4 {
        margin-bottom: 0.125rem;
    }
}

/* 自定义样式 */

/* 语言切换器样式 */
.language-transition {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.dropdown-enter {
    opacity: 0;
    transform: translateY(-10px);
}

.dropdown-enter-active {
    opacity: 1;
    transform: translateY(0);
}

/* 为"探索我们的产品"按钮添加文字颜色定义 */
.text-\[#1E3A8A\] {
  --tw-text-opacity: 1;
  color: rgb(30 58 138 / var(--tw-text-opacity));
}

/* 响应式调整 */
@media (max-width: 768px) {
    #languageSwitcher {
        margin-left: 0;
        margin-top: 1rem;
    }
    
    #languageDropdown {
        width: 100%;
        right: 0;
        left: 0;
    }
}