/* 响应式设计 - 移动端适配 */
@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }

  /* 背景蒙层样式 */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 64px;
    z-index: 99;
    width: 280px;
    height: calc(100vh - 64px);
    background-color: #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 0;
    border-right: none;
  }

  /* 移动端菜单滚动条美化 */
  .sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
  }

  .sidebar::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
  }

  .sidebar.open {
    left: 0;
    opacity: 1;
    visibility: visible;
  }

  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1001;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .mobile-menu-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
  }

  .content {
    min-height: auto;
    width: 100% !important;
    padding: 1.5rem;
    box-shadow: none;
    border-radius: 0;
  }

  .back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 998;
    background: linear-gradient(135deg, #1a73e8 0%, #667eea 100%);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    font-size: 1.4rem;
    text-decoration: none;
    border: none;
    line-height: 1;
  }

  .back-to-top.visible {
    opacity: 1;
    visibility: visible;
  }

  .back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  }

  .top-nav-links {
    display: none !important;
  }

  /* 小屏幕时隐藏右侧菜单 */
  .right-sidebar {
    display: none !important;
  }

  /* 移动端顶部悬浮菜单 */
  .mobile-top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    transition: all 0.3s ease;
  }

  .mobile-top-nav .logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a73e8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .mobile-top-nav .logo::before {
    content: "⚡";
    font-size: 1.2rem;
  }

  .mobile-top-nav .nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mobile-top-nav .nav-links a {
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
  }

  .mobile-top-nav .nav-links a:hover {
    color: #1a73e8;
  }

  .mobile-top-nav .nav-links a::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #1a73e8;
    transition: width 0.3s ease;
  }

  .mobile-top-nav .nav-links a:hover::after {
    width: 100%;
  }

  /* 侧边栏文本换行 */
  .sidebar .brand-sidebar,
  .sidebar h3,
  .sidebar a {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }
}

@media (max-width: 768px) {
  .brand-title {
    font-size: 1.8rem;
  }

  .grid-container {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 1.25rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .footer-links a {
    display: block;
    margin: 0.5rem 0;
  }

  /* 移动端顶部导航调整 */
  .mobile-top-nav {
    padding: 12px 16px;
  }

  .mobile-top-nav .logo {
    font-size: 1.1rem;
  }

  .mobile-top-nav .nav-links {
    gap: 1.25rem;
  }

  .mobile-top-nav .nav-links a {
    font-size: 0.85rem;
  }
  .sidebar {
    width: 230px;
  }

  .sidebar a {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 640px) {
  /* 更窄屏幕时简化顶部导航 */
  .mobile-top-nav .nav-links {
    display: none;
  }

  .mobile-top-nav {
    justify-content: center;
  }

  .sidebar {
    width: 220px;
  }

  .sidebar a {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .brand-section {
    padding: 2rem 0;
  }

  .brand-title {
    font-size: 1.6rem;
  }

  .brand-subtitle {
    font-size: 1rem;
  }

  .content {
    padding: 1rem;
  }

  .back-to-top {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 20px;
    font-size: 1.2rem;
  }

  .mobile-menu-btn {
    padding: 8px 12px;
    font-size: 1.2rem;
  }
  .sidebar {
    width: 200px;
  }
  .sidebar a {
    font-size: 0.65rem;
    padding: 0.4rem 0.8rem;
  }
}
