/**
 * 性能优化和用户体验增强样式
 * Performance Optimization & UX Enhancement Styles
 * 
 * 包含：返回顶部按钮、图片懒加载占位、加载动画、面包屑导航等
 */

/* ==========================================
   返回顶部按钮
   ========================================== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #00bbf0, #00204a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 9999;
  box-shadow: 0 4px 15px rgba(0, 187, 240, 0.4);
  border: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 187, 240, 0.6);
}

.back-to-top i {
  color: #ffffff;
  font-size: 20px;
  animation: bounceUp 1.5s ease-in-out infinite;
}

@keyframes bounceUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* 移动端返回顶部按钮 */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
  
  .back-to-top i {
    font-size: 18px;
  }
}

/* ==========================================
   面包屑导航
   ========================================== */
.breadcrumb-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 187, 240, 0.1);
  position: relative;
  z-index: 100;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  background: transparent;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  font-size: 14px;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid #00bbf0;
  border-bottom: 2px solid #00bbf0;
  transform: rotate(-45deg);
  margin: 0 12px;
  opacity: 0.5;
}

.breadcrumb-item a {
  color: #00204a;
  text-decoration: none;
  transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
  color: #00bbf0;
}

.breadcrumb-item.active {
  color: #00bbf0;
  font-weight: 500;
}

.breadcrumb-item i {
  margin-right: 8px;
  color: #00bbf0;
}

/* ==========================================
   图片懒加载占位符
   ========================================== */
.lazy-image {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.lazy-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmer 1.5s infinite;
}

.lazy-image.loaded::before {
  display: none;
}

.lazy-image img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.lazy-image.loaded img {
  opacity: 1;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ==========================================
   加载动画
   ========================================== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #00204a, #001533);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(0, 187, 240, 0.2);
  border-top-color: #00bbf0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  position: absolute;
  margin-top: 100px;
  color: #00bbf0;
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ==========================================
   图片加载错误处理
   ========================================== */
.img-error {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #6c757d;
  font-size: 14px;
}

.img-error::before {
  content: '\f127';
  font-family: 'FontAwesome';
  font-size: 32px;
  color: #adb5bd;
  margin-right: 10px;
}

/* ==========================================
   平滑滚动
   ========================================== */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  .back-to-top i,
  .lazy-image::before,
  .loader-spinner,
  .loader-text {
    animation: none;
  }
}

/* ==========================================
   图片焦点效果
   ========================================== */
.img-focus-zoom {
  overflow: hidden;
}

.img-focus-zoom img {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.img-focus-zoom:hover img {
  transform: scale(1.05);
}

/* ==========================================
   工具提示增强
   ========================================== */
.tooltip-enhanced {
  position: relative;
}

.tooltip-enhanced::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 8px 15px;
  background: rgba(0, 32, 74, 0.95);
  color: #ffffff;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tooltip-enhanced::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 32, 74, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.tooltip-enhanced:hover::after,
.tooltip-enhanced:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================
   滚动进度条
   ========================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #00bbf0, #00f0ff);
  z-index: 99998;
  transition: width 0.1s ease-out;
}

/* ==========================================
   骨架屏加载效果
   ========================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: 15px;
}

.skeleton-image {
  height: 200px;
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================
   无障碍优化
   ========================================== */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #00204a;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}

/* 焦点可见性增强 */
:focus-visible {
  outline: 3px solid #00bbf0;
  outline-offset: 3px;
}

/* ==========================================
   Cookie同意横幅
   ========================================== */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 32, 74, 0.98);
  padding: 15px 20px;
  z-index: 9998;
  transform: translateY(100%);
  transition: transform 0.5s ease;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
}

.cookie-consent.show {
  transform: translateY(0);
}

.cookie-consent-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
}

.cookie-consent-text {
  color: #ffffff;
  font-size: 14px;
  flex: 1;
  min-width: 250px;
}

.cookie-consent-text a {
  color: #00bbf0;
  text-decoration: underline;
}

.cookie-consent-buttons {
  display: flex;
  gap: 10px;
}

.cookie-btn {
  padding: 10px 25px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.cookie-btn-accept {
  background: linear-gradient(135deg, #00bbf0, #0095c8);
  color: #ffffff;
}

.cookie-btn-accept:hover {
  background: linear-gradient(135deg, #00d4ff, #00bbf0);
  transform: translateY(-2px);
}

.cookie-btn-decline {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.cookie-btn-decline:hover {
  border-color: #00bbf0;
  color: #00bbf0;
}

@media (max-width: 768px) {
  .cookie-consent-content {
    flex-direction: column;
    text-align: center;
  }
  
  .cookie-consent-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   页面过渡动画
   ========================================== */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #00204a, #001533);
  z-index: 99990;
  transform: translateX(-100%);
  transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.active {
  transform: translateX(0);
}

/* ==========================================
   响应式隐藏/显示
   ========================================== */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
}

/* ==========================================
   打印样式
   ========================================== */
@media print {
  .back-to-top,
  .cookie-consent,
  .scroll-progress,
  .page-loader,
  .breadcrumb-container {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  a {
    text-decoration: none;
    color: #000;
  }
  
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }
}
