/* =====================================================
   Blocksy Mega Menu v1.5
   ===================================================== */

/* =====================================================
   桌面端（> 1024px）
   ===================================================== */
@media (min-width: 1025px) {

    /* 关键：让 li 本身作为定位父级 */
    .bmm-has-panel {
        position: relative !important;
    }

    /* ---- 面板：相对于 li 定位，top=100% 自动紧跟导航项底部 ---- */
    .bmm-panel {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        top: 100%;
        left: 100%;
        transform: translateX(-50%) translateY(-6px);
        width: min(var(--bmm-width, 900px), 92vw);
        background: var(--bmm-bg, #1a1a1a);
        color: var(--bmm-text, #ffffff);
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0,0,0,.5);
        z-index: 99999;
        transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
        /* 向上延伸覆盖 li 和面板之间的间隙，防止鼠标"掉落" */
        margin-top: 10px;
    }

    /* 桥接区域：覆盖 li 底部到面板顶部的空白 */
    .bmm-panel::before {
        content: '';
        position: absolute;
        top: -14px;
        left: 0;
        right: 0;
        height: 14px;
        background: transparent;
    }

    .bmm-has-panel:hover > .bmm-panel,
    .bmm-has-panel.bmm-open > .bmm-panel {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }

    /* ---- 面板内部 ---- */
    .bmm-panel-inner {
        padding: 35px;
    }

    /* 标题 */
    .bmm-panel-title {
        font-size: 1.125rem;
        font-weight: 700;
        color: var(--bmm-text, #fff);
        text-align: center;
        margin: 0 0 30px 0;
        line-height: 1.3;
    }

    /* 卡片网格 */
    .bmm-cards-grid {
        display: grid;
        grid-template-columns: repeat(var(--bmm-cols, 3), 1fr);
        gap: 25px;
    }

    /* 单张卡片 */
    .bmm-card {
        border-radius: 14px;
        overflow: hidden;
        transition: background .18s, transform .18s;
        display: flex;
        flex-direction: column;
        align-items: baseline;
        position: relative;
    }

    .bmm-card:hover {
        transform: translateY(-2px);
    }

    .bmm-card-link {
        display: block;
        text-decoration: none !important;
        color: inherit;
        flex: 1;
    }

    .bmm-card-image {
        position: relative;
        aspect-ratio: 4/3;
        max-height: 220px;
        overflow: hidden;
        border-radius: 12px 12px 0 0;
    }

    .bmm-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform .3s ease;
    }

    .bmm-card:hover .bmm-card-image img {
        transform: scale(1.04);
    }

    .bmm-badge {
        position: absolute;
        top: 10px;
        left: 20px;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: clamp(10px, 0.85vw, 12px);
        font-weight: 700;
        color: #fff;
        z-index: 2;
        line-height: 1.4;
    }

    .bmm-card-body {
        padding: 15px 0;
    }

    .bmm-card-title {
        font-size: 1.125rem;
        font-weight: 700;
        line-height: 1.35;
        margin-bottom: 4px;
        color: var(--bmm-text, #fff);
    }
    .bmm-card-title:hover {
        color: #00b59c;
    }

    .bmm-card-subtitle {
        font-size: 0.875rem;
        line-height: 1.5;
        color: rgba(255,255,255,.58);
    }

    /* 附加按钮 */
    .bmm-extra-btn {
        display: block;
        margin: 0 clamp(8px, 0.8vw, 12px) clamp(8px, 0.8vw, 12px);
        padding: 7px 0;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--bmm-text, #fff);
        text-decoration: none !important;
    }

    .bmm-extra-btn:hover {
        color: #00b59c;
    }

    /* 桌面端隐藏 toggle 按钮 */
    .bmm-toggle-btn {
        display: none !important;
    }
}

/* =====================================================
   移动端 / 平板（≤ 1024px）
   ===================================================== */
@media (max-width: 1024px) {

    /* li 用 grid，<a> 和按钮同行，面板独占下一行 */
    .bmm-has-panel {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        row-gap: 0;
        
    }
    
    .mobile-menu li{
        border-bottom: 1px solid #a6a6a64a !important;
    }

    .bmm-has-panel > a {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }

    /* toggle 按钮靠右 */
    .bmm-toggle-btn {
        grid-column: 2;
        grid-row: 1;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        background: #1e1e1e;
        color: #20c997;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        padding: 0;
        margin-left: 8px;
        transition: background .2s;
        font-family: sans-serif;
        font-style: normal;
        font-weight: 600;
    }

    /* 面板独占下一行 */
    .bmm-panel {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        /* 折叠动画 */
        display: block !important;
        overflow: hidden;
        max-height: 0;
        opacity: 1;
        pointer-events: none;
        visibility: visible;
        transform: none !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        transition: max-height .32s ease;
        position: static !important;
        left: auto !important;
    }

    .bmm-has-panel.bmm-open > .bmm-panel {
        max-height: 3000px;
        pointer-events: auto;
    }

    /* toggle 图标切换 */
    .bmm-icon-plus  { display: inline; }
    .bmm-icon-close { display: none; }
    .bmm-has-panel.bmm-open > .bmm-toggle-btn .bmm-icon-plus  { display: none; }
    .bmm-has-panel.bmm-open > .bmm-toggle-btn .bmm-icon-close { display: inline; }

    /* 面板内部 */
    .bmm-panel-title {
        display: none; /* 移动端不显示标题 */
    }

    .bmm-panel-inner {
        padding: 8px 4px 12px;
    }

    .bmm-cards-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* 卡片竖向布局（图片+文字在上，按钮独占下方） */
    .bmm-card {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        padding-top: 12px;
    }

    .bmm-card-link {
        display: flex;
        flex-direction: row;
        align-items: center;
        text-decoration: none !important;
        color: inherit;
        min-width: 0;
        border: 1px solid var(--border-color, #fff);
        border-radius: 12px;
        background: #000;
    }

    .bmm-card-image {
        width: 110px;
        min-width: 110px;
        height: 80px;
        aspect-ratio: unset;
        max-height: unset;
        overflow: hidden;
        border-radius: 10px 0 0 10px;
        flex-shrink: 0;
        position: relative;
    }

    .bmm-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .bmm-badge {
        position: absolute;
        top: 0;
        right: 15px;
        left: auto;
        padding: 3px 10px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 700;
        color: #fff;
        z-index: 2;
        white-space: nowrap;
    }

    .bmm-card-body {
        flex: 1;
        padding: 0 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }

    .bmm-card-title {
        font-size: 14px;
        font-weight: 700;
        line-height: 1.3;
        margin-bottom: 4px;
        color: #fff;
        white-space: normal;
    }

    .bmm-card-subtitle {
        font-size: 12.5px;
        line-height: 1.4;
        color: rgba(255,255,255,.58);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* 附加按钮独占一行，在卡片底部 */
    .bmm-extra-btn {
        display: block;
        margin: 10px 0;
        padding: 8px 12px;
        background: #000;
        border-radius: 8px;
        font-size: 0.875rem !important;
        font-weight: 600;
        color: #fff !important;
        text-decoration: none !important;
        text-align: left;
        width: 70%;
        margin-left: auto;
        margin-right: 0;
    }
}
