/* ==========================================
 * 移动端适配 CSS - 全站所有页面共享
 * ========================================== */

/* 汉堡菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10001;
    width: 44px;
    height: 44px;
    background: var(--bg-card, #0c0c16);
    border: 1px solid var(--border, #1a1a30);
    border-radius: 12px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gold, #c9a23c);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端侧边栏遮罩 */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
    backdrop-filter: blur(4px);
}
.mobile-overlay.active {
    display: block;
}

/* ===== 移动端抽屉菜单（全站通用）===== */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #0a0a18 0%, #0e0e1a 100%);
    border-right: 1px solid rgba(201,162,60,0.15);
    z-index: 9999;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 20px 0;
    box-shadow: 4px 0 40px rgba(0,0,0,0.6);
}
.mobile-drawer.open {
    left: 0;
}

.mobile-drawer-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
}
.mobile-drawer-logo {
    font-size: 17px;
    font-weight: 800;
    color: var(--gold, #c9a23c);
    letter-spacing: 2px;
}
.mobile-drawer-logo span {
    color: rgba(255,255,255,0.35);
    font-weight: 400;
    font-size: 12px;
    margin-left: 6px;
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 4px 12px;
    background: rgba(201,162,60,0.08);
    border-radius: 10px;
    border: 1px solid rgba(201,162,60,0.12);
}
.mobile-drawer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a23c, #a67c00);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.mobile-drawer-user-info {
    flex: 1;
    min-width: 0;
}
.mobile-drawer-username {
    font-size: 14px;
    font-weight: 600;
    color: #eeeef2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mobile-drawer-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 2px;
}
.badge-normal { background:rgba(120,120,140,0.2); color:#8888a0; }
.badge-vip { background:rgba(96,165,250,0.15); color:#60a5fa; }
.badge-svip { background:rgba(201,162,60,0.15); color:#f0d060; }
.badge-honor { background:rgba(167,139,250,0.15); color:#a78bfa; }
.badge-admin { background:rgba(236,72,153,0.15); color:#f472b6; }

.mobile-drawer-nav {
    padding: 8px 0;
}
.mobile-drawer-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: rgba(238,238,242,0.7);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.mobile-drawer-nav a:hover,
.mobile-drawer-nav a:active {
    background: rgba(201,162,60,0.08);
    color: #f0d060;
    border-left-color: #c9a23c;
}
.mobile-drawer-nav a .drawer-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.mobile-drawer-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 8px 16px;
}

.mobile-drawer-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
}
.mobile-drawer-footer button {
    width: 100%;
    padding: 11px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: rgba(238,238,242,0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.mobile-drawer-footer button:hover {
    border-color: rgba(236,72,153,0.3);
    color: #f472b6;
    background: rgba(236,72,153,0.06);
}

/* 表格容器横向滚动 */
.admin-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 移动端：表格改为卡片布局 */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex !important;
    }

    /* ===== 全站通用：隐藏桌面导航元素，改用抽屉菜单 ===== */
    nav .nav-links,
    nav .nav-right,
    nav .nav-right-area,
    nav .nav-left,
    nav .nav-user,
    /* 课程页特殊结构 */
    .navbar .nav-links > a:not(.nav-back),
    .navbar .nav-back:not(:last-child) {
        display: none !important;
    }
    /* 让nav本身保持flex布局但只显示logo */
    nav, .navbar {
        padding: 12px 52px 12px 60px !important;
        justify-content: space-between !important;
    }
    .nav-logo { font-size: 14px !important; }
    .nav-logo span { display: none !important; }

    .admin-sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transition: left 0.35s ease !important;
        box-shadow: none !important;
    }

    .admin-sidebar.mobile-open {
        left: 0 !important;
        box-shadow: 4px 0 30px rgba(0,0,0,0.5) !important;
    }

    .admin-main {
        margin-left: 0 !important;
        padding: 60px 12px 20px !important;
        max-width: 100% !important;
    }

    .admin-header {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }

    .admin-table-container table {
        min-width: 700px !important;
    }

    .stat-cards {
        grid-template-columns: 1fr !important;
    }

    .custom-grid {
        grid-template-columns: 1fr !important;
    }

    .custom-card {
        padding: 28px 20px !important;
    }

    .form-row {
        flex-direction: column !important;
    }

    .form-group {
        width: 100% !important;
    }

    /* 筛选栏换行 */
    .filter-bar,
    .search-bar {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .filter-bar select,
    .filter-bar input,
    .search-bar input {
        width: 100% !important;
        min-width: auto !important;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 56px 8px 16px !important;
    }

    .admin-table-container table {
        min-width: 600px !important;
        font-size: 13px !important;
    }

    .page-title {
        font-size: 20px !important;
    }

    .custom-name {
        font-size: 20px !important;
    }

    .custom-desc {
        font-size: 14px !important;
    }
}
