/**
 * Splatoon 3 Hub - Polaroid Gallery Styles
 * Complete polaroid style - shadow border + paper shadow
 * 与 gathering-polaroid.css 配合使用
 */

/* ============================================
   Gallery Grid Layout - 拍立得叠加态布局
   ============================================ */

.polaroid-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 50px;
  padding: 50px 30px;
  position: relative;
  perspective: 1500px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ============================================
   Polaroid Card Styles - 拍立得叠加态布局
   ============================================ */

.polaroid-item {
  position: relative;
  background: #f5f5f5;
  padding: 16px;
  padding-bottom: 90px;
  border-radius: 6px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.5);
  transform: rotate(var(--rotation, 0deg)) scale(0.9);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  opacity: 0;
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  margin: -5px;
  flex-shrink: 0;
  z-index: 1;
}

/* 尺寸分类 - 每行4个卡片 (在1600px容器下) */
.polaroid-item.size-small {
  width: 340px;
}

.polaroid-item.size-medium {
  width: 360px;
}

.polaroid-item.size-large {
  width: 380px;
}

/* 增大卡片间隙 */
.polaroid-item {
  margin: -5px;
}

.polaroid-item.polaroid-visible {
  opacity: 1;
  transform: rotate(var(--rotation, 0deg)) scale(1);
  animation: polaroid-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes polaroid-appear {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(var(--rotation, 0deg));
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(var(--rotation, 0deg));
  }
}

/* Tape - 胶带效果 */
.polaroid-tape {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 80px;
  height: 30px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(2px);
  border-radius: 4px;
  z-index: 10;
  opacity: 0.85;
}

.polaroid-tape::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.1) 2px,
    rgba(255, 255, 255, 0.1) 4px
  );
  border-radius: 3px;
}

/* Image Container - 与 gathering-polaroid.css 兼容 */
.polaroid-image-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-item.size-small .polaroid-image-wrapper {
  height: 220px;
}

.polaroid-item.size-medium .polaroid-image-wrapper {
  height: 260px;
}

.polaroid-item.size-large .polaroid-image-wrapper {
  height: 300px;
}

.polaroid-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.4s ease;
  display: block;
}

.polaroid-item:hover .polaroid-image {
  transform: scale(1.02);
}

/* Category Badge - 分类角标 */
.polaroid-category {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 3px 8px;
  background: var(--splat-pink, #E6007E);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.polaroid-item:hover .polaroid-category {
  opacity: 1;
  transform: scale(1);
}

/* Card Info Area - 底部信息 - 重新设计 */
.polaroid-info {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  text-align: center;
  padding: 12px 8px;
  background: linear-gradient(135deg, rgba(230, 0, 126, 0.08) 0%, rgba(0, 160, 233, 0.05) 100%);
  border-radius: 8px;
  border: 1px solid rgba(230, 0, 126, 0.15);
}

.polaroid-title {
  font-family: 'Noto Sans SC', 'AsiaKCUBE-R', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #E6007E;
  margin: 0 0 8px 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(230, 0, 126, 0.15);
  letter-spacing: 0.5px;
}

.polaroid-meta {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: #555;
}

.polaroid-author {
  font-weight: 600;
  color: #333;
  background: rgba(230, 0, 126, 0.1);
  padding: 2px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.polaroid-author::before {
  content: '👤';
  font-size: 0.8em;
}

.polaroid-date {
  color: #666;
  font-size: 0.8rem;
  background: rgba(0, 160, 233, 0.1);
  padding: 2px 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.polaroid-date::before {
  content: '📅';
  font-size: 0.8em;
}

/* Hover Effects - 悬停效果 */
.polaroid-item:hover {
  z-index: 100 !important;
  transform: rotate(0deg) translateY(-20px) scale(1.05) !important;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(230, 0, 126, 0.3);
}

.polaroid-item:active {
  z-index: 10;
}

/* RGB故障边框效果 */
.polaroid-item::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 6px;
  border: 3px solid transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.polaroid-item:hover::after {
  opacity: 1;
  animation: rgb-border-cycle 0.5s linear infinite;
}

@keyframes rgb-border-cycle {
  0% { border-color: #E6007E; }
  33% { border-color: #00A0E9; }
  66% { border-color: #FFF000; }
  100% { border-color: #E6007E; }
}

/* Random Rotation (CSS Variables) */
.polaroid-item:nth-child(5n+1) { --rotation: -4deg; }
.polaroid-item:nth-child(5n+2) { --rotation: 3deg; }
.polaroid-item:nth-child(5n+3) { --rotation: -2deg; }
.polaroid-item:nth-child(5n+4) { --rotation: -1deg; }
.polaroid-item:nth-child(5n) { --rotation: 2deg; }

/* Category Specific Styles */
.polaroid-item[data-category="gathering"] .polaroid-category {
  background: #E6007E;
  box-shadow: 0 2px 8px rgba(230, 0, 126, 0.3);
}

.polaroid-item[data-category="gathering"] .polaroid-tape {
  background: rgba(230, 0, 126, 0.4);
}

.polaroid-item[data-category="gameplay"] .polaroid-category {
  background: #00A0E9;
  box-shadow: 0 2px 8px rgba(0, 160, 233, 0.3);
}

.polaroid-item[data-category="gameplay"] .polaroid-tape {
  background: rgba(0, 160, 233, 0.4);
}

.polaroid-item[data-category="creative"] .polaroid-category {
  background: #FFF000;
  box-shadow: 0 2px 8px rgba(255, 240, 0, 0.3);
  color: #000;
}

.polaroid-item[data-category="creative"] .polaroid-tape {
  background: rgba(255, 240, 0, 0.4);
}

/* 外部链接指示器 */
.polaroid-link-indicator {
  position: absolute;
  bottom: 95px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  z-index: 10;
  transition: all 0.3s ease;
}

.polaroid-item:hover .polaroid-link-indicator {
  transform: scale(1.1);
  background: #E6007E;
}

/* Filter Button Styles */
.filter-btn {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--btn-color, #6B2C91);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.filter-btn:hover::before {
  opacity: 0.3;
}

.filter-btn.active {
  background: var(--btn-color, #6B2C91);
  border-color: var(--btn-color, #6B2C91);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.filter-btn.active::before {
  opacity: 0;
}

/* Stats Styles */
.gallery-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.gallery-stats-count {
  font-size: 48px;
  font-weight: 900;
  color: var(--splat-pink, #E6007E);
  line-height: 1;
  text-shadow: 0 0 20px rgba(230, 0, 126, 0.5);
}

.gallery-stats-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
}

/* Lightbox Styles - 与 gathering-polaroid.css 兼容 */
.polaroid-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.polaroid-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.polaroid-lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
}

.polaroid-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  transform: scale(0.9) translateY(30px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-top: 40px;
}

.polaroid-lightbox.active .polaroid-lightbox-content {
  transform: scale(1) translateY(30px);
}

.polaroid-lightbox-image-container {
  position: relative;
  max-width: 100%;
  max-height: 65vh;
  overflow: hidden;
  border-radius: 12px;
  border: 4px solid transparent;
  animation: lightbox-rgb-border 2s linear infinite;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes lightbox-rgb-border {
  0% { border-color: #E6007E; }
  33% { border-color: #00A0E9; }
  66% { border-color: #FFF000; }
  100% { border-color: #E6007E; }
}

.polaroid-lightbox-image {
  max-width: 80vw;
  max-height: 65vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.polaroid-lightbox-info {
  margin-top: 20px;
  padding: 20px 25px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 12px;
  border: 2px solid #6B2C91;
  max-width: 550px;
  width: 100%;
}

.polaroid-lightbox-title {
  font-family: 'Noto Sans SC', 'AsiaKCUBE-R', sans-serif;
  font-size: 1.4rem;
  color: #fff;
  margin: 0 0 8px 0;
  text-shadow: 2px 2px 0 #E6007E;
}

.polaroid-lightbox-description {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.polaroid-lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.polaroid-lightbox-author {
  font-size: 0.9rem;
  color: #00A0E9;
}

.polaroid-lightbox-author::before {
  content: '👤 ';
}

.polaroid-lightbox-date {
  font-size: 0.9rem;
  color: #FFF000;
}

.polaroid-lightbox-date::before {
  content: '📅 ';
}

.polaroid-lightbox-category {
  display: inline-block;
  padding: 5px 15px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
}

.polaroid-lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 44px;
  height: 44px;
  font-size: 2rem;
  color: #fff;
  background: transparent;
  border: 3px solid #E6007E;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 10;
}

.polaroid-lightbox-close:hover {
  background: #E6007E;
  transform: rotate(90deg);
  box-shadow: 0 0 20px #E6007E;
}

.polaroid-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  font-size: 2rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 3px solid #00A0E9;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.polaroid-lightbox-nav:hover {
  background: #00A0E9;
  box-shadow: 0 0 20px #00A0E9;
  transform: translateY(-50%) scale(1.1);
}

.polaroid-lightbox-prev {
  left: -70px;
}

.polaroid-lightbox-next {
  right: -70px;
}

/* Responsive Design */
@media (max-width: 1500px) {
  .polaroid-item {
    margin: -5px;
  }
  
  .polaroid-item.size-small,
  .polaroid-item.size-medium,
  .polaroid-item.size-large {
    width: 300px;
  }
  
  .polaroid-item.size-small .polaroid-image-wrapper,
  .polaroid-item.size-medium .polaroid-image-wrapper,
  .polaroid-item.size-large .polaroid-image-wrapper {
    height: 200px;
  }
}

@media (max-width: 1200px) {
  .polaroid-grid {
    gap: 30px;
  }
  
  .polaroid-item {
    margin: -3px;
  }
  
  .polaroid-item.size-small,
  .polaroid-item.size-medium,
  .polaroid-item.size-large {
    width: 280px;
  }
  
  .polaroid-item.size-small .polaroid-image-wrapper,
  .polaroid-item.size-medium .polaroid-image-wrapper,
  .polaroid-item.size-large .polaroid-image-wrapper {
    height: 180px;
  }
}

@media (max-width: 768px) {
  .polaroid-grid {
    gap: 20px;
    padding: 20px 10px;
  }

  .polaroid-item {
    margin: -3px;
    padding: 12px;
    padding-bottom: 75px;
  }

  .polaroid-item.size-small,
  .polaroid-item.size-medium,
  .polaroid-item.size-large {
    width: 200px;
  }

  .polaroid-item.size-small .polaroid-image-wrapper,
  .polaroid-item.size-medium .polaroid-image-wrapper,
  .polaroid-item.size-large .polaroid-image-wrapper {
    height: 150px;
  }

  .polaroid-item:hover {
    transform: rotate(0deg) translateY(-10px) scale(1.03) !important;
  }

  .polaroid-tape {
    width: 60px;
    height: 22px;
    top: -14px;
  }

  .polaroid-info {
    padding: 8px 6px;
    bottom: 12px;
    left: 12px;
    right: 12px;
  }

  .polaroid-title {
    font-size: 0.95rem;
    margin-bottom: 6px;
  }

  .polaroid-meta {
    font-size: 0.8rem;
    gap: 8px;
  }
  
  .polaroid-author,
  .polaroid-date {
    padding: 2px 8px;
  }

  .polaroid-category {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .polaroid-link-indicator {
    bottom: 80px;
    right: 10px;
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .polaroid-lightbox-close {
    top: -15px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .polaroid-lightbox-prev {
    left: 10px;
  }

  .polaroid-lightbox-next {
    right: 10px;
  }

  .polaroid-lightbox-info {
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
  }

  .polaroid-lightbox-title {
    font-size: 16px;
  }
  
  .polaroid-lightbox-content {
    margin-top: 60px;
    max-height: 80vh;
  }
}

@media (max-width: 480px) {
  .polaroid-grid {
    gap: 15px;
    padding: 15px 8px;
  }

  .polaroid-item {
    margin: -2px;
    padding: 10px;
    padding-bottom: 65px;
    width: 160px !important;
  }

  .polaroid-image-wrapper {
    height: 120px !important;
  }

  .polaroid-tape {
    width: 50px;
    height: 20px;
    top: -12px;
  }
  
  .polaroid-info {
    padding: 6px 4px;
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .polaroid-title {
    font-size: 0.85rem;
    margin-bottom: 4px;
  }
  
  .polaroid-meta {
    font-size: 0.75rem;
    gap: 6px;
    flex-direction: column;
  }

  .polaroid-category {
    font-size: 9px;
    padding: 2px 6px;
  }
  
  .polaroid-link-indicator {
    bottom: 70px;
    right: 8px;
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}
