/* ========== 基础样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== 头部 ========== */
header {
  text-align: center;
  padding: 40px 0 20px;
}

header h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-top: 8px;
  font-size: 1rem;
}

/* ========== 按钮通用 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #fff;
}

.btn-refresh {
  background: #2a2a3e;
  color: #aaa;
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-refresh:hover {
  background: #3a3a5e;
  color: #fff;
}

.btn-download {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.btn-download:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-delete {
  background: #e74c3c;
}

.btn-delete:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

/* ========== 上传区域 ========== */
.upload-section {
  margin: 30px 0;
}

.upload-area {
  border: 2px dashed #444;
  border-radius: 16px;
  padding: 50px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #1a1a2e;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #667eea;
  background: #1e1e3a;
  transform: scale(1.01);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.upload-hint {
  color: #666;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* 进度条 */
.upload-progress {
  margin-top: 16px;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #2a2a3e;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width 0.3s ease;
}

#progressText {
  color: #888;
  font-size: 0.85rem;
}

/* ========== 图片列表 ========== */
.gallery-section {
  margin-top: 20px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.gallery-header h2 {
  font-size: 1.4rem;
  color: #ccc;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #666;
  padding: 40px;
}

.empty-state {
  text-align: center;
  color: #666;
  padding: 60px 20px;
}

/* 图片卡片 */
.image-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a2e;
  cursor: pointer;
  transition: all 0.3s ease;
  aspect-ratio: 1;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-card .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-card:hover .card-overlay {
  opacity: 1;
}

.card-overlay .card-name {
  font-size: 0.8rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-overlay .card-size {
  font-size: 0.7rem;
  color: #aaa;
  margin-top: 2px;
}

/* ========== 模态框 ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
}

.modal-content img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  transition: transform 0.2s;
}

.modal-close:hover {
  transform: scale(1.2);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-info {
  color: #888;
  font-size: 0.85rem;
  text-align: center;
}

/* ========== Toast 通知 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ========== 管理后台 ========== */
.admin-container {
  max-width: 1000px;
}

.admin-login {
  display: flex;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 420px;
  background: #1a1a2e;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
  color: #ddd;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  color: #aaa;
  font-size: 0.9rem;
}

.form-group input {
  background: #0f0f1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
}

.form-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h2 {
  font-size: 1.4rem;
  color: #ccc;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  animation:
    slideIn 0.3s ease,
    fadeOut 0.3s ease 2.7s forwards;
  min-width: 200px;
}

.toast.success {
  background: #27ae60;
}

.toast.error {
  background: #e74c3c;
}

.toast.info {
  background: #3498db;
}

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

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .upload-area {
    padding: 30px 16px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
}
