/* Facebook浏览器优化样式 */
/* Facebook Browser Optimization Styles */

/* 检测Facebook浏览器的CSS媒体查询（基于User-Agent） */
/* 注意：CSS无法直接检测User-Agent，这些样式通过JavaScript动态应用 */

/* Facebook浏览器兼容性样式类 */
.facebook-browser-detected {
  /* 禁用可能导致问题的CSS特性 */
}

/* Facebook浏览器中的导航栏优化 */
.facebook-browser-detected .navbar {
  padding: 0.25rem 0; /* 减少导航栏上下内边距 */
  min-height: auto;
}

.facebook-browser-detected .navbar-brand {
  font-size: 1rem; /* 缩小品牌文字大小 */
  padding: 0.25rem 0;
}

.facebook-browser-detected .navbar-brand img {
  height: 24px !important; /* 缩小LOGO尺寸从32px到24px */
  width: auto;
}

.facebook-browser-detected .navbar-nav .nav-link {
  padding: 0.25rem 0.75rem; /* 减少导航链接的内边距 */
  font-size: 0.9rem; /* 稍微缩小字体 */
}

.facebook-browser-detected .navbar-toggler {
  padding: 0.15rem 0.5rem; /* 缩小切换按钮 */
  font-size: 0.9rem;
}

.facebook-browser-detected .btn-sm {
  padding: 0.15rem 0.5rem; /* 缩小小按钮 */
  font-size: 0.8rem;
}

.facebook-browser-detected .dropdown-toggle::after {
  font-size: 0.7rem; /* 缩小下拉箭头 */
}

/* Facebook浏览器中的PWA相关元素隐藏 */
.facebook-browser-detected .pwa-install-btn,
.facebook-browser-detected [data-pwa-install],
.facebook-browser-detected .pwa-notification,
.facebook-browser-detected .service-worker-update {
  display: none !important;
}

/* Facebook浏览器提示横幅样式 */
.facebook-browser-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #FF6B35, #F7931E);
  color: white;
  padding: 12px 16px;
  text-align: center;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  transform: translateY(0);
  transition: all 0.3s ease;
}

.facebook-browser-banner.hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.facebook-browser-banner .banner-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.facebook-browser-banner .banner-text {
  flex: 1;
  min-width: 200px;
}

.facebook-browser-banner .banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.facebook-browser-banner .banner-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.facebook-browser-banner .banner-btn:hover {
  background: rgba(255,255,255,0.3);
  color: white;
  text-decoration: none;
}

.facebook-browser-banner .banner-btn.secondary {
  background: transparent;
}

.facebook-browser-banner .banner-btn.secondary:hover {
  background: rgba(255,255,255,0.1);
}

/* Facebook浏览器中的页面内通知样式 */
.facebook-fallback-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
}

.facebook-fallback-notification .notification-content {
  background: linear-gradient(135deg, #FF6B35, #F7931E);
  color: white;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-width: 300px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  position: relative;
}

.facebook-fallback-notification.show .notification-content {
  transform: translateX(0);
}

.facebook-fallback-notification .notification-title {
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 14px;
}

.facebook-fallback-notification .notification-body {
  font-size: 12px;
  opacity: 0.9;
}

.facebook-fallback-notification .notification-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.facebook-fallback-notification .notification-close:hover {
  opacity: 1;
}

/* Facebook浏览器中的Toast消息样式 */
.facebook-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10001;
  transition: all 0.3s ease;
  pointer-events: none;
}

.facebook-toast.show {
  opacity: 1;
}

.facebook-toast.hide {
  opacity: 0;
}

/* Facebook浏览器中的搜索功能优化 */
.facebook-browser-detected .search-suggestions {
  /* 确保搜索建议在Facebook浏览器中正常显示 */
  position: absolute;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
}

/* Facebook浏览器中的响应式优化 */
@media (max-width: 768px) {
  .facebook-browser-banner {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .facebook-browser-banner .banner-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .facebook-browser-banner .banner-text {
    min-width: auto;
  }
  
  .facebook-fallback-notification {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .facebook-fallback-notification .notification-content {
    max-width: none;
  }
  
  /* 移动端导航栏进一步优化 */
  .facebook-browser-detected .navbar {
    padding: 0.15rem 0; /* 移动端更紧凑的导航栏 */
  }
  
  .facebook-browser-detected .navbar-brand {
    font-size: 0.9rem; /* 移动端更小的品牌文字 */
    padding: 0.15rem 0;
  }
  
  .facebook-browser-detected .navbar-brand img {
    height: 20px !important; /* 移动端更小的LOGO */
  }
  
  .facebook-browser-detected .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .facebook-browser-detected .navbar-header-wrapper {
    min-height: 40px; /* 设置最小高度 */
  }
}

/* Facebook浏览器中的动画优化 */
.facebook-browser-detected * {
  /* 减少可能导致性能问题的动画 */
}

.facebook-browser-detected .complex-animation {
  animation: none !important;
  transition: none !important;
}

/* Facebook浏览器中的字体优化 */
.facebook-browser-detected {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Facebook浏览器中的表单优化 */
.facebook-browser-detected input,
.facebook-browser-detected textarea,
.facebook-browser-detected select {
  /* 确保表单元素在Facebook浏览器中正常工作 */
  -webkit-appearance: none;
  appearance: none;
  border-radius: 6px;
}

/* Facebook浏览器中的按钮优化 */
.facebook-browser-detected button,
.facebook-browser-detected .btn {
  /* 确保按钮在Facebook浏览器中正常工作 */
  -webkit-appearance: none;
  appearance: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Facebook浏览器中的图片优化 */
.facebook-browser-detected img {
  /* 优化图片加载 */
  max-width: 100%;
  height: auto;
}

/* Facebook浏览器中的视频优化 */
.facebook-browser-detected video {
  /* 优化视频播放 */
  max-width: 100%;
  height: auto;
}

/* Facebook浏览器中的滚动优化 */
.facebook-browser-detected {
  /* 优化滚动性能 */
  -webkit-overflow-scrolling: touch;
}

/* Facebook浏览器中的触摸优化 */
.facebook-browser-detected .touchable {
  /* 优化触摸交互 */
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  tap-highlight-color: rgba(0,0,0,0.1);
}

/* Facebook浏览器中的链接优化 */
.facebook-browser-detected a {
  /* 优化链接点击 */
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  tap-highlight-color: rgba(0,0,0,0.1);
}

/* Facebook浏览器检测加载状态 */
.facebook-browser-loading {
  opacity: 0.7;
  pointer-events: none;
}

.facebook-browser-loaded {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

/* Facebook浏览器错误状态 */
.facebook-browser-error {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin: 16px;
  text-align: center;
}

.facebook-browser-error .error-icon {
  font-size: 48px;
  color: #6c757d;
  margin-bottom: 16px;
}

.facebook-browser-error .error-title {
  font-size: 18px;
  font-weight: bold;
  color: #495057;
  margin-bottom: 8px;
}

.facebook-browser-error .error-message {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 16px;
}

.facebook-browser-error .error-action {
  background: #FF6B35;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.facebook-browser-error .error-action:hover {
  background: #e55a2b;
}