/**
 * Dynamic CSS - Runtime generated styles
 * 动态CSS - 运行时生成的样式
 */

/* Animation keyframes */
@keyframes slideInRight {
  from { 
    transform: translateX(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

@keyframes slideOutRight {
  from { 
    transform: translateX(0); 
    opacity: 1; 
  }
  to { 
    transform: translateX(100%); 
    opacity: 0; 
  }
}

@keyframes spin {
  0% { 
    transform: translate(-50%, -50%) rotate(0deg); 
  }
  100% { 
    transform: translate(-50%, -50%) rotate(360deg); 
  }
}

/* Loading overlay */
.loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid var(--coral-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10000;
  transform: translate(-50%, -50%);
}

/* Message styles */
.message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
  animation: slideInRight 0.3s ease;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-success {
  background: #27ae60;
}

.message-error {
  background: #e74c3c;
}

.message-info {
  background: #3498db;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #333;
}

/* Photo Viewer Styles - 优化性能版本 */
.photo-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  /* GPU加速 */
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.photo-viewer-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  font-size: 3rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  transition: color 0.3s ease;
}

.photo-viewer-close:hover {
  color: white;
}

.photo-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  /* 优化图片渲染性能 */
  will-change: transform;
  transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: opacity 0.3s ease;
}

.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateZ(0);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
  backdrop-filter: blur(5px);
  /* 性能优化 */
  will-change: transform;
  backface-visibility: hidden;
}

.photo-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1) translateZ(0);
}

.photo-nav-prev {
  left: -70px;
}

.photo-nav-next {
  right: -70px;
}

.photo-viewer-info {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.photo-counter {
  font-size: 1rem;
  margin-bottom: 5px;
  opacity: 0.9;
}

.photo-caption {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .photo-viewer-modal {
    padding: 10px;
  }
  
  .photo-viewer-close {
    top: 10px;
    right: 15px;
    font-size: 2rem;
    width: 40px;
    height: 40px;
  }
  
  .photo-nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  .photo-nav-prev {
    left: 10px;
  }
  
  .photo-nav-next {
    right: 10px;
  }
  
  .photo-viewer-content {
    max-height: 70vh;
  }
}

/* Gallery item hover effects - 性能优化版本 */
.gallery-item {
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
  /* 确保没有白边 */
  background: transparent;
  /* 性能优化 */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.gallery-item:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: block; /* 消除img元素底部的默认间隙 */
  border-radius: inherit; /* 继承父元素的圆角 */
  /* 性能优化 */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.gallery-item:hover img {
  transform: scale(1.1) translateZ(0);
}

/* Add a subtle overlay on hover to indicate clickability */
.gallery-item::after {
  content: '🔍';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: white;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-item:hover::after {
  opacity: 1;
}
