* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  padding: 20px;
}

.container { 
  max-width: 1400px; 
  margin: 0 auto; 
}

h1 {
  margin-bottom: 30px;
  color: #333;
}

/* 浮动上传按钮 */
.upload-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: #0066ff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,102,255,0.4);
  transition: all 0.3s;
  z-index: 100;
}

.upload-fab:hover {
  background: #0052cc;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,102,255,0.5);
}

/* 上传弹窗 */
.upload-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1001;
  padding: 20px;
  overflow: auto;
}

.upload-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 30px;
}

.upload-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #f0f0f0;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.2s;
}

.upload-close:hover {
  background: #e0e0e0;
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

input[type="text"], 
input[type="password"],
input[type="email"],
textarea, 
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: #0066ff;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

textarea { 
  resize: vertical; 
  min-height: 100px; 
}

input[type="file"] {
  padding: 8px 12px;
}

small {
  color: #666;
  display: block;
  margin-top: 5px;
  font-size: 12px;
}

button {
  background: #0066ff;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

button:hover { 
  background: #0052cc; 
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* 标签选择器 */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: #f9f9f9;
  border-radius: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.tag-option {
  display: inline-block;
  background: #e0e0e0;
  color: #333;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tag-option:hover {
  background: #d0d0d0;
}

.tag-option.selected {
  background: #0066ff;
  color: white;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 32px;
}

.selected-tag {
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.selected-tag .remove {
  cursor: pointer;
  font-weight: bold;
  color: #1976d2;
}

.selected-tag .remove:hover {
  color: #d32f2f;
}

/* 公开/私有选择器 */
.privacy-options {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.privacy-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.privacy-option:hover {
  border-color: #0066ff;
  background: #f8faff;
}

.privacy-option input[type="radio"] {
  width: auto;
  margin: 0 0 8px 0;
  padding: 0;
}

.privacy-option input[type="radio"]:checked + span {
  color: #0066ff;
  font-weight: 600;
}

.privacy-option span {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.privacy-option small {
  color: #999;
  font-size: 12px;
  margin-top: 2px;
}

/* 筛选栏 */
.filter-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.filter-row input {
  flex: 1;
  min-width: 200px;
}

.filter-row button {
  width: auto;
  padding: 12px 24px;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.filter-tag-option {
  background: #f0f0f0;
  color: #333;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.filter-tag-option:hover {
  background: #e0e0e0;
}

.filter-tag-option.active {
  background: #0066ff;
  color: white;
  border-color: #0066ff;
}

/* 瀑布流 */
.gallery {
  column-count: 4;
  column-gap: 20px;
  contain: layout style paint; /* 性能优化 */
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 20px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
  will-change: transform; /* ✅ 提示浏览器优化 */
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

/* ✅ 图片懒加载优化 */
.gallery-item img {
  width: 100%;
  display: block;
  height: auto;
  content-visibility: auto; /* 渲染优化 */
}

.item-tags {
  padding: 12px;
  font-size: 12px;
  color: #666;
}

.tag {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 10px;
  border-radius: 12px;
  margin: 2px;
  font-size: 12px;
}

/* 私有图片标记 */
.privacy-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* 详情弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  padding: 20px;
  overflow: auto;
}

.modal.active { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  position: relative;
  display: flex;
  overflow: hidden;
}

.modal-left {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-width: 0;
}

.modal-image {
  max-width: 100%;
  max-height: calc(90vh - 40px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.modal-right {
  flex: 0 0 400px;
  padding: 30px;
  overflow-y: auto;
  background: white;
}

.modal-right h3 {
  margin-bottom: 10px;
  margin-top: 25px;
  color: #333;
  font-size: 16px;
}

.modal-right h3:first-child {
  margin-top: 0;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 24px;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(0,0,0,0.8);
}

.prompt-text {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-size: 14px;
  max-height: 300px;
  overflow-y: auto;
  color: #333;
}

.copy-btn {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  transition: background 0.2s;
  width: 100%;
}

.copy-btn:hover {
  background: #45a049;
}

.copy-btn.copied {
  background: #2196F3;
}

/* 加载提示 */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 1200px) { 
  .gallery { column-count: 3; } 
}

@media (max-width: 900px) { 
  .gallery { column-count: 2; } 
}

@media (max-width: 768px) {
  .modal-content {
    flex-direction: column;
    max-height: 95vh;
  }
  
  .modal-left {
    flex: 0 0 auto;
    max-height: 50vh;
  }
  
  .modal-right {
    flex: 1;
    min-height: 0;
  }
  
  .modal-image {
    max-height: 50vh;
  }
  
  .upload-fab {
    width: 50px;
    height: 50px;
    font-size: 24px;
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 600px) { 
  .gallery { column-count: 1; }
  
  body {
    padding: 10px;
  }
  
  .filter-row {
    flex-direction: column;
  }
  
  .filter-row input,
  .filter-row button {
    width: 100%;
  }
}

/* 之前的所有代码保持不变 */
/* ... */

@media (max-width: 600px) { 
  .gallery { column-count: 1; }
  
  body {
    padding: 10px;
  }
  
  .filter-row {
    flex-direction: column;
  }
  
  .filter-row input,
  .filter-row button {
    width: 100%;
  }
}

/* ✅✅✅ 从这里开始添加骨架屏样式 ✅✅✅ */

/* 骨架屏占位 */
.gallery-skeleton {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.skeleton-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skeleton-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

.skeleton-tags {
  padding: 12px;
  height: 40px;
  background: #f9f9f9;
}

@media (max-width: 1200px) { 
  .gallery-skeleton { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) { 
  .gallery-skeleton { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) { 
  .gallery-skeleton { grid-template-columns: 1fr; }
}
