/* ============================================================
   Inner Lab · 全站响应式设计系统 v1.0
   统一断点: 768px (平板) | 480px (手机)
   ============================================================ */

/* ========== 汉堡菜单 ========== */
/* 汉堡按钮（默认隐藏，仅在移动端显示） */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    border-radius: 8px;
    gap: 5px;
    transition: background .2s;
    z-index: 1100;
}
.hamburger:hover { background: var(--accent-subtle); }
.hamburger:active { transform: scale(0.95); }
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    transform-origin: center;
}
/* 打开状态：三条杠变 X */
.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 移动端菜单抽屉 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity .3s ease;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 280px;
    max-width: 80vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card, #ffffff);
    border-left: 1px solid var(--border, #e2e8f0);
    z-index: 1060;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.mobile-menu-drawer.active {
    transform: translateX(0);
}

/* 抽屉头部（品牌 + 关闭按钮） */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    min-height: var(--nav-height, 64px);
}
.mobile-menu-header .brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary, #1e293b);
}
.mobile-menu-header .brand span {
    background: linear-gradient(135deg, var(--accent, #7c5cfc), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.mobile-menu-close {
    width: 36px; height: 36px;
    border: none; background: transparent;
    color: var(--text-secondary, #64748b);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}
.mobile-menu-close:hover { background: var(--accent-subtle); color: var(--text-primary); }

/* 抽屉导航链接列表 */
.mobile-menu-nav {
    flex: 1;
    padding: 12px 0;
}
.mobile-menu-nav a,
.mobile-menu-nav .mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary, #64748b);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
    border-radius: 0;
    border-left: 3px solid transparent;
}
.mobile-menu-nav a:hover,
.mobile-menu-nav .mobile-nav-link:hover {
    background: var(--accent-subtle, rgba(124,92,252,0.08));
    color: var(--text-primary, #1e293b);
}
.mobile-menu-nav a:active,
.mobile-menu-nav .mobile-nav-link:active {
    background: var(--accent-subtle);
    transform: scale(0.98);
}
.mobile-menu-nav a.active-link {
    color: var(--accent, #7c5cfc);
    border-left-color: var(--accent, #7c5cfc);
    background: var(--accent-subtle, rgba(124,92,252,0.08));
}
.mobile-menu-nav i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* 抽屉底部（主题切换） */
.mobile-menu-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.mobile-theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent-subtle, rgba(124,92,252,0.08));
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    color: var(--text-secondary, #64748b);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all .2s;
}
.mobile-theme-btn:hover { background: var(--accent-subtle); color: var(--text-primary); }
.mobile-theme-btn:active { transform: scale(0.97); }
.mobile-theme-btn i { font-size: 0.9rem; }

/* 汉堡菜单可见性 — 放在最后以确保优先级 */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .nav-links a:not(.nav-auth-btn) { display: none; }
}

/* ========== 触控态（:active 反馈） ========== */
/* 所有按钮在触摸时缩小 */
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.nav-auth-btn:active,
button:active:not(.hamburger):not(.mobile-menu-close) {
    transform: scale(0.97);
}
/* 卡片在触摸时轻微反馈 */
.card:active,
.chapter-card:active,
.pass-card:active,
.perk-card:active,
.hero-stat-card:active,
.badge-item:active {
    transform: scale(0.985);
    transition: transform .15s ease;
}

/* ========== 断点 1: 平板及以下 (≤768px) ========== */
@media (max-width: 768px) {
    /* ---- 布局 ---- */
    .page-content {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* ---- 导航 ---- */
    .navbar-inner {
        padding: 0 4px;
    }
    .nav-logo {
        font-size: 1rem !important;
    }
    .nav-logo .beta-badge { display: none; }

    /* ---- 内容区 ---- */
    h1 { font-size: clamp(1.6rem, 5vw, 2.2rem) !important; }
    h2 { font-size: clamp(1.2rem, 4vw, 1.5rem) !important; }
    h3 { font-size: clamp(1rem, 3.5vw, 1.2rem) !important; }
    body { font-size: clamp(14px, 1.8vw, 15px); }

    /* ---- 通用容器 ---- */
    .toast-container {
        right: 12px !important;
        bottom: 12px !important;
        left: 12px !important;
        max-width: none !important;
    }
    .toast {
        max-width: none !important;
        width: 100%;
    }

    /* ---- Footer ---- */
    .mirro-footer {
        padding: 8px 12px !important;
        height: auto !important;
        min-height: 44px !important;
    }
    .mirro-footer-links {
        gap: 10px !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    .mirro-footer-copyright {
        font-size: 0.55rem !important;
    }

    /* ---- Modal/弹窗 ---- */
    .modal-box,
    [class*="modal"] .modal-content {
        max-width: 92vw !important;
        width: 92vw !important;
        padding: 1.25rem !important;
        margin: 10px auto !important;
    }
}

/* ========== 断点 2: 手机 (≤480px) ========== */
@media (max-width: 480px) {
    /* ---- 导航 ---- */
    .nav-auth-btn {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
    .nav-user-avatar {
        width: 30px !important;
        height: 30px !important;
    }
    .navbar .theme-toggle {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
    }

    /* ---- 内容区 ---- */
    .page-content {
        padding-top: calc(var(--nav-height, 64px) + 12px) !important;
        padding-bottom: 60px !important;
    }

    /* ---- 标题 ---- */
    h1 { font-size: clamp(1.3rem, 6vw, 1.6rem) !important; }
    h2 { font-size: clamp(1rem, 4.5vw, 1.2rem) !important; }

    /* ---- 按钮 ---- */
    .btn, .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }

    /* ---- 卡片 ---- */
    .card {
        padding: 0.85rem !important;
    }

    /* ---- 表单 ---- */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* 防止 iOS 缩放 */
    }

    /* ---- 页脚 ---- */
    .mirro-footer {
        padding: 6px 8px !important;
        gap: 2px !important;
    }

    /* ---- Toast ---- */
    .toast-container {
        bottom: 8px !important;
        right: 8px !important;
        left: 8px !important;
    }

    .mobile-menu-drawer {
        width: 260px;
    }
}

/* ========== 辅助类 ========== */
/* 移动端只隐藏 */
.hide-mobile {
    display: none;
}
@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}
/* 文本不换行 + 省略 */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-menu-drawer {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mirro-footer {
        padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }
}
