/* ==========================================================================
   二级菜单（PC 下拉）视觉优化 + 丝滑过渡
   覆盖 base.css 的 .drop-menu / .nav-second-pro / .nav-second
   ========================================================================== */

/* ---------- 面板容器：默认隐藏，靠 :hover 平滑展开 ---------- */
.header .drop-menu {
    position: absolute;
    top: 100% !important;
    left: 50% !important;
    width: 100vw !important;
    margin-left: -50vw;
    padding: 0;
    background: #fff;
    border-top: 1px solid #eef1f4;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .10);
    z-index: 1001;
    box-sizing: border-box;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    /* 关闭时延迟 120ms，给鼠标穿过缝隙的容错时间 */
    transition: opacity .16s ease .12s,
                transform .2s cubic-bezier(.22, .68, .38, 1) .12s,
                visibility 0s linear .28s;
    will-change: opacity, transform;
}

/* 展开态：立即响应，无延迟 */
.menu li.main-menu:hover > .drop-menu,
.menu li.main-menu.is-focused > .drop-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity .14s ease 0s,
                transform .18s cubic-bezier(.22, .68, .38, 1) 0s,
                visibility 0s linear 0s;
}

/* 不可见的悬停桥：填补导航与面板之间的缝隙，鼠标穿过时不中断 hover */
.menu li.main-menu:hover::after {
    content: '';
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    height: 14px;
    background: transparent;
}

/* 顶部主色装饰线 */
.header .drop-menu::before {
    content: '';
    position: absolute;
    left: 0;
    top: -1px;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #167cba 0%, #4aa8e0 45%, rgba(22, 124, 186, 0) 100%);
}

/* ---------- 面板内容：统一布局容器 ---------- */
.header .drop-menu > .container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    align-items: stretch;
    padding-top: 20px;
    padding-bottom: 20px;
    overflow: visible;

    /* 内容跟随面板轻微上移淡入 */
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease 0s, transform .2s ease 0s;
}

.menu li.main-menu:hover > .drop-menu > .container,
.menu li.main-menu.is-focused > .drop-menu > .container {
    opacity: 1;
    transform: translateY(0);
    transition-delay: .03s;
}

/* 文字类下拉（无产品图）：整行横向排布 */
.header .drop-menu > .container:has(> .nav-second) {
    display: block;
    padding-top: 18px;
    padding-bottom: 18px;
}

/* ---------- 产品类下拉：等高图文卡片 ---------- */
.header .nav-second-pro {
    float: none;
    width: auto;
    height: auto;
    padding: 14px 8px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    transition: background .25s ease, transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.header .nav-second-pro:hover {
    background: #f4f9fd;
    border-color: #d9e8f4;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(22, 124, 186, .12);
}

/* 图片区固定高度，统一 contain，杜绝大小不一 */
.header .nav-second-pro .second-pro-img {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    flex: 0 0 100px;
}

.header .nav-second-pro .second-pro-img img {
    max-width: 92%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform .3s ease;
}

.header .nav-second-pro:hover .second-pro-img img {
    transform: scale(1.06);
}

/* 文字区固定高度 + 白底衬，保证基线与可读性 */
.header .nav-second-pro .second-pro-name {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #fff;
    border-radius: 6px;
    padding: 4px 6px;
    box-sizing: border-box;
}

.header .nav-second-pro .second-pro-name a {
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.45;
    text-decoration: none;
    transition: color .25s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.header .nav-second-pro:hover .second-pro-name a {
    color: #167cba;
}

/* ---------- 文字类下拉：胶囊标签 ---------- */
.header .nav-second {
    float: none;
    display: inline-block;
    vertical-align: top;
    width: auto;
    height: auto;
    line-height: normal;
    padding: 2px;
    box-sizing: border-box;
}

.header .nav-second a {
    display: inline-block;
    padding: 9px 18px;
    margin: 4px 2px;
    font-size: 15px;
    font-weight: 500;
    color: #555;
    background: #f6f8fa;
    border-radius: 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: all .25s ease;
}

.header .nav-second a:hover {
    color: #fff;
    background: #167cba;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(22, 124, 186, .25);
}

/* ---------- 平板及以下：走移动端菜单 ---------- */
@media screen and (max-width: 992px) {
    .header .drop-menu {
        display: none !important;
    }
}

/* ---------- 中等屏幕：5 列 ---------- */
@media screen and (max-width: 1240px) {
    .header .drop-menu > .container {
        grid-template-columns: repeat(5, 1fr);
    }

    .header .nav-second-pro .second-pro-img {
        height: 84px;
        flex: 0 0 84px;
    }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    .header .drop-menu,
    .header .drop-menu > .container {
        transition: none !important;
    }
}

/* ==========================================================================
   在线留言弹层
   ========================================================================== */
.msg-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    visibility: hidden;
    opacity: 0;
    transition: opacity .28s ease, visibility .28s ease;
    z-index: 2000;
    box-sizing: border-box;
}

.msg-modal.is-open {
    visibility: visible;
    opacity: 1;
}

.msg-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 31, .55);
    backdrop-filter: blur(2px);
}

.msg-modal-panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    padding: 30px 32px 28px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(18px) scale(.97);
    transition: transform .32s cubic-bezier(.34, 1.28, .64, 1);
    box-sizing: border-box;
}

.msg-modal.is-open .msg-modal-panel {
    transform: translateY(0) scale(1);
}

/* 关闭按钮 */
.msg-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 22px;
    line-height: 34px;
    text-align: center;
    color: #8b95a1;
    background: #f1f4f7;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background .25s ease, color .25s ease;
    z-index: 20;
    /* 保证触屏可点，不被其他元素遮挡 */
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.msg-modal-close:hover,
.msg-modal-close:active {
    color: #fff;
    background: #167cba;
}

/* 头部 */
.msg-modal-head {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef1f4;
}

.msg-modal-title {
    position: relative;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    padding-left: 12px;
}

.msg-modal-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 20px;
    margin-top: -10px;
    background: #167cba;
    border-radius: 2px;
}

.msg-modal-sub {
    margin-top: 8px;
    padding-left: 12px;
    font-size: 13px;
    color: #8b95a1;
}

/* 表单字段 */
.msg-field {
    margin-bottom: 16px;
}

.msg-field > label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    color: #444;
    font-weight: 500;
}

.msg-field > label em {
    color: #e05a4a;
    font-style: normal;
    margin-left: 2px;
}

.msg-input,
.msg-textarea {
    width: 100%;
    padding: 0 14px;
    font-size: 15px;
    font-family: inherit;
    color: #222;
    background: #f7f9fb;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}

.msg-input {
    height: 44px;
}

.msg-textarea {
    padding: 12px 14px;
    line-height: 1.65;
    resize: vertical;
    min-height: 100px;
}

.msg-input:focus,
.msg-textarea:focus {
    background: #fff;
    border-color: #167cba;
    box-shadow: 0 0 0 3px rgba(22, 124, 186, .12);
}

.msg-input::placeholder,
.msg-textarea::placeholder {
    color: #aab4bf;
}

.msg-field.has-error .msg-input,
.msg-field.has-error .msg-textarea {
    border-color: #e05a4a;
    background: #fff8f7;
}

.msg-error {
    display: block;
    min-height: 16px;
    margin-top: 5px;
    font-size: 12px;
    color: #e05a4a;
    line-height: 1.3;
}

/* 验证码行 */
.msg-code-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.msg-code-row .msg-input {
    flex: 1;
}

.msg-code-img {
    flex: 0 0 118px;
    width: 118px;
    height: 44px;
    object-fit: cover;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    cursor: pointer;
    background: #f7f9fb;
    transition: border-color .25s ease;
}

.msg-code-img:hover {
    border-color: #167cba;
}

/* 提示 */
.msg-tip {
    display: none;
    margin-bottom: 14px;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 8px;
    line-height: 1.5;
}

.msg-tip.is-ok,
.msg-tip.is-err {
    display: block;
}

.msg-tip.is-ok {
    color: #1a7f4b;
    background: #eaf7f0;
    border: 1px solid #c5e9d6;
}

.msg-tip.is-err {
    color: #c0392b;
    background: #fdf0ee;
    border: 1px solid #f6d3cd;
}

/* 提交按钮 */
.msg-submit {
    width: 100%;
    height: 48px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #167cba 0%, #0d5a8a 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all .28s ease;
}

.msg-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(22, 124, 186, .3);
}

.msg-submit:disabled {
    opacity: .65;
    cursor: not-allowed;
}

body.msg-locked {
    overflow: hidden;
}

/* 移动端弹层：底部抽屉式 */
@media screen and (max-width: 768px) {
    .msg-modal {
        align-items: flex-end;
        padding: 0;
    }

    .msg-modal-panel {
        max-width: none;
        max-height: 92vh;
        padding: 24px 20px 24px;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .msg-modal.is-open .msg-modal-panel {
        transform: translateY(0);
    }

    .msg-modal-title {
        font-size: 19px;
    }

    /* 移动端关闭按钮稍大，便于点按；固定在面板顶部不随滚动移出 */
    .msg-modal-close {
        position: sticky;
        top: 0;
        float: right;
        width: 40px;
        height: 40px;
        line-height: 38px;
        font-size: 24px;
        margin: -6px -6px 6px 0;
        background: rgba(241, 244, 247, .96);
        backdrop-filter: blur(4px);
    }

    .msg-input {
        height: 46px;
        font-size: 16px; /* 防 iOS 缩放 */
    }

    .msg-textarea {
        font-size: 16px;
    }

    .msg-code-img {
        flex: 0 0 100px;
        width: 100px;
        height: 46px;
    }

    .msg-submit {
        height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .msg-modal,
    .msg-modal-panel,
    .msg-submit,
    .msg-modal-close {
        transition: none !important;
    }
}
