/**
 * 移动端优化样式 - 参考飞书帮助中心设计
 * 简洁、高效、用户友好的移动端体验
 */

/* 移动端基础样式 */
@media (max-width: 768px) {
  /* ===== 基础重置 ===== */
  * {
    box-sizing: border-box;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    background: #f7f8fa;
    color: #1d2129;
  }
  
  /* ===== 顶部导航 - 飞书风格 ===== */
  .site-header {
    height: 50px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #e5e6eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  }
  
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 50px;
    max-width: 100%;
    flex-wrap: nowrap;
  }
  
  /* Logo区域 - 飞书风格 */
  .header-logo {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
    max-width: 70% !important;
    white-space: nowrap !important;
    flex-direction: row !important;
  }
  
  .header-logo div {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex-shrink: 0 !important;
    flex-direction: row !important;
    white-space: nowrap !important;
  }
  
  .header-logo div a {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1d2129 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 80px !important;
    display: inline !important;
  }
  
  .header-logo div span {
    font-size: 10px !important;
    color: #86909c !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
    display: inline !important;
  }
  
  .header-logo button {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1d2129 !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
    flex-shrink: 0 !important;
  }
  
  .header-logo button:hover {
    background: #f0f7ff;
    color: #3370ff;
  }
  
  .header-logo button svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
  }
  
  .header-logo img {
    width: 28px;
    height: 28px;
    margin-right: 8px;
    flex-shrink: 0;
  }
  
  /* 右侧操作区域 - 飞书风格 */
  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
  }
  
  .header-actions a {
    font-size: 13px;
    color: #4e5969;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: none; /* 在窄屏时隐藏部分链接 */
  }
  
  .header-actions a:hover {
    background: #f0f7ff;
    color: #3370ff;
  }
  
  /* 语言切换器 - 飞书风格 */
  .language-toggle {
    font-size: 13px;
    color: #4e5969;
    padding: 6px 8px;
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
  }
  
  .language-toggle:hover {
    background: #f0f7ff;
    color: #3370ff;
  }
  
  /* ===== 帮助中心下拉菜单 - 移动端优化 ===== */
  /* 强制覆盖内联样式，确保移动端正确显示 */
  
  /* 下拉菜单容器样式（不控制显示隐藏） */
  .site-header .dropdown-menu {
    position: fixed !important;
    top: 50px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 92vw !important;
    max-width: 380px !important;
    min-width: 300px !important;
    padding: 14px !important;
    background: #ffffff !important;
    border: 1px solid #e5e6eb !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    margin-top: 0 !important;
    z-index: 10000 !important;  /* 提高到最高层级，确保在遮罩层之上 */
    transition: none !important;
    pointer-events: auto !important;  /* 确保可以点击 */
  }
  
  /* 移动端下拉菜单默认隐藏 - 使用更高优先级 */
  .site-header .dropdown-menu:not(.mobile-show) {
    display: none !important;
  }
  
  /* 当显示时（通过JavaScript添加mobile-show类） */
  .site-header .dropdown-menu.mobile-show {
    display: block !important;
  }
  
  /* 下拉菜单网格布局 - 2列 */
  .site-header .dropdown-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    position: relative !important;
    z-index: 2 !important;
    pointer-events: auto !important;
  }
  
  /* 下拉菜单项 - 横向居中布局（图标在左，文字在右）*/
  .site-header .dropdown-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 14px 10px !important;
    min-height: 52px !important;
    height: auto !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    text-align: center !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    border: 1.5px solid #e5e6eb !important;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06) !important;
    overflow: hidden !important;
    position: relative !important;
    z-index: 1 !important;  /* 确保在下拉菜单内部可点击 */
    pointer-events: auto !important;  /* 确保可点击 */
  }
  
  /* 点击效果（移动端用active代替hover） */
  .site-header .dropdown-item:active {
    background: #f0f7ff !important;
    border-color: #3370ff !important;
    transform: scale(0.98) !important;
    box-shadow: 0 2px 6px rgba(51, 112, 255, 0.15) !important;
  }
  
  /* 图标容器 */
  .site-header .dropdown-item > div:first-child {
    width: 28px !important;
    height: 28px !important;
    margin-right: 10px !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    border-radius: 7px !important;
  }
  
  /* 图标（与桌面版一致） */
  .site-header .dropdown-item img,
  .site-header .dropdown-item > div:first-child img {
    width: 15px !important;
    height: 15px !important;
  }
  
  /* 文字 - 单行显示，超长省略 */
  .site-header .dropdown-item > span {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1d2129 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.3 !important;
    text-align: center !important;
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  
  /* 遮罩层（移动端点击菜单外部关闭） */
  #dropdownOverlay {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.3) !important;
    z-index: 9997 !important;
    backdrop-filter: blur(2px) !important;
    pointer-events: none !important;  /* 遮罩层本身不响应点击 */
  }
  
  /* 遮罩层显示状态 */
  #dropdownOverlay.show {
    display: block !important;
  }
  
  /* 但整个body在显示遮罩层时阻止滚动和点击 */
  body.dropdown-open {
    overflow: hidden !important;
  }
  
  /* ===== 主内容区域 - 飞书风格 ===== */
  .site-main {
    min-height: calc(100vh - 50px);
    padding: 0;
    background: #f7f8fa;
  }
  
  .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
  }
  
  /* ===== 搜索框 - 飞书风格 ===== */
  .search-box {
    margin: 16px 0;
    position: relative;
  }
  
  .search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s ease;
  }
  
  .search-input:focus {
    outline: none;
    border-color: #3370ff;
    box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
  }
  
  .search-icon-wrapper {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #86909c;
    z-index: 1;
  }
  
  /* ===== 功能模块 - 飞书风格 ===== */
  .feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0;
  }
  
  .feature-card {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .feature-card:hover {
    border-color: #3370ff;
    box-shadow: 0 2px 8px rgba(51, 112, 255, 0.1);
  }
  
  .feature-card:active {
    transform: translateY(1px);
  }
  
  .feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .feature-card p {
    font-size: 13px;
    color: #4e5969;
    margin: 0 0 12px 0;
    line-height: 1.4;
  }
  
  .feature-card .card-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  
  /* ===== 视频教程 - 飞书风格 ===== */
  .video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0;
  }
  
  .video-card {
    background: #ffffff;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .video-card:hover {
    border-color: #3370ff;
    box-shadow: 0 2px 8px rgba(51, 112, 255, 0.1);
  }
  
  .video-thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: #f7f8fa;
  }
  
  .video-info {
    padding: 12px;
  }
  
  .video-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 4px 0;
    line-height: 1.3;
  }
  
  .video-info p {
    font-size: 12px;
    color: #86909c;
    margin: 0;
  }
  
  /* ===== 快速入口 - 飞书风格 ===== */
  .quick-entry {
    margin: 20px 0;
  }
  
  .quick-entry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .quick-entry-item {
    background: #ffffff;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  
  .quick-entry-item:hover {
    border-color: #3370ff;
    box-shadow: 0 2px 8px rgba(51, 112, 255, 0.1);
  }
  
  .quick-entry-item:active {
    transform: translateY(1px);
  }
  
  .quick-entry-item img {
    width: 20px;
    height: 20px;
    margin-bottom: 6px;
  }
  
  .quick-entry-item h3 {
    font-size: 12px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 2px 0;
  }
  
  .quick-entry-item p {
    font-size: 10px;
    color: #86909c;
    margin: 0;
  }
  
  /* ===== 内容页面 - 飞书风格 ===== */
  .content-header {
    margin: 16px 0;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
  }
  
  .content-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 8px 0;
  }
  
  .content-header p {
    font-size: 14px;
    color: #4e5969;
    margin: 0;
  }
  
  .content-section {
    margin: 16px 0;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
  }
  
  .content-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 12px 0;
  }
  
  .content-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 8px 0;
  }
  
  .content-section p {
    font-size: 14px;
    color: #4e5969;
    margin: 0 0 12px 0;
    line-height: 1.5;
  }
  
  .content-section ul,
  .content-section ol {
    font-size: 14px;
    color: #4e5969;
    margin: 0 0 12px 0;
    padding-left: 16px;
  }
  
  .content-section li {
    margin: 4px 0;
  }
  
  /* ===== 图片 - 飞书风格 ===== */
  .content-section img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 12px 0;
  }
  
  /* ===== 表格 - 飞书风格 ===== */
  .content-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 12px;
  }
  
  .content-section th,
  .content-section td {
    border: 1px solid #e5e6eb;
    padding: 8px;
    text-align: left;
  }
  
  .content-section th {
    background: #f8f9fa;
    font-weight: 600;
  }
  
  /* ===== 按钮 - 飞书风格 ===== */
  .btn {
    display: inline-block;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
  }
  
  .btn-primary {
    background: #3370ff;
    color: #ffffff;
  }
  
  .btn-primary:hover {
    background: #2b5ce6;
  }
  
  .btn-secondary {
    background: #f7f8fa;
    color: #4e5969;
    border: 1px solid #e5e6eb;
  }
  
  .btn-secondary:hover {
    background: #f0f7ff;
    color: #3370ff;
    border-color: #3370ff;
  }
  
  /* ===== 反馈模块 - 飞书风格 ===== */
  .feedback-module {
    margin: 20px 0;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e6eb;
  }
  
  .feedback-question h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1d2129;
    margin: 0 0 12px 0;
  }
  
  .feedback-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .feedback-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #e5e6eb;
    background: #ffffff;
    color: #4e5969;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .feedback-btn:hover {
    background: #f0f7ff;
    color: #3370ff;
    border-color: #3370ff;
  }
  
  .feedback-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #e5e6eb;
    border-radius: 6px;
    font-size: 12px;
    resize: vertical;
  }
  
  .feedback-textarea:focus {
    outline: none;
    border-color: #3370ff;
    box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
  }
  
  /* ===== 隐藏桌面端特有元素 ===== */
  .desktop-only {
    display: none !important;
  }
  
  /* ===== 显示移动端特有元素 ===== */
  .mobile-only {
    display: block !important;
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  .site-header {
    height: 46px;
    padding: 0 8px;
  }
  
  .header-content {
    height: 46px;
    gap: 4px;
  }
  
  .header-logo {
    max-width: 65%;
    gap: 2px;
  }
  
  .header-logo div a {
    font-size: 12px;
    max-width: 60px;
  }
  
  .header-logo div span {
    font-size: 9px;
  }
  
  .header-logo button {
    font-size: 10px;
    padding: 3px 4px;
    gap: 1px;
  }
  
  .header-logo button svg {
    width: 8px;
    height: 8px;
  }
  
  .header-logo img {
    width: 20px;
    height: 20px;
    margin-right: 4px;
  }
  
  .header-actions {
    gap: 1px;
  }
  
  .header-actions a {
    font-size: 10px;
    padding: 3px 4px;
  }
  
  .language-toggle {
    font-size: 10px;
    padding: 3px 4px;
  }
  
  .site-main {
    min-height: calc(100vh - 46px);
  }
  
  .container {
    padding: 0 8px;
  }
  
  .quick-entry-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .quick-entry-item {
    padding: 10px;
  }
  
  .feature-card {
    padding: 12px;
  }
  
  .video-card .video-info {
    padding: 10px;
  }
}

/* 极窄屏幕优化 */
@media (max-width: 360px) {
  .site-header {
    height: 44px;
    padding: 0 6px;
  }
  
  .header-content {
    height: 44px;
    gap: 2px;
  }
  
  .header-logo {
    max-width: 70%;
    gap: 1px;
  }
  
  .header-logo div a {
    font-size: 11px;
    max-width: 50px;
  }
  
  .header-logo div span {
    font-size: 8px;
  }
  
  .header-logo button {
    font-size: 9px;
    padding: 2px 3px;
    gap: 1px;
  }
  
  .header-logo button svg {
    width: 7px;
    height: 7px;
  }
  
  .header-logo img {
    width: 18px;
    height: 18px;
    margin-right: 3px;
  }
  
  .header-actions {
    gap: 0;
  }
  
  .header-actions a {
    font-size: 9px;
    padding: 2px 3px;
  }
  
  .language-toggle {
    font-size: 9px;
    padding: 2px 3px;
  }
  
  .site-main {
    min-height: calc(100vh - 44px);
  }
  
  .container {
    padding: 0 6px;
  }
}