/* 移动端优化样式 */

/* 手动隐藏非移动端元素 - 这些规则会在所有设备上生效 */
@media screen {
  .desktop-only {
    display: block;
  }
  
  .mobile-only {
    display: none;
  }
}

/* 媒体查询 - 移动设备 */
@media (max-width: 768px) {
  /* 显示/隐藏基于设备的元素 */
  .desktop-only {
    display: none !important;
  }
  
  .mobile-only {
    display: block !important;
  }

  /* 1. 移动端底部导航栏 */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
  }

  .mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
  }

  .mobile-bottom-nav-item.active {
    color: var(--primary-color);
  }

  .mobile-bottom-nav-item i {
    font-size: 1.5rem;
    margin-bottom: 4px;
  }

  .mobile-bottom-nav-item span {
    font-size: 0.75rem;
    line-height: 1;
  }

  .mobile-bottom-nav-badge {
    position: absolute;
    top: 0;
    right: 50%;
    transform: translateX(8px);
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: var(--accent-color);
    color: white;
    border-radius: 8px;
    font-size: 0.75rem;
    padding: 0 4px;
  }

  /* 2. 隐藏侧边栏并调整内容区域 */
  .main-content {
    padding-bottom: 70px; /* 为底部导航腾出空间 */
  }
  
  /* 3. 移动端弹出层尺寸调整 */
  .layui-layer-page .layui-layer-content {
    max-height: 80vh;
    overflow-y: auto;
  }

  /* 重新设计的顶部导航栏 */
  .header {
    padding: 8px 0;
    position: relative;
    z-index: 1000;
  }

  .nav-container {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    position: relative;
    flex-direction: row;

  }

  .logo {
    height: 44px;
    display: flex;
    align-items: center;
    flex: 1;
  }

  .logo a {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
  }

  .logo img {
    max-height: 30px;
  }

  /* 隐藏原导航 - 更强制的隐藏规则 */
  body .main-nav, 
  body .user-nav {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
  }

  /* 隐藏原移动菜单切换按钮 */
  body .mobile-menu-toggle {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* 顶部导航菜单按钮 */
  .top-nav-menu {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: var(--bg-muted);
    border-radius: 50%;
    cursor: pointer;
    margin-left: 10px;
    position: relative;
    z-index: 1010;
  }

  .top-nav-menu i {
    font-size: 1.5rem;
    color: var(--text-primary);
  }

  /* 顶部下拉菜单 - 确保默认隐藏 */
  .top-nav-dropdown {
    position: absolute;
    top: 100%;
    right: 15px;
    width: 200px;
    background-color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px 0;
    z-index: 1001;
    display: none !important; /* 强制隐藏 */
    margin-top: 10px;
    visibility: hidden; /* 添加额外隐藏属性 */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .top-nav-dropdown.open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeInDown 0.3s ease;
  }

  .top-nav-dropdown a {
    display: block;
    padding: 10px 20px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
  }

  .top-nav-dropdown a:hover {
    background-color: var(--bg-muted);
    color: var(--primary-color);
  }

  .top-nav-dropdown a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
  }

  .layui-line-dashed {
    height: 1px;
    border-top: 1px dashed var(--border-color);
    margin: 8px 0;
  }

  /* 弹出菜单动画 */
  @keyframes fadeInDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 移动端菜单背景遮罩 */
  .mobile-menu-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-menu-backdrop.open {
    display: block;
    opacity: 1;
  }

  /* 弹出层样式调整 */
  .layui-layer {
    width: 92% !important;
    left: 4% !important;
    right: 4% !important;
  }

  .layui-layer-title {
    font-size: 16px !important;
  }

  /* 修复按钮组样式 */
  .layui-btn-group .layui-btn {
    margin-right: 5px;
    margin-bottom: 5px;
  }
  
  /* 强制隐藏PC端侧边栏 - 用户中心页面 */
  .user-sidebar,
  .side-nav,
  .pc-sidebar,
  .left-sidebar,
  .sidebar-wrapper,
  .sidebar-container,
  [class*="sidebar"],
  [class*="side-menu"],
  [class*="side-nav"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -1 !important;
  }
  
  /* 确保用户中心页面在移动端下内容适配 */
  .user-content,
  .main-content-wrapper,
  .content-wrapper,
  .right-content,
  [class*="content-area"],
  [class*="main-area"] {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    float: none !important;
  }

  /* 个人中心页面侧边栏隐藏 */
  .layui-col-md3,
  .user-menu {
    display: none !important;
  }

  /* 个人中心主内容区扩展到全宽 */
  .layui-col-md9,
  .user-content-box,
  .user-container .layui-col-md9 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* 美化商品列表页导航 */
  .category-box {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .category-title {
    font-size: 16px;
    font-weight: bold;
    padding: 12px 15px;
    background-color: var(--primary-color);
    color: white;
  }

  /* 移动端分类导航 */
  .mobile-category-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    padding: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .mobile-category-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
  }
  
  .mobile-category-nav a {
    display: inline-block;
    padding: 12px 15px;
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
    position: relative;
  }
  
  .mobile-category-nav a.active {
    color: var(--primary-color);
  }
  
  .mobile-category-nav a.active:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
  }

  /* 商品列表页布局调整 */
  .layui-row .layui-col-md3 {
    display: none !important;
  }
  
  .layui-row .layui-col-md9 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  
  /* 筛选栏样式 */
  .filter-bar {
    background-color: white;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }
  
  .filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .filter-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
  }
  
  .filter-actions {
    display: flex;
    align-items: center;
  }
  
  .filter-sort {
    display: flex;
  }
  
  .sort-btn {
    padding: 5px 10px;
    font-size: 13px;
    border-radius: 4px;
    margin-left: 5px;
    background-color: var(--bg-muted);
    color: var(--text-secondary);
  }
  
  .sort-btn.active {
    background-color: var(--primary-color);
    color: white;
  }
  
  /* 美化面包屑导航 */
  .breadcrumb {
    display: none !important; /* 在移动端隐藏传统面包屑导航 */
  }
} 