/* 全局样式 */
:root {
    --primary-color: #3b82f6;
}

/* 新闻幻灯片样式 - 兼容性优化 */
.news-slideshow-container {
    position: relative;
    margin: 0 auto;
    max-width: 1200px;
    /* Safari 兼容性 */
    -webkit-user-select: none;
    user-select: none;
}

.news-slide {
    display: none;
    /* 添加浏览器前缀 */
    -webkit-animation: fade 1.5s ease-in-out;
    animation: fade 1.5s ease-in-out;
}

/* 添加关键帧动画 */
@-webkit-keyframes fade {
    from {opacity: .4} 
    to {opacity: 1}
}

@keyframes fade {
    from {opacity: .4} 
    to {opacity: 1}
}

/* 调试样式 - 可删除 */
.news-slide .grid {
    background: rgba(249, 250, 251, 0.8);
    padding: 10px;
    border-radius: 8px;
}

.news-slide .bg-white {
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.news-slide .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .news-slide .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .news-slide .grid {
        grid-template-columns: 1fr;
    }
}

.news-slide {
    display: none;
    animation: fade 1.5s ease-in-out;
}

/* 临时测试样式 - 可删除 */
.news-slide .grid {
    padding: 20px;
    background: rgba(249, 250, 251, 0.5);
}

.news-slide .bg-white {
    border: 1px solid #e5e7eb;
    height: 100%;
}

.news-slide .h-48 {
    background-color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: bold;
}

.news-prev, .news-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: #3b82f6;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(255,255,255,0.8);
}

.news-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.news-prev:hover, .news-next:hover {
    background-color: rgba(0,0,0,0.1);
}

.news-dots-container {
    text-align: center;
    padding: 20px 0;
}

.news-dot {
    cursor: pointer;
    height: 12px;
    width: 12px;
    margin: 0 4px;
    background-color: rgba(59, 130, 246, 0.4);
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.news-dot.active, .news-dot:hover {
    background-color: #3b82f6;
}

/* 场景幻灯片样式 */
.slideshow-container {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
}

/* 场景解决方案部分位置调整 */
#smart-park, #smart-garden, #digital-exhibition, #smart-property, #smart-commerce {
    scroll-margin-top: 100px; /* 滚动定位偏移 */
    padding-top: 80px;
    margin-top: -80px;
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out, background-color 1s ease-in-out;
}

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

.slide.fade {
    opacity: 1;
}

/* 方点导航样式 */
.dots-container {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 20;
}

.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin: 0 4px;
    background-color: #fff;
    opacity: 0.4;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    opacity: 1;
    transform: scale(1.3);
}

/* 左右切换按钮 - 统一样式定义 */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 65%; /* 与HTML中的内联样式保持一致 */
    width: 50px;
    height: 50px;
    margin-top: -25px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.3);
    user-select: none;
    z-index: 100; /* 确保按钮在最上层 */
    padding: 0; /* 移除可能导致点击区域问题的内边距 */
}

/* 左右按钮位置 */
.prev {
    left: 20px;
}

.next {
    right: 20px;
}

/* 悬停效果 */
.prev:hover, .next:hover {
    background-color: rgba(0,0,0,0.5);
    transform: scale(1.1); /* 添加轻微缩放效果提高可识别性 */
}

/* 移动端布局调整 */
@media (max-width: 768px) {
    #products-section .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 我们的场景解决方案卡片布局 */
    .bg-gray-50 .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* 移动端调整按钮大小和位置 */
    .prev, .next {
        width: 40px;
        height: 40px;
        margin-top: -20px;
        font-size: 20px;
    }
    
    .prev {
        left: 10px;
    }
    
    .next {
        right: 10px;
    }
}

/* 大分辨率屏幕优化 */
@media (min-width: 2400px) {
    .prev, .next {
        width: 60px;
        height: 60px;
        margin-top: -30px;
        font-size: 28px;
    }
    
    .prev {
        left: 40px;
    }
    
    .next {
        right: 40px;
    }
}

.slide {
    display: none;
}

@keyframes fade {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.slide.fade {
    animation: fade 1.5s ease-in-out;
}

/* 幻灯片圆点导航样式 */
.dots-container {
    text-align: center;
    position: relative;
    bottom: 18px; /* 上移1.5个圆点高度 (12px * 1.5) */
    padding: 10px 0;
}

.dot {
    cursor: pointer;
    height: 12px;
    width: 12px;
    margin: 0 6px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s ease;
    vertical-align: middle;
    border: 0.5px solid rgba(59, 130, 246, 0.8);
}

.dot.active {
    background-color: white;
    transform: scale(1.5);
    margin: 0 10px;
    border: 0.5px solid rgba(59, 130, 246, 1);
}

.dot:hover {
    background-color: white;
    transform: scale(1.2);
}

/* 轮播指示器样式 */
.slide-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.slide-indicator.active {
    width: 24px;
    border-radius: 4px;
    background-color: white;
}

/* 分类标签样式 */
.category-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

:root {
    --primary-color: #3b82f6;
/* 移除重复的变量声明 */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    scroll-behavior: smooth;
}

/* 导航菜单样式 */
.mega-menu {
    transform: translateY(10px);
    transition: all var(--transition-speed) ease-in-out;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 9999 !important; /* 确保二级菜单浮动到所有图层最上面 */
}

.group:hover .mega-menu {
    transform: translateY(0);
}

/* 下拉菜单渐变效果 */
.mega-menu {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed) ease, 
                transform var(--transition-speed) ease,
                visibility var(--transition-speed) ease;
    z-index: 9999 !important; /* 确保二级菜单浮动到所有图层最上面 */
}

.group:hover .mega-menu {
    opacity: 1;
    visibility: visible;
}

/* 子菜单项悬停效果 */
.submenu-item a {
    position: relative;
    transition: all 0.2s ease;
}

.submenu-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.submenu-item a:hover::after {
    width: 100%;
}

/* 卡片悬停效果 */
.card-hover,
.news-card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover,
.news-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 移动端菜单样式 */
@media (max-width: 768px) {
    /* 产品部分调整为一行2个 */
    #products-section .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #main-nav {
        background-color: white;
        border-radius: 0.5rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .mega-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        width: 100%;
        display: none;
        padding-left: 1rem;
    }
    
    .group:hover .mega-menu {
        display: block;
    }
    
    .submenu-item {
        margin-bottom: 0.5rem;
    }
}

/* 按钮样式 */
.btn {
    transition: all 0.3s ease;
}

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

/* 页面过渡动画 */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滚动平滑效果 */
html {
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 二级子菜单样式 */
.submenu-item {
    position: relative;
}

.submenu-item .sub-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all var(--transition-speed) ease;
    z-index: 9999 !important; /* 确保三级菜单也浮动到所有图层最上面 */
}

.submenu-item:hover .sub-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .submenu-item .sub-submenu {
        position: static;
        box-shadow: none;
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        padding-left: 1rem;
    }
    
    .submenu-item:hover .sub-submenu {
        display: block;
    }
}

/* 表单样式 */
.form-input {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* 加载动画 */
.loader {
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid var(--primary-color);
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图标悬停效果 */
.icon-hover {
    transition: transform 0.3s ease, color 0.3s ease;
}

.icon-hover:hover {
    transform: scale(1.2);
    color: var(--primary-color);
}

/* 响应式图片 */
.responsive-img {
    max-width: 100%;
    height: auto;
}

/* 页面标题动画 */
.title-animation {
    position: relative;
}

.title-animation::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.title-animation:hover::after {
    width: 100%;
}
