/* 响应式导航组件样式 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 导航容器 */
.responsive-nav {
    width: 100%;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* 导航内容容器 */
.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

/* 左侧logo和菜单 */
.nav-left {
    display: flex;
    align-items: center;
    flex: 1;
}

/* Logo样式 */
.nav-logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    margin-right: 40px;
    transition: color 0.3s ease;
}

.nav-logo:hover {
    color: #555;
}

/* 主导航菜单 */
.main-nav {
    display: flex;
    list-style: none;
}

.main-nav li {
    position: relative;
    margin-right: 10px;
}

.main-nav li a,
.main-nav li span {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.main-nav li:hover > a,
.main-nav li:hover > span {
    background-color: #f5f5f5;
    color: #555;
}

/* 下拉菜单样式 - 现代设计 */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    margin-top: 5px;
    z-index: 999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.main-nav li.dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-content a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #f5f5f5;
    padding-left: 25px;
}

.dropdown-content hr {
    margin: 8px 0;
    border: 0;
    border-top: 1px solid #eee;
}

.dropdown-content h4 {
    padding: 10px 20px 5px;
    font-size: 14px;
    color: #999;
    text-transform: uppercase;
}

/* 右侧功能区 */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 搜索按钮 */
.search-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #f5f5f5;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.search-toggle:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* 通用导航按钮样式 - 用于其他按钮 */
.nav-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: #f5f5f5;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-button:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* 搜索面板 */
.search-panel {
    position: fixed;
    top: -100%;
    left: 0;
    right: 0;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 998;
    transition: top 0.3s ease;
}

.search-panel.active {
    top: 60px;
}

.search-form {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #ccc;
}

.search-submit {
    padding: 12px 24px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.search-submit:hover {
    background-color: #555;
}

/* 登录按钮 */
.login-button {
    /* 使用通用导航按钮样式 */
}

.login-button i {
    font-size: 16px;
}

.login-button img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.login-button span {
    display: none;
}

/* 头像下拉菜单样式 */
.nav-right .dropdown {
    position: relative;
}

.nav-right .dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* 头像下拉菜单靠右显示 */
.nav-right .dropdown .dropdown-content {
    left: auto;
    right: 0;
}

/* 在非登录状态下显示文本 */
.login-button:not(.logged-in) {
    width: auto;
    border-radius: 25px;
    padding: 0 15px;
    gap: 8px;
}

.login-button:not(.logged-in) span {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

/* 登录后的样式调整 */
.login-button.logged-in {
    background-color: #f5f5f5;
}

/* 添加新工具按钮 */
.add-tool-button {
    /* 使用通用导航按钮样式 */
}


.add-tool-button span {
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 移动端汉堡菜单按钮 */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    position: relative;
}

.mobile-menu-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px auto;
    transition: all 0.3s ease;
}

/* 移动端菜单样式 */
.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 280px;
    background-color: #fff;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
    z-index: 997;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* 手风琴菜单样式 */
.accordion-menu {
    list-style: none;
}

.accordion-menu li {
    border-bottom: 1px solid #eee;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.accordion-header:hover {
    background-color: #f5f5f5;
}

.accordion-header a {
    color: #333;
    text-decoration: none;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-content.active {
    max-height: 500px;
}

.accordion-content a {
    display: block;
    padding: 10px 20px 10px 40px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
}

.accordion-content a:hover {
    background-color: #f5f5f5;
    padding-left: 45px;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .main-nav li a,
    .main-nav li span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .nav-right {
        gap: 10px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input,
    .search-submit {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-content {
        padding: 0 15px;
    }
    
    .nav-logo {
        font-size: 20px;
        margin-right: 20px;
    }
    
    .mobile-menu {
        width: 100%;
    }
    
    .search-panel.active {
        top: 60px;
    }
}

@media (max-width: 480px) {
    .nav-content {
        height: 50px;
    }
    
    .nav-logo {
        font-size: 18px;
    }
    
    .login-button span {
        display: none;
    }
    
    .search-toggle,
    .login-button,
    .add-tool-button {
        width: 35px;
        height: 35px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .search-panel.active {
        top: 50px;
    }
    
    .mobile-menu {
        top: 50px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 滚动时导航栏样式变化 */
.responsive-nav.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 加载动画 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}