/* ============================
   1. 全局重置
   ============================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    background-color: #f9f9f9;
}

/* ============================
   2. 导航栏容器 (.nav)
   ============================ */
.nav {
    display: flex;
    align-items: center;       /* 垂直居中 */
    justify-content: space-between; /* 左右两端对齐 */
    
    position: fixed; /* 固定定位，相对于浏览器窗口 */
    top: 0;          /* 紧贴顶部 */
    left: 0;         /* 紧贴左侧 */
    width: 100%;     /* 宽度保持100% */
    z-index: 1000;   /* 确保层级最高，覆盖在轮播图上方 */

    height: 80px;
    padding: 0 40px;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1000;
}

/* Logo 样式 */
.nav-logo img {
    height: 50px;
    width: auto;
    padding: 0 20px 0 0;
    display: block;
}

/* ============================
   3. 主菜单 (.main-menu)
   ============================ */
.main-menu {
    display: flex;             /* 横向排列 */
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;                 /* 主菜单项之间的间距 */
    align-items: center;
}

/* 主菜单项 */
.menu-item {
    position: relative;        /* 为下拉菜单提供定位参考 */
    margin: 0;
}

/* 主菜单链接 */
.menu-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 16px;
    padding: 10px 0;
    display: block;
    transition: color 0.3s;
}

.menu-link:hover {
    color: #007bff;
}

/* ============================
   4. 下拉菜单 (.dropdown-menu)
   ============================ */
.dropdown-menu {
    /* 布局重置：防止继承主菜单的 flex 和 gap */
    display: none;             /* 默认隐藏 */
    position: absolute;        /* 绝对定位，脱离文档流 */
    top: 100%;                 /* 紧贴父元素底部 */
    left: 0;
    
    /* 垂直排列 */
    flex-direction: column;    
    list-style: none;
    margin: 0;
    padding: 10px 0;           /* 上下内边距 */
    
    /* 外观样式 */
    min-width: 180px;
    background-color: #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-radius: 6px;
    z-index: 1001;             /* 确保在最上层 */
    
    /* 关键：强制覆盖任何继承的 gap */
    gap: 0 !important; 
}

/* 下拉菜单项链接 */
.dropdown-menu li a {
    display: block;
    padding: 12px 20px;        /* 控制每一项的高度/间距 */
    color: #555;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;       /* 防止文字换行 */
    transition: all 0.2s;
}

/* 下拉菜单悬停效果 */
.dropdown-menu li a:hover {
    background-color: #f0f7ff;
    color: #007bff;
    padding-left: 25px;        /* 轻微右移效果 */
}

/* ============================
   5. 交互逻辑 (Hover)
   ============================ */
/* 当鼠标悬停在 .has-dropdown 上时，显示其内部的 .dropdown-menu */
.menu-item.has-dropdown:hover .dropdown-menu {
    display: flex;             /* 切换为 flex 以应用 column 布局 */
    animation: fadeIn 0.2s ease-in-out;
}

/* 可选：添加一个简单的淡入动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 增加一个隐形区域，防止鼠标从文字移向菜单时断开 */
.menu-item.has-dropdown {
    padding-bottom: 20px;
    margin-bottom: -20px;
}

/* ============================
   6. 轮播图样式 (Carousel)
   ============================ */
.carousel {
    position: relative;
    width: 100%;
    max-width: 1200px; /* 限制最大宽度 */
    margin: 0 auto 60px; /* 居中并给下方留空 */
    overflow: hidden;
    border-radius: 12px; /* 圆角 */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.carousel-inner {
    position: relative;
    width: 100%;
    height: 500px; /* 轮播图高度 */
}

.carousel-item {
    display: none; /* 默认隐藏 */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.carousel-item.active {
    display: block;
    opacity: 1;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保证图片覆盖整个区域且不变形 */
}

/* 控制按钮 */
.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    font-size: 24px;
    color: #333;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    transition: all 0.3s;
}

.carousel-control:hover {
    background-color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.carousel-control.prev {
    left: 20px;
}

.carousel-control.next {
    right: 20px;
}

/* 指示器 */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}

.indicator.active {
    background-color: white;
}