/*
 * @Project      家具展示网站与小程序接口预留项目
 * @File         css/mobile.css
 * @Description  移动端响应式增强样式。补充汉堡菜单、抽屉菜单、
 *               USP/Footer/TrustBand 网格塌缩等小屏布局。
 *               在 components.css 之后引入。
 * @Author       易商企
 * @Date         2026
 */

/* ============================================================
 * 一、汉堡菜单按钮（≤1024px 显示）
 * ============================================================ */
.fg-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.fg-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0 auto;
    background: var(--fg-text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fg-hamburger.fg-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.fg-hamburger.fg-active span:nth-child(2) {
    opacity: 0;
}
.fg-hamburger.fg-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
 * 二、移动端抽屉菜单（默认隐藏，≤1024px 启用）
 * ============================================================ */
.fg-mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    visibility: hidden;
}

.fg-mobile-drawer.fg-open {
    visibility: visible;
}

.fg-mobile-drawer__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fg-mobile-drawer.fg-open .fg-mobile-drawer__overlay {
    opacity: 1;
}

.fg-mobile-drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 80%;
    height: 100%;
    background: var(--fg-white);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.fg-mobile-drawer.fg-open .fg-mobile-drawer__panel {
    transform: translateX(0);
}

.fg-mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fg-border);
}

.fg-mobile-drawer__title {
    font-size: var(--fg-font-size-base);
    font-weight: 600;
    color: var(--fg-dark);
}

.fg-mobile-drawer__close {
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg-muted);
}

.fg-mobile-drawer__close svg {
    width: 20px;
    height: 20px;
}

.fg-mobile-drawer__list {
    flex: 1;
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.fg-mobile-drawer__list li a {
    display: block;
    padding: 14px 20px;
    font-size: var(--fg-font-size-base);
    color: var(--fg-text);
    border-bottom: 1px solid var(--fg-border);
    transition: background 0.2s ease, color 0.2s ease;
}

.fg-mobile-drawer__list li a:hover,
.fg-mobile-drawer__list li a.fg-active {
    background: var(--fg-primary-pale);
    color: var(--fg-primary);
}

.fg-mobile-drawer__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--fg-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fg-mobile-drawer__footer a {
    font-size: var(--fg-font-size-sm);
    color: var(--fg-muted);
}

/* ============================================================
 * 三、≤1024px 平板：隐藏导航，显示汉堡 + Footer 3 列
 * ============================================================ */
@media (max-width: 1024px) {
    /* 隐藏主导航与 UEN */
    .fg-nav__list,
    .fg-logo__uen {
        display: none;
    }

    /* 显示汉堡按钮 */
    .fg-hamburger {
        display: flex;
    }

    /* 启用抽屉菜单容器 */
    .fg-mobile-drawer {
        display: block;
    }

    /* Footer links 5 → 3 列 */
    .fg-footer__links-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--fg-space-lg);
    }

    /* 隐藏非核心操作图标，保留搜索 + 账户 + 语言 + 汉堡 */
    .fg-header-actions__item[title="分类浏览"],
    .fg-header-actions__item[title="Categories"],
    .fg-header-actions__item[title="我的收藏"],
    .fg-header-actions__item[title="Favorite"] {
        display: none;
    }
}

/* ============================================================
 * 四、≤767px 手机：USP 横滚 / Footer 单列+分隔线 / 信任条 2 列
 * ============================================================ */
@media (max-width: 767px) {
    /* USP 条横向滚动，不换行 */
    .fg-usp-bar__grid {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 10px 16px;
        gap: 24px;
    }
    .fg-usp-bar__grid::-webkit-scrollbar {
        display: none;
    }
    .fg-usp-bar__item {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Footer links 直接隐藏——手机端有汉堡菜单已提供完整导航，
       底部不再重复堆链接，只留 Newsletter + 版权 + 社交 */
    .fg-footer__links {
        display: none;
    }

    /* 信任条 4 → 2 列 */
    .fg-trust-band__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--fg-space-xl);
    }

    /* 版权条堆叠居中 */
    .fg-footer__bottom-inner {
        flex-direction: column;
        gap: var(--fg-space-md);
        text-align: center;
    }
    .fg-footer__bottom-inner p {
        text-align: center;
        line-height: 1.6;
    }

    /* 抽屉面板宽度收窄 */
    .fg-mobile-drawer__panel {
        width: 260px;
    }
}

/* ============================================================
 * 五、≤480px 小屏：极致紧凑适配
 * ============================================================ */
@media (max-width: 480px) {
    /* 信任条数字缩小 */
    .fg-trust-band__number {
        font-size: var(--fg-font-size-2xl);
    }

    /* 抽屉面板占 85% 宽度 */
    .fg-mobile-drawer__panel {
        width: 85%;
    }

    /* Header 操作图标进一步精简：仅保留搜索 + 汉堡 */
    .fg-header-actions__item[title="我的账户"],
    .fg-header-actions__item[title="Account"] {
        display: none;
    }
}
