/* ============================================================
   DualStar · 相册 app
   ============================================================ */

.album-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.album-shell {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  max-height: 100vh;
  background: var(--bg);
  border-radius: var(--phone-radius);
  box-shadow:
    0 0 0 12px var(--bg-elevated),
    0 0 0 13px var(--border-strong),
    var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .album-shell {
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* —— 全屏模式 —— */
/* 基础样式已由 base.css 统一处理（窗口化） */

/* 平板/桌面端全屏模式：更多网格列 */
@media (min-width: 769px) {
  [data-display-mode="fullscreen"] .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
}

/* 桌面端更宽的网格 */
@media (min-width: 1200px) {
  [data-display-mode="fullscreen"] .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* —— 顶部导航 —— */
.album-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  padding-top: calc(14px + var(--safe-area-top, env(safe-area-inset-top, 0px)));
  flex-shrink: 0;
}

.album-nav-title {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--safe-area-top, env(safe-area-inset-top, 0px)) / 2);
  transform: translate(-50%, -50%);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  pointer-events: none;
  white-space: nowrap;
}

.album-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}
.album-nav-btn:hover { background: var(--surface); }

.album-nav-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* —— 搜索栏 —— */
.album-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 8px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.album-search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.album-search-bar input:focus {
  border-color: var(--accent);
}
.album-search-bar button {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.album-search-bar button:hover {
  background: var(--border);
}

/* —— 批量操作栏 —— */
.album-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text);
}
.album-batch-bar span {
  font-weight: 500;
}
.album-batch-actions {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}
.album-batch-bar .btn-mini {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.album-batch-bar .btn-mini:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.album-batch-bar .btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

/* —— 缩略图描述指示器（小圆点） —— */
.album-thumb-desc-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

/* —— 批量选择模式 —— */
.album-thumb-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.album-thumb-selected {
  box-shadow: 0 0 0 3px var(--accent);
}
.album-thumb-selected .album-thumb-check {
  background: var(--accent);
}
.album-grid-batch .album-thumb:hover {
  transform: none;
}

.album-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 20px 4px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* —— 网格 —— */
.album-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.album-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  overflow: hidden;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.album-thumb:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.album-thumb-flag {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--text-inverse);
  letter-spacing: 0.3px;
}

.album-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.album-thumb-loading .album-thumb-placeholder {
  opacity: 0.2;
}

/* —— 分组标签 —— */
.album-group-tabs {
  display: flex;
  gap: 0;
  padding: 8px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.album-group-tabs::-webkit-scrollbar { display: none; }
.album-group-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--r-full);
  background: var(--surface);
  margin-right: 6px;
  cursor: pointer;
  transition: all var(--dur-fast);
  white-space: nowrap;
}
.album-group-tab.active {
  background: var(--accent);
  color: var(--text-inverse);
}
.album-group-tab.album-group-manage {
  color: var(--accent);
  border: 1px solid var(--accent);
  background: transparent;
}

/* —— 查看器描述 —— */
.album-viewer-desc {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  text-align: center;
  min-height: 24px;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.5;
  flex-shrink: 0;
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
}
.album-viewer-desc strong {
  font-weight: 600;
  color: var(--text);
}
.album-viewer-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.album-viewer-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* —— 空状态 —— */
.album-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-tertiary);
}
.album-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  opacity: 0.4;
}
.album-empty p {
  font-size: 14px;
  margin: 0 0 4px;
}
.album-empty .micro {
  font-size: 12px;
  opacity: 0.7;
}

/* ============================================================
   全屏查看器
   ============================================================ */
.album-viewer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.album-viewer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  padding-top: calc(14px + var(--safe-area-top, env(safe-area-inset-top, 0px)));
  flex-shrink: 0;
}

.album-viewer-nav-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.5px;
  font-family: var(--font-display);
}

.album-viewer-nav-actions {
  display: flex;
  gap: 4px;
}

.album-viewer-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}
.album-viewer-nav-btn:hover { background: var(--surface); }
.album-viewer-nav-danger:hover {
  color: var(--danger);
  background: rgba(201, 168, 160, 0.15);
}

.album-viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* 幻灯片进度条 */
.album-slideshow-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0,0,0,0.1);
  z-index: 10;
}
.album-slideshow-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.album-viewer-image-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: none;
}
.album-viewer-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-md);
  animation: albumFadeIn var(--dur-base) var(--ease-out);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  will-change: transform;
}

@keyframes albumFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.album-viewer-placeholder {
  color: var(--text-tertiary);
  font-size: 14px;
}

.album-viewer-arrow {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  margin: 0 8px;
}
.album-viewer-arrow:hover {
  background: var(--surface);
  transform: scale(1.05);
}

.album-viewer-thumbs {
  display: flex;
  gap: 6px;
  padding: 12px 16px calc(12px + var(--safe-area-bottom, env(safe-area-inset-bottom, 0px)));
  overflow-x: auto;
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  scrollbar-width: none;
}
.album-viewer-thumbs::-webkit-scrollbar {
  display: none;
}

.album-viewer-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.album-viewer-thumb.active {
  border-color: var(--accent);
  transform: scale(1.05);
}
