/* ─────────────────────────────────────────────
   AlbumDetail — fixed overlay
───────────────────────────────────────────── */
.album-detail {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--tv-bg, #0f0c09);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.album-detail--open {
  opacity: 1;
  transform: scale(1);
}

.album-detail--exit {
  opacity: 0;
  transform: scale(0.95);
}

/* ── Header ── */
.album-detail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tv-line, rgba(232, 221, 208, 0.1));
  flex-shrink: 0;
}

.album-detail__back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--tv-line-bright, rgba(232, 221, 208, 0.22));
  background: transparent;
  color: var(--tv-text, #e8ddd0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 200ms, border-color 200ms;
}

.album-detail__back:hover {
  background: var(--tv-line, rgba(232, 221, 208, 0.1));
  border-color: var(--tv-muted, rgba(232, 221, 208, 0.45));
}

.album-detail__title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.album-detail__name {
  font-family: var(--tv-serif, Georgia, 'Times New Roman', serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--tv-text, #e8ddd0);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-detail__region {
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tv-muted, rgba(232, 221, 208, 0.45));
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--tv-line, rgba(232, 221, 208, 0.1));
  width: fit-content;
}

.album-detail__region--editable {
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s, background 0.2s;
}
.album-detail__region--editable:hover {
  border-color: var(--tv-line-bright, rgba(232, 221, 208, 0.22));
  background: var(--tv-surface-2, #221c14);
}

.album-detail__region-edit-icon {
  opacity: 0;
  transition: opacity 0.2s;
}
.album-detail__region--editable:hover .album-detail__region-edit-icon {
  opacity: 0.6;
}

.album-detail__region-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.album-detail__region-ok {
  color: #c8905e;
}
.album-detail__region-err {
  color: #dc5050;
}

.album-detail__pin-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--tv-line-bright, rgba(232, 221, 208, 0.22));
  background: transparent;
  color: var(--tv-muted, rgba(232, 221, 208, 0.45));
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 9px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}
.album-detail__pin-btn:hover {
  border-color: #c8905e;
  color: #c8905e;
  background: rgba(200, 144, 94, 0.08);
}

/* ── Region editor ── */
.album-detail__region-editor {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.album-detail__region-input {
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--tv-text, #e8ddd0);
  background: var(--tv-surface-2, #221c14);
  border: 1px solid var(--tv-line-bright, rgba(232, 221, 208, 0.22));
  border-radius: 4px;
  padding: 4px 8px;
  width: 160px;
  outline: none;
}
.album-detail__region-input:focus {
  border-color: var(--tv-accent, #c8905e);
}

.album-detail__region-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--tv-surface, #1a1510);
  border: 1px solid var(--tv-line-bright, rgba(232, 221, 208, 0.22));
  border-radius: 6px;
  max-height: 180px;
  overflow-y: auto;
  min-width: 160px;
  scrollbar-width: thin;
}

.album-detail__region-suggestion {
  display: block;
  width: 100%;
  padding: 6px 12px;
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  color: var(--tv-text, #e8ddd0);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.album-detail__region-suggestion:hover {
  background: var(--tv-line, rgba(232, 221, 208, 0.1));
}

.album-detail__region-cancel {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--tv-line, rgba(232, 221, 208, 0.1));
  color: var(--tv-muted, rgba(232, 221, 208, 0.45));
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.album-detail__region-cancel:hover {
  background: var(--tv-line-bright, rgba(232, 221, 208, 0.22));
}

.album-detail__count {
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 11px;
  color: var(--tv-muted, rgba(232, 221, 208, 0.45));
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Body ── */
.album-detail__body {
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ── Loading dots ── */
.album-detail__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 80px 0;
}

.album-detail__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tv-muted, rgba(232, 221, 208, 0.45));
  animation: albumDetailPulse 1.2s ease-in-out infinite;
}

.album-detail__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.album-detail__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes albumDetailPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* ── Error / Empty ── */
.album-detail__error,
.album-detail__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
}

.album-detail__error-text {
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 12px;
  color: #c85a4a;
}

.album-detail__empty-text {
  font-family: var(--tv-mono, 'SF Mono', 'Fira Code', monospace);
  font-size: 12px;
  color: var(--tv-dim, rgba(232, 221, 208, 0.25));
}

/* ── SwipeableView height chain fix ──
   AlbumDetail is a fixed flex-column overlay.
   SwipeableView must fill the remaining space so its panel can scroll. */
.album-detail .swipeable-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.album-detail .swipeable-view__track {
  flex: 1;
  min-height: 0;
}

.album-detail .swipeable-view__panel {
  height: 100%;
  overflow-y: auto;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .album-detail__header {
    padding: 12px 16px;
  }

  .album-detail__name {
    font-size: 18px;
  }

  .album-detail__body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .album-detail {
    transition: none;
  }

  .album-detail__dot {
    animation: none;
    opacity: 0.6;
  }
}
