/* ===== XSUN Certificates Carousel - 前端样式 ===== */

/* 主容器 - 全宽度设计 */
.cert-carousel {
  margin: 0 0 48px;
  padding: 48px 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
  border-top: 1px solid #e1e8ed;
  border-bottom: 1px solid #e1e8ed;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  overflow: hidden;
}

.carousel-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.carousel-title {
  margin: 0 0 32px;
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  color: #0e1b2e;
  letter-spacing: -0.02em;
}

/* 滑块容器 */
.cert-slider {
  position: relative;
  padding: 0 80px;
}

.cert-track-wrapper {
  overflow: hidden;
  border-radius: 12px;
}

.cert-track {
  display: flex;
  gap: 20px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 8px 0;
}

/* 证书卡片 */
.cert-card {
  flex: 0 0 300px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(11, 95, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.cert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0b5fff, #2196f3);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.cert-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(11, 95, 255, 0.15);
  border-color: rgba(11, 95, 255, 0.3);
}

.cert-card:hover::before {
  transform: scaleX(1);
}

/* 缩略图 */
.cert-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  margin-bottom: 16px;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
}

.cert-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform 0.3s ease;
}

.cert-card:hover .cert-thumb {
  transform: scale(1.05);
}

.cert-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
}

.cert-thumb-placeholder svg {
  width: 64px;
  height: 64px;
}

/* 下载徽章 */
.cert-download-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(11, 95, 255, 0.9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.cert-card:hover .cert-download-badge {
  background: #0b5fff;
  transform: scale(1.1);
}

.cert-download-badge svg {
  width: 20px;
  height: 20px;
}

/* 证书内容 */
.cert-content {
  text-align: left;
}

.cert-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: #0e1b2e;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s ease;
}

.cert-card:hover .cert-name {
  color: #0b5fff;
}

.cert-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #666;
  margin: 0;
}

.cert-meta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* 导航按钮 */
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: 2px solid #e1e8ed;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 10;
  transition: all 0.3s ease;
  color: #0b5fff;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-btn span {
  display: block;
  line-height: 1;
}

.slider-btn:hover:not(:disabled) {
  background: #0b5fff;
  color: #fff;
  border-color: #0b5fff;
  transform: translateY(-50%) scale(1.1);
}

.slider-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #f5f5f5;
  color: #ccc;
  border-color: #e0e0e0;
}

.slider-btn.prev { 
  left: 20px; 
}

.slider-btn.next { 
  right: 20px; 
}

/* 指示器点 */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.carousel-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d0d0d0;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dots .dot:hover {
  background: #999;
  transform: scale(1.2);
}

.carousel-dots .dot.active {
  background: #0b5fff;
  width: 32px;
  border-radius: 6px;
}

/* 空状态 */
.xsun-certs-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  background: #f9f9f9;
  border-radius: 8px;
  margin: 20px 0;
}

.xsun-certs-empty p {
  margin: 0;
  font-size: 1.1rem;
}

/* ===== 响应式设计 ===== */

@media (max-width: 1200px) {
  .carousel-inner {
    max-width: 100%;
    padding: 0 60px;
  }
  
  .cert-slider {
    padding: 0 60px;
  }
  
  .cert-card {
    flex: 0 0 280px;
  }
  
  .slider-btn.prev {
    left: 10px;
  }
  
  .slider-btn.next {
    right: 10px;
  }
}

@media (max-width: 768px) {
  .cert-carousel {
    padding: 32px 0;
  }
  
  .carousel-inner {
    padding: 0 40px;
  }
  
  .carousel-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
  }
  
  .cert-slider {
    padding: 0 50px;
  }
  
  .cert-card {
    flex: 0 0 260px;
  }
  
  .cert-thumb-wrapper {
    height: 160px;
  }
  
  .slider-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  
  .carousel-dots {
    gap: 8px;
  }
  
  .carousel-dots .dot {
    width: 10px;
    height: 10px;
  }
  
  .carousel-dots .dot.active {
    width: 24px;
  }
}

@media (max-width: 480px) {
  .carousel-inner {
    padding: 0 30px;
  }
  
  .cert-slider {
    padding: 0 40px;
  }
  
  .cert-card {
    flex: 0 0 240px;
  }
  
  .cert-track {
    gap: 12px;
  }
  
  .cert-thumb-wrapper {
    height: 140px;
  }
  
  .slider-btn.prev {
    left: 5px;
  }
  
  .slider-btn.next {
    right: 5px;
  }
}

/* ===== 动画效果 ===== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cert-card {
  animation: fadeIn 0.5s ease-out;
}

.cert-card:nth-child(1) { animation-delay: 0.1s; }
.cert-card:nth-child(2) { animation-delay: 0.2s; }
.cert-card:nth-child(3) { animation-delay: 0.3s; }
.cert-card:nth-child(4) { animation-delay: 0.4s; }
.cert-card:nth-child(5) { animation-delay: 0.5s; }

/* ===== 打印样式 ===== */

@media print {
  .cert-carousel {
    width: 100%;
    margin: 0;
    padding: 20px 0;
    background: none;
    border: none;
  }
  
  .slider-btn,
  .carousel-dots {
    display: none;
  }
  
  .cert-track {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  
  .cert-card {
    flex: none;
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ===== 可访问性增强 ===== */

.cert-card:focus-visible {
  outline: 3px solid #0b5fff;
  outline-offset: 2px;
}

.slider-btn:focus-visible {
  outline: 3px solid #0b5fff;
  outline-offset: 4px;
}

.carousel-dots .dot:focus-visible {
  outline: 2px solid #0b5fff;
  outline-offset: 2px;
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  .cert-track,
  .cert-card,
  .slider-btn,
  .cert-thumb {
    transition: none;
  }
  
  .cert-card {
    animation: none;
  }
}
