/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

nav {
    padding: 1rem 0;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    text-decoration: none;
    color: #666;
    transition: color 0.3s;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    position: relative;
}

.nav-menu > li > a:hover {
    color: #007bff;
}

/* 下拉箭头 */
.nav-menu > li > a::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #666;
    margin-left: 6px;
    transition: transform 0.3s;
}

.nav-menu > li:hover > a::after {
    transform: rotate(180deg);
    border-top-color: #007bff;
}

/* 隐藏没有子菜单的项目下拉箭头 */
.nav-menu > li.no-dropdown > a::after {
    display: none;
}

/* 子菜单样式 - 仅桌面端 */
@media (min-width: 769px) {
    .nav-menu ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 4px;
        min-width: 160px;
        padding: 8px 0;
        z-index: 1001;
        list-style: none;
        margin: 0;
    }

    .nav-menu > li:hover > ul {
        display: block;
    }
    
    .nav-menu ul li:hover > ul {
        display: block;
    }
}

.nav-menu ul li {
    position: relative;
}

.nav-menu ul li a {
    display: block;
    padding: 8px 16px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.nav-menu ul li a::before {
    content: '•';
    color: #007bff;
    margin-right: 8px;
    font-weight: bold;
}

.nav-menu ul li a:hover {
    background: #f8f9fa;
    color: #007bff;
}

/* 二级子菜单 */
.nav-menu ul ul {
    top: 0;
    left: 100%;
    margin-left: 1px;
}

.nav-menu ul li:hover > ul {
    display: block;
}

/* 汉堡菜单按钮样式 */
.nav-toggle {
    display: none;
}
.nav-toggle-label {
    display: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    position: relative;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
    display: block;
    position: absolute;
    width: 28px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s;
}
.nav-toggle-label span {
    top: 14px;
    left: 2px;
}
.nav-toggle-label span::before {
    content: '';
    top: -10px;
    left: 0;
}
.nav-toggle-label span::after {
    content: '';
    top: 10px;
    left: 0;
}

/* 主要内容 */
main {
    min-height: calc(100vh - 120px);
    padding: 90px 0 2rem 0; /* 顶部留出导航栏高度，90px可根据实际header高度调整 */
}



/* 特性区域 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.feature h3 {
    color: #007bff;
    margin-bottom: 1rem;
}

/* 警告消息 */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* 错误页面 */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 6rem;
    color: #007bff;
    margin-bottom: 1rem;
}

.error-page h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* 页脚 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 移动端完全禁用悬停效果 - 更强制的方式 */
    .nav-menu > li:hover > ul,
    .nav-menu ul li:hover > ul,
    .nav-menu > li:hover ul,
    .nav-menu ul li:hover ul {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        transform: none !important;
        pointer-events: none !important;
    }

    /* 确保移动端子菜单只通过点击显示 */
    .nav-menu > li.open > ul {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .nav-toggle {
        display: none !important;
    }
    .nav-toggle-label {
        display: block;
        z-index: 201;
        position: fixed;
        top: 18px;
        right: 18px;
        left: auto;
        background: transparent;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        box-shadow: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .nav-toggle-label span,
    .nav-toggle-label span::before,
    .nav-toggle-label span::after {
        display: block;
        position: absolute;
        width: 28px;
        height: 4px;
        background: #333;
        border-radius: 2px;
        transition: all 0.3s;
    }
    .nav-toggle-label span {
        top: 18px;
        left: 6px;
    }
    .nav-toggle-label span::before {
        content: '';
        top: -10px;
        left: 0;
    }
    .nav-toggle-label span::after {
        content: '';
        top: 10px;
        left: 0;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        gap: 0;
        background: #fff;
        position: fixed;
        top: 0;
        left: 0;
        width: 80vw;
        max-width: 320px;
        height: 100vh;
        box-shadow: 2px 0 16px rgba(0,0,0,0.15);
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(.77,0,.18,1);
        padding-top: 80px;
        overflow-y: auto;
    }

    .nav-menu li {
        border-bottom: 1px solid #f0f0f0;
        position: relative;
    }

    .nav-menu a {
        display: flex;
        align-items: center;
        padding: 16px 24px;
        color: #333;
        font-size: 16px;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s;
        position: relative;
    }

    .nav-menu a:hover {
        background: #f8f9fa;
        color: #007bff;
    }

    .nav-menu a.active {
        background: #e3f2fd;
        color: #007bff;
        border-left: 4px solid #007bff;
    }

    /* 菜单图标样式 - 仅移动端显示 */
    .nav-menu .menu-icon {
        width: 20px;
        height: 20px;
        margin-right: 12px;
        margin-left: 12px;
        opacity: 0.7;
        vertical-align: middle;
    }

    /* 下拉箭头 */
    .nav-menu a::after {
        content: '';
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 12px;
        height: 12px;
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M7 10l5 5 5-5z"/></svg>');
        background-size: contain;
        background-repeat: no-repeat;
        transition: transform 0.2s;
    }

    /* 展开状态的箭头 */
    .nav-menu li.open > a::after {
        transform: translateY(-50%) rotate(180deg);
    }

    /* 子菜单样式 */
    .nav-menu ul {
        display: none !important;
        background: #f8f9fa !important;
        border-left: 3px solid #e9ecef !important;
        position: static !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        min-width: auto !important;
        padding: 0 !important;
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .nav-menu li.open > ul {
        display: block !important;
    }

    .nav-menu li.open > ul {
        display: block;
    }

    .nav-menu ul li a {
        padding-left: 48px;
        font-size: 14px;
        color: #666;
    }

    .nav-menu ul li a::before {
        width: 16px;
        height: 16px;
        margin-right: 8px;
    }

    .nav-menu ul li a::after {
        display: none;
    }

    .nav-toggle:checked + .nav-toggle-label + .nav-menu {
        transform: translateX(0);
    }

    nav .container {
        position: static;
    }

    /* 遮罩层 */
    .nav-toggle:checked ~ .nav-overlay {
        display: block;
        opacity: 1;
    }

    .nav-overlay {
        display: none;
        position: fixed;
        z-index: 199;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        transition: opacity 0.3s;
        opacity: 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

/* PC端样式控制 */
@media (min-width: 769px) {
    .nav-menu {
        margin-left: auto;
    }

    .nav-menu .menu-icon {
        display: block;
        width: 18px;
        height: 18px;
        margin-right: 8px;
        margin-bottom: 0;
        opacity: 0.8;
        vertical-align: middle;
    }

    .nav-menu .menu-text {
        white-space: nowrap;
        display: inline-block;
        min-width: 2em;
        text-align: center;
    }

    /* PC端菜单项布局 */
    .nav-menu > li > a {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 8px 16px;
    }
}