/* ============================================================================
   Verba 灵感画廊与多模态图片空间样式表 (public/gallery.css)
   职责：画廊折叠展开平滑过渡、竖向黄金比例卡片网格、拖拽上传高亮、大图灯箱预览
   ============================================================================ */

/* 1. 画廊主容器板块 */
.gallery-section {
  margin-top: 14px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.gallery-section:hover {
  border-color: var(--border-focus);
}

/* 拖拽高亮态 */
.gallery-section.drag-active,
.live-card.drag-active {
  border-color: #2dd4bf !important;
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.25), 0 8px 24px rgba(45, 212, 191, 0.15) !important;
}

/* 2. 画廊头部栏 (Header) */
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.gallery-section.expanded .gallery-header {
  border-bottom-color: var(--border-subtle);
}

.gallery-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-icon {
  font-size: 15px;
  line-height: 1;
}

.gallery-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.gallery-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(45, 212, 191, 0.12);
  color: #2dd4bf;
}

.gallery-storage-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  cursor: help;
}

.gallery-filter-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.gallery-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-gallery-batch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gallery-batch:hover,
.btn-gallery-batch.active {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.btn-gallery-upload {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px dashed var(--border-focus);
  background: rgba(45, 212, 191, 0.08);
  color: #2dd4bf;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gallery-upload:hover {
  background: rgba(45, 212, 191, 0.18);
  border-style: solid;
}

.btn-gallery-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.25s ease, color 0.2s ease;
}

.btn-gallery-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.gallery-section.expanded .btn-gallery-toggle svg {
  transform: rotate(180deg);
}

/* 2.1 物料箱高级检索与筛选工具条 */
.gallery-toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
  flex-wrap: wrap;
}

.gallery-section.expanded .gallery-toolbar {
  display: flex;
}

.gallery-categories {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.gallery-cat-pill {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-cat-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.gallery-cat-pill.active {
  background: rgba(45, 212, 191, 0.14);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.3);
  font-weight: 500;
}

.gallery-search-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.gallery-search-input {
  width: 125px;
  height: 24px;
  padding: 0 20px 0 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-primary);
  outline: none;
  transition: width 0.2s ease, border-color 0.2s ease;
}

.gallery-search-input:focus {
  width: 165px;
  border-color: #2dd4bf;
}

.gallery-search-clear {
  position: absolute;
  right: 5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
}

.gallery-sort-select {
  height: 24px;
  padding: 0 6px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

.gallery-sort-select:focus {
  border-color: #2dd4bf;
}

/* 2.2 批量操作悬浮条 */
.gallery-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(14, 165, 233, 0.08);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.gallery-batch-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-batch-count {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
}

.btn-batch-select-all {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  cursor: pointer;
}

.gallery-batch-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-batch-action {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-batch-action:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-batch-action.btn-batch-del:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #fff;
}

.btn-batch-cancel {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-batch-cancel:hover {
  color: var(--text-primary);
}

/* 3. 画廊可折叠主体 (Body) */
.gallery-body {
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              padding 0.35s ease;
}

.gallery-section.expanded .gallery-body {
  max-height: 290px;
  opacity: 1;
  padding: 10px 12px 14px 12px;
  overflow-y: auto;
}

/* 4. 竖向卡片网格布局 */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 10px;
}

/* 上传占位卡片 */
.gallery-card-upload {
  aspect-ratio: 3 / 4;
  border: 1.5px dashed var(--border-focus);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
}

.gallery-card-upload:hover {
  border-color: #2dd4bf;
  color: #2dd4bf;
  background: rgba(45, 212, 191, 0.06);
}

.gallery-card-upload-icon {
  font-size: 20px;
}

/* 竖向图片卡片 */
.gallery-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.gallery-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-card-img {
  transform: scale(1.04);
}

/* 卡片角标 */
.gallery-card-tag {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 1px 5px;
  font-size: 10px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  pointer-events: none;
  z-index: 2;
}

/* 卡片悬浮操作栏 */
.gallery-card-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 4px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0) 100%);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 3;
}

.gallery-card:hover .gallery-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.btn-card-action {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-card-action:hover {
  background: #2dd4bf;
  color: #042f2e;
  transform: scale(1.15);
}

.btn-card-action.btn-card-del:hover {
  background: #f43f5e;
  color: #fff;
}

/* 卡片多选复选框 */
.gallery-card-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: rgba(15, 23, 42, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  z-index: 4;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-grid.batch-mode .gallery-card-checkbox {
  display: flex;
}

.gallery-card.selected .gallery-card-checkbox {
  background: #2dd4bf;
  border-color: #2dd4bf;
  color: #042f2e;
}

.gallery-card.selected {
  border-color: #2dd4bf !important;
  box-shadow: 0 0 0 1.5px #2dd4bf, 0 6px 18px rgba(45, 212, 191, 0.25) !important;
}

/* 非图片文件卡片 (File Card) */
.gallery-card.file-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 8px 10px 8px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.55);
}

.file-card-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  gap: 6px;
}

.file-card-icon {
  font-size: 28px;
  line-height: 1;
}

.file-card-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

/* 各类型专属标签色彩体系 */
.gallery-card.cat-archive .file-card-badge { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.gallery-card.cat-doc .file-card-badge { background: rgba(14, 165, 233, 0.2); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.gallery-card.cat-code .file-card-badge { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.gallery-card.cat-media .file-card-badge { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.gallery-card.cat-other .file-card-badge { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

.file-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.file-card-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.file-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 空状态 */
.gallery-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* 5. 全屏大图灯箱预览 (Image Preview Modal / Lightbox) */
.image-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

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

.preview-main-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  user-select: none;
}

/* 切换左右箭头 */
.btn-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-preview-nav:hover {
  background: rgba(45, 212, 191, 0.8);
  color: #042f2e;
  transform: translateY(-50%) scale(1.1);
}

.btn-preview-prev { left: -56px; }
.btn-preview-next { right: -56px; }

@media (max-width: 768px) {
  .btn-preview-prev { left: 4px; }
  .btn-preview-next { right: 4px; }
}

/* 预览底部工具栏 */
.preview-toolbar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 30px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.preview-meta-text {
  font-size: 12px;
  color: var(--text-secondary);
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-preview-action {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-preview-action:hover {
  background: #2dd4bf;
  color: #042f2e;
  border-color: #2dd4bf;
}

.btn-preview-action.btn-del:hover {
  background: #f43f5e;
  color: #fff;
  border-color: #f43f5e;
}

.btn-preview-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preview-close:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: rotate(90deg);
}

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

/* 8. 卡片流内嵌富媒体图片呈现 (Inline Card Media) */
.card-media-wrapper {
  margin: 8px 0;
  display: block;
}

.card-inline-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  cursor: zoom-in;
  display: block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-inline-img:hover {
  transform: scale(1.015);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px #2dd4bf;
}

/* ============================================================================
   9. 晨曦白天模式配色系统适配 ([data-theme="light"])
   ============================================================================ */
[data-theme="light"] .gallery-section {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .gallery-header:hover {
  background: #f8fafc;
}

[data-theme="light"] .gallery-toolbar {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .gallery-cat-pill {
  background: #ffffff;
  color: #475569;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .gallery-cat-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .gallery-cat-pill.active {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #5eead4;
}

[data-theme="light"] .gallery-search-input,
[data-theme="light"] .gallery-sort-select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .gallery-search-input:focus,
[data-theme="light"] .gallery-sort-select:focus {
  border-color: #0d9488;
}

[data-theme="light"] .gallery-card-upload {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #64748b;
}

[data-theme="light"] .gallery-card-upload:hover {
  background: #f0fdfa;
  border-color: #0d9488;
  color: #0d9488;
}

[data-theme="light"] .gallery-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .gallery-card:hover {
  border-color: #0d9488;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .gallery-card.file-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .gallery-card.file-card .file-card-name {
  color: #0f172a;
}

[data-theme="light"] .gallery-card-actions {
  background: rgba(255, 255, 255, 0.92);
}

[data-theme="light"] .btn-card-action {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

[data-theme="light"] .btn-card-action:hover {
  background: #0d9488;
  color: #ffffff;
}

[data-theme="light"] .gallery-batch-bar {
  background: #f0f9ff;
  border-bottom-color: #bae6fd;
}

[data-theme="light"] .gallery-batch-count {
  color: #0284c7;
}

[data-theme="light"] .btn-batch-select-all {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #7dd3fc;
}
