/* 全局样式 */
body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    padding-top: 100px; /* 默认为展开状态的高度 */
    transition: padding-top 0.35s ease;
}

body.navbar-scrolled {
    padding-top: 64px; /* 滚动后的高度 */
}

/* 首页轮播图 - 让导航栏覆盖在轮播图上 */
.hero-carousel {
    margin-top: -100px; /* 抵消body的padding-top，让轮播图从页面最顶部开始 */
    padding-top: 0;
}

body.navbar-scrolled .hero-carousel {
    margin-top: -64px;
}

/* 导航栏样式 */
#mainNavbar,
.navbar.navbar-dark.fixed-top {
    box-shadow: none;
    background-color: rgba(0, 64, 152, 0.8) !important;
    height: 100px;
    transition: height 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease;
}

#mainNavbar.navbar-scrolled,
.navbar.navbar-dark.fixed-top.navbar-scrolled {
    background-color: rgba(0, 64, 152, 0.9) !important;
    height: 64px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 导航栏内容垂直居中 */
#mainNavbar .container,
.navbar .container {
    height: 100%;
    display: flex;
    align-items: center;
    transition: all 0.35s ease;
}

#mainNavbar .navbar-collapse,
.navbar .navbar-collapse {
    height: auto;
}

#mainNavbar .navbar-nav,
.navbar .navbar-nav {
    align-items: center;
}

#mainNavbar .navbar-brand,
.navbar-brand {
    transition: all 0.35s ease;
}

#mainNavbar .navbar-brand img,
.navbar-brand img {
    max-height: 45px;
    transition: all 0.35s ease;
}

#mainNavbar.navbar-scrolled .navbar-brand img,
.navbar.navbar-scrolled .navbar-brand img {
    max-height: 36px;
}

#mainNavbar .navbar-brand span,
.navbar-brand span {
    font-size: 18px;
    transition: all 0.35s ease;
    color: #fff;
}

#mainNavbar.navbar-scrolled .navbar-brand span,
.navbar.navbar-scrolled .navbar-brand span {
    font-size: 15px !important;
}

#mainNavbar .nav-link,
.navbar .nav-link {
    padding: 10px 20px !important;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.35s ease;
    position: relative;
    color: #fff !important;
}

#mainNavbar.navbar-scrolled .nav-link,
.navbar.navbar-scrolled .nav-link {
    padding: 8px 16px !important;
    font-size: 14px;
}

/* 当前页面菜单下划线效果 */
#mainNavbar .nav-link.active::after,
.navbar .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
}

#mainNavbar.navbar-scrolled .nav-link.active::after,
.navbar.navbar-scrolled .nav-link.active::after {
    bottom: 0;
    width: 24px;
    height: 2px;
}

/* 移动端导航栏适配 */
@media (max-width: 991.98px) {
    body {
        padding-top: 70px;
    }
    
    body.navbar-scrolled {
        padding-top: 56px;
    }
    
    .hero-carousel {
        margin-top: -70px;
    }
    
    body.navbar-scrolled .hero-carousel {
        margin-top: -56px;
    }
    
    #mainNavbar,
    .navbar {
        height: 70px;
    }
    
    #mainNavbar.navbar-scrolled,
    .navbar.navbar-scrolled {
        height: 56px;
    }
    
    #mainNavbar .navbar-brand img,
    .navbar-brand img {
        max-height: 36px;
    }
    
    #mainNavbar.navbar-scrolled .navbar-brand img,
    .navbar.navbar-scrolled .navbar-brand img {
        max-height: 30px;
    }
    
    #mainNavbar .navbar-brand span,
    .navbar-brand span {
        font-size: 14px !important;
    }
    
    #mainNavbar.navbar-scrolled .navbar-brand span,
    .navbar.navbar-scrolled .navbar-brand span {
        font-size: 12px !important;
    }
    
    #mainNavbar .nav-link,
    .navbar .nav-link {
        padding: 10px 15px !important;
        font-size: 14px;
    }
    
    #mainNavbar.navbar-scrolled .nav-link,
    .navbar.navbar-scrolled .nav-link {
        padding: 8px 12px !important;
        font-size: 13px;
    }
    
    #mainNavbar .nav-link.active::after,
    .navbar .nav-link.active::after {
        display: none;
    }
    
    /* 移动端展开菜单时的背景 */
    #mainNavbar .navbar-collapse.show,
    #mainNavbar .navbar-collapse.collapsing,
    .navbar .navbar-collapse.show,
    .navbar .navbar-collapse.collapsing {
        background-color: rgba(0, 64, 152, 0.95);
        margin: 0 -12px;
        padding: 10px 12px;
        border-radius: 0 0 8px 8px;
    }
}

/* 主色调 */
:root {
    --primary-color: #004098;
    --secondary-color: #1a3d55;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

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

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

/* 按钮样式 */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #003080;
    border-color: #003080;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 轮播图样式 */
.carousel-item img {
    width: 100%;
    height: 500px;
    object-fit: cover;
}

/* 内容区域样式 */
.content-section {
    line-height: 1.8;
}

.content-section img {
    max-width: 100%;
    height: auto;
}

.home-about-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

/* 新闻列表样式 */
.news-list .card {
    border: none;
}

.news-list .card-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.news-list .card-title a:hover {
    text-decoration: underline;
}

/* 产品卡片样式 */
.products-grid .card-img-top {
    transition: transform 0.3s ease;
}

.products-grid .card:hover .card-img-top {
    transform: scale(1.05);
}

/* 产品列表页面样式 */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.product-card a {
    color: inherit;
    display: block;
}

.product-card .card-title {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 产品分类菜单样式 */
.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.list-group-item a:hover {
    color: var(--primary-color) !important;
}

/* 手机模式下隐藏左侧分类菜单 */
@media (max-width: 767.98px) {
    .d-none.d-md-block {
        display: none !important;
    }
}

/* 产品详情页轮播图样式 */
#productCarousel {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
}

#productCarousel .carousel-item img {
    max-height: 500px;
    width: 100%;
    object-fit: contain;
}

#productCarousel .carousel-control-prev,
#productCarousel .carousel-control-next {
    width: 10%;
}

#productCarousel .carousel-control-prev-icon,
#productCarousel .carousel-control-next-icon {
    background-color: rgba(0, 64, 152, 0.5);
    border-radius: 50%;
    padding: 20px;
}

#productCarousel .carousel-indicators button {
    background-color: var(--primary-color);
}

@media (max-width: 768px) {
    #productCarousel .carousel-item img {
        max-height: 300px;
    }
}

/* 页脚样式 */
footer {
    margin-top: auto;
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .carousel-item img {
        height: 300px;
    }
    
    .card-img-top {
        height: 200px !important;
    }
}

/* 面包屑导航 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* 表单样式 */
.contact-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 64, 152, 0.25);
}

/* 模态框样式 */
.modal-content {
    border-radius: 0.5rem;
}

/* 分页样式 */
.pagination .page-link {
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-in;
}

/* 富文本内容样式 */
.product-description,
.category-description {
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.product-description h1,
.product-description h2,
.product-description h3,
.product-description h4,
.product-description h5,
.product-description h6,
.category-description h1,
.category-description h2,
.category-description h3,
.category-description h4,
.category-description h5,
.category-description h6 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.product-description p,
.category-description p {
    margin-bottom: 1rem;
}

.product-description img,
.category-description img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.product-description ul,
.product-description ol,
.category-description ul,
.category-description ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.product-description blockquote,
.category-description blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6c757d;
}

.product-description table,
.category-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.product-description th,
.product-description td,
.category-description th,
.category-description td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
}

.product-description th,
.category-description th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.product-description a,
.category-description a {
    color: var(--primary-color);
    text-decoration: none;
}

.product-description a:hover,
.category-description a:hover {
    text-decoration: underline;
}

/* 通用富文本内容样式 */
.rich-text-content {
    line-height: 1.8;
}

.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4,
.rich-text-content h5,
.rich-text-content h6 {
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.rich-text-content p {
    margin-bottom: 0.75rem;
}

.rich-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

.rich-text-content ul,
.rich-text-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.rich-text-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.rich-text-content th,
.rich-text-content td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    text-align: left;
}

.rich-text-content th {
    background-color: #f8f9fa;
}

/* 卡片中的富文本预览（限制高度） */
.rich-text-preview {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.rich-text-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, white);
}

.rich-text-preview img {
    display: none;
}

.rich-text-preview h1,
.rich-text-preview h2,
.rich-text-preview h3,
.rich-text-preview h4,
.rich-text-preview h5,
.rich-text-preview h6 {
    font-size: 1rem;
    margin: 0;
}

/* 首页产品分类滑块样式 */
.product-slider-wrapper {
    position: relative;
}

.product-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.product-slider-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background-color: #ccc;
}

.product-slider-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: color 0.3s ease;
}

.product-slider-btn:hover {
    color: var(--primary-color);
}

.product-slider-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.product-slider-container {
    overflow: hidden;
}

.product-slider-track {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    transition: transform 0.5s ease;
    gap: 24px;
}

.product-slider-item {
    flex: 0 0 calc(25% - 18px) !important;
    min-width: calc(25% - 18px) !important;
    max-width: calc(25% - 18px) !important;
    width: calc(25% - 18px) !important;
}

.product-category-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-category-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.product-category-card:hover img {
    transform: scale(1.02);
}

.product-category-card h5 {
    margin: 16px 0 0 0;
    font-size: 16px;
    font-weight: normal;
    color: #333;
    text-align: center;
}

.product-category-card:hover h5 {
    color: var(--primary-color);
}

/* 响应式：平板 */
@media (max-width: 991.98px) {
    .product-slider-item {
        flex: 0 0 calc(33.333% - 16px) !important;
        min-width: calc(33.333% - 16px) !important;
        max-width: calc(33.333% - 16px) !important;
        width: calc(33.333% - 16px) !important;
    }
}

/* 响应式：手机 */
@media (max-width: 767.98px) {
    .product-slider-track {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .product-slider-item {
        flex: 0 0 calc(50% - 12px) !important;
        min-width: calc(50% - 12px) !important;
        max-width: calc(50% - 12px) !important;
        width: calc(50% - 12px) !important;
    }
    
    .product-category-card img {
        height: 150px;
    }
    
    .product-slider-header {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 575.98px) {
    .product-slider-track {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 16px;
    }
    
    .product-slider-item {
        flex: 0 0 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .product-slider-header h2 {
        font-size: 1.25rem;
    }
    
    .product-category-card img {
        height: 180px;
    }
}

