/**
 * Mac 设备框组件
 * 用于展示 PC 端产品界面截图
 */

/* Mac 框容器 */
.mac-frame {
  --mac-frame-bg: linear-gradient(180deg, #e8e8e8 0%, #d4d4d4 100%);
  --mac-frame-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
  --mac-frame-border: #c8c8c8;
  --mac-content-bg: #1a1a1a;

  position: relative;
  display: inline-block;
  background: var(--mac-frame-bg);
  border-radius: 14px 14px 0 0;
  padding: 14px 14px 0 14px;
  box-shadow: var(--mac-frame-shadow);
  transform: translateZ(0); /* 开启硬件加速 */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mac-frame:hover {
  transform: translateY(-8px) translateZ(0);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.45);
}

/* 屏幕内容区 */
.mac-frame-content {
  position: relative;
  background: var(--mac-content-bg);
  border-radius: 4px;
  overflow: hidden;
  display: block;
}

.mac-frame-content img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 顶部工具栏 */
.mac-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, #f0f0f0 0%, #e0e0e0 100%);
  border-radius: 14px 14px 0 0;
  z-index: 1;
}

/* 摄像头 */
.mac-frame::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #666;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* 底部底座 */
.mac-base {
  position: relative;
  height: 20px;
  background: linear-gradient(180deg, #d4d4d4 0%, #b8b8b8 100%);
  border-radius: 0 0 20px 20px;
  margin-top: -2px;
  margin-left: -14px;
  margin-right: -14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.mac-base::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, transparent, #999, transparent);
  border-radius: 2px;
}

/* 尺寸变体 */
.mac-frame-sm {
  max-width: 400px;
}

.mac-frame-md {
  max-width: 600px;
}

.mac-frame-lg {
  max-width: 800px;
}

.mac-frame-xl {
  max-width: 1000px;
}

/* 响应式 */
@media (max-width: 768px) {
  .mac-frame {
    padding: 10px 10px 0 10px;
  }

  .mac-base {
    margin-left: -10px;
    margin-right: -10px;
  }

  .mac-frame-lg,
  .mac-frame-xl {
    max-width: 100%;
  }
}

/* 加载状态 */
.mac-frame.loading .mac-frame-content {
  min-height: 300px;
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 搭配轮播使用 */
.mac-carousel {
  position: relative;
}

.mac-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 10;
}

.mac-carousel-nav:hover {
  background: white;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.mac-carousel-nav.prev {
  left: -20px;
}

.mac-carousel-nav.next {
  right: -20px;
}

.mac-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 1rem;
}

.mac-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mac-carousel-dot.active {
  width: 24px;
  border-radius: 4px;
  background: #3182ce;
}
