/**
 * 头部和页脚样式
 * 遵循 DESIGN_SYSTEM.md 设计规范
 * 
 * @package MTO Moving
 * @since 1.0.0
 */

/* ==========================================================================
   主导航栏样式
   ========================================================================== */

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.main-header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.main-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

/* Logo区域 */
.site-branding {
    flex-shrink: 0;
}

.site-branding img {
    height: 50px;
    width: auto;
}

.site-logo-text {
    text-decoration: none;
}

.site-name {
    font-size: 24px;
    font-weight: 700;
    color: #2c5f8d;
}

/* 主导航菜单 */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 32px;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    padding: 8px 0;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #2c5f8d;
    transition: width 0.3s ease;
}

.nav-menu a:hover,
.nav-menu li.current-menu-item a {
    color: #2c5f8d;
}

.nav-menu a:hover::after,
.nav-menu li.current-menu-item a::after {
    width: 100%;
}

/* 二级菜单（下拉菜单）样式 */
.nav-menu .menu-item-has-children {
    position: relative;
}

.nav-menu .menu-item-has-children > a::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    vertical-align: middle;
    transition: transform 0.3s ease;
}

.nav-menu .menu-item-has-children:hover > a::before,
.nav-menu .menu-item-has-children.active > a::before {
    transform: rotate(180deg);
}

/* 二级菜单容器 */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #ffffff;
    list-style: none;
    margin: 8px 0 0 0;
    padding: 12px 0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.nav-menu .menu-item-has-children:hover > .sub-menu,
.nav-menu .menu-item-has-children.active > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 二级菜单项 */
.nav-menu .sub-menu li {
    margin: 0;
}

.nav-menu .sub-menu a {
    display: block;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 400;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-menu .sub-menu a::after {
    display: none; /* 移除下划线效果 */
}

.nav-menu .sub-menu a:hover {
    background: #f8fafc;
    color: #2c5f8d;
    border-left-color: #2c5f8d;
    padding-left: 28px;
}

.nav-menu .sub-menu li.current-menu-item a {
    background: #f8fafc;
    color: #2c5f8d;
    border-left-color: #2c5f8d;
}

/* 三级菜单（如果需要）*/
.nav-menu .sub-menu .menu-item-has-children {
    position: relative;
}

.nav-menu .sub-menu .menu-item-has-children > a::after {
    content: '›';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 600;
}

.nav-menu .sub-menu .sub-menu {
    top: 0;
    left: 100%;
    margin: 0 0 0 8px;
}

/* 头部操作区 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* 头部按钮统一样式 */
.header-actions .btn {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
}

.header-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    color: #27ae60;
    text-decoration: none;
    border: 2px solid #27ae60;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.header-phone:hover {
    background: #27ae60;
    color: #ffffff;
}

.header-phone svg {
    width: 20px;
    height: 20px;
}

.phone-number {
    font-family: 'Poppins', sans-serif;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px;
    min-width: 48px; /* 确保足够的点击区域 */
    min-height: 48px;
    margin-right: -12px; /* 抵消padding，与边缘对齐 */
}

.mobile-menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: #2c5f8d;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ==========================================================================
   移动端菜单
   ========================================================================== */

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-logo img {
    height: 40px;
}

.mobile-menu-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #2c3e50;
}

.mobile-menu-close:hover {
    color: #2c5f8d;
}

.mobile-navigation {
    padding: 24px 0;
}

.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-menu li {
    margin: 0;
}

.mobile-nav-menu a {
    display: block;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 500;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu li.current-menu-item a {
    background: #f8fafc;
    color: #2c5f8d;
    border-left-color: #2c5f8d;
}

/* 移动端二级菜单 */
.mobile-nav-menu .menu-item-has-children {
    position: relative;
}

.mobile-nav-menu .menu-item-has-children > a {
    position: relative;
    padding-right: 48px; /* 为切换按钮留出空间 */
}

/* 子菜单切换按钮 */
.submenu-toggle {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c5f8d;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.submenu-toggle:hover {
    background: rgba(44, 95, 141, 0.1);
}

.submenu-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.menu-item-has-children.active > .submenu-toggle svg {
    transform: rotate(180deg);
}

.mobile-nav-menu .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav-menu .menu-item-has-children.active > .sub-menu {
    max-height: 500px; /* 足够大的值 */
}

.mobile-nav-menu .sub-menu li {
    margin: 0;
}

.mobile-nav-menu .sub-menu a {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 400;
    border-left: 2px solid #e0e0e0;
}

.mobile-nav-menu .sub-menu a:hover {
    border-left-color: #2c5f8d;
}

.mobile-menu-footer {
    padding: 24px;
    border-top: 1px solid #e0e0e0;
}

.mobile-phone-btn,
.mobile-email-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    margin-bottom: 12px;
    background: #f8fafc;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-phone-btn:hover,
.mobile-email-btn:hover {
    background: #2c5f8d;
    color: #ffffff;
}

.mobile-phone-btn svg,
.mobile-email-btn svg {
    width: 20px;
    height: 20px;
}

/* 移动端菜单遮罩 */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   页脚样式
   ========================================================================== */

.main-footer {
    background: #2c5f8d;
    color: #ffffff;
}

/* 页脚容器宽度限制 - 遵循 DESIGN_SYSTEM.md (最大宽度1200px) */
.main-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-top {
    padding: 64px 0 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 48px;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
}

.footer-desc {
    font-size: 15px;
    line-height: 1.6;
    color: #ecf0f1;
    margin-bottom: 16px;
}

.footer-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #ecf0f1;
}

.footer-badge svg {
    width: 16px;
    height: 16px;
    color: #27ae60;
}

.footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-menu li {
    margin-bottom: 12px;
}

.footer-menu a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.3s ease;
    display: inline-block;
}

.footer-menu a:hover {
    color: #ffffff;
    padding-left: 8px;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: #ecf0f1;
}

.contact-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.contact-item a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: #ffffff;
}

.footer-qr {
    text-align: center;
}

.qr-code {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
}

.qr-label {
    font-size: 14px;
    color: #ecf0f1;
    margin: 0;
}

/* 页脚底部 */
.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 24px 0;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright p {
    margin: 0;
    font-size: 14px;
    color: #ecf0f1;
}

.footer-nav {
    display: flex;
    gap: 24px;
}

.footer-nav a {
    font-size: 14px;
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: #ffffff;
}

/* ==========================================================================
   固定悬浮按钮
   ========================================================================== */

.floating-contact {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 998;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.float-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.phone-btn {
    background: #27ae60;
    color: #ffffff;
    text-decoration: none;
}

.wechat-btn {
    background: #07c160;
    color: #ffffff;
}

.float-wechat {
    position: relative;
}

.wechat-qr-popup {
    position: absolute;
    right: calc(100% + 12px);
    bottom: 0;
    width: 200px;
    padding: 16px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateX(10px);
}

.float-wechat:hover .wechat-qr-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.wechat-qr-popup img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 8px;
}

.wechat-qr-popup p {
    text-align: center;
    font-size: 14px;
    color: #2c3e50;
    margin: 0;
    font-weight: 500;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 160px;
    width: 48px;
    height: 48px;
    background: rgba(44, 95, 141, 0.9);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 997;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #2c5f8d;
    transform: translateY(-4px);
}

/* ==========================================================================
   响应式设计 - 平板 (< 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    .nav-menu {
        gap: 20px;
    }
    
    .nav-menu a {
        font-size: 15px;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

/* ==========================================================================
   响应式设计 - 移动端 (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .header-content {
        height: 64px;
        justify-content: space-between; /* Logo左侧，菜单按钮右侧 */
    }
    
    .site-branding {
        flex: 0 0 auto; /* 不扩展 */
    }
    
    .site-branding img {
        height: 40px;
    }
    
    .main-nav {
        display: none;
    }
    
    /* 移动端隐藏电话按钮和估价按钮 */
    .header-phone,
    .header-actions .btn {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* 移动端头部操作区只包含菜单按钮 */
    .header-actions {
        gap: 0;
        flex: 0 0 auto; /* 不扩展 */
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .footer-top {
        padding: 48px 0 32px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .footer-nav {
        flex-direction: column;
        gap: 12px;
    }
    
    .floating-contact {
        right: 16px;
        bottom: 16px;
    }
    
    .float-btn {
        width: 52px;
        height: 52px;
    }
    
    .wechat-qr-popup {
        right: auto;
        left: 50%;
        bottom: calc(100% + 12px);
        transform: translateX(-50%) translateY(10px);
    }
    
    .float-wechat:hover .wechat-qr-popup {
        transform: translateX(-50%) translateY(0);
    }
    
    .back-to-top {
        right: 16px;
        bottom: 140px;
        width: 44px;
        height: 44px;
    }
}

/* ==========================================================================
   辅助功能和无障碍
   ========================================================================== */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2c5f8d;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* 确保页面内容不被固定头部遮挡 */
body {
    padding-top: 80px;
}

@media (max-width: 768px) {
    body {
        padding-top: 64px;
    }
}

