/* Shared thumbnail picker dialog (js/thumbnail-picker.js).
 * Used on the account dashboard and the show-page editors; both are dark
 * surfaces, and the selected/primary colours follow the page's accent when
 * it defines --accent-color. */

.tp-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 1100; padding: 20px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.tp-overlay.show { display: flex; }
.tp-overlay .hidden { display: none !important; }
.tp-dialog {
  background: #0d0d0d; border: 1px solid #1c1c1e; border-radius: 16px;
  max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 22px 22px 18px;
  text-align: left;
}
.tp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 16px; }
.tp-title { font-size: 1.1rem; font-weight: 700; }
.tp-close {
  background: none; border: none; color: #959595; font-size: 1.6rem;
  cursor: pointer; line-height: 1; padding: 0 4px; font-family: inherit;
}
.tp-close:hover { color: #fff; }
.tp-sub { color: #959595; font-size: 0.85rem; margin-bottom: 16px; }
.tp-section-title { font-size: 0.85rem; font-weight: 600; color: #ccc; margin: 14px 0 10px; }
.tp-section-title[hidden], .tp-upload-row[hidden], .tp-btn[hidden] { display: none; }
.tp-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.tp-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px;
  overflow: hidden; cursor: pointer; background: #1c1c1e;
  border: 2px solid transparent; transition: border-color 0.15s;
}
.tp-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-frame-time {
  position: absolute; right: 6px; bottom: 6px; z-index: 1;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.8); color: #fff;
  font-size: 0.7rem; font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.2;
  pointer-events: none;
}
.tp-frame:hover { border-color: #3a3a3c; }
.tp-frame.selected { border-color: var(--accent-color, #4ecdc4); }
.tp-frame:focus-visible { outline: 2px solid var(--accent-color, #4ecdc4); outline-offset: 2px; }
.tp-frame.loading {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(90deg, #1c1c1e 25%, #2a2a2e 50%, #1c1c1e 75%);
  background-size: 200% 100%;
  animation: tp-shimmer 1.5s ease-in-out infinite;
}
@keyframes tp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-frame.loading { animation: none; background: #252528; }
}
.tp-frame.empty {
  display: flex; align-items: center; justify-content: center;
  color: #959595; font-size: 0.75rem; cursor: default;
  text-align: center; padding: 6px;
}
.tp-frame.empty:hover { border-color: transparent; }
.tp-upload-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px; border: 1px dashed #2c2c2e; border-radius: 10px;
  background: #111;
}
.tp-upload-preview {
  width: 80px; aspect-ratio: 16 / 9; border-radius: 6px;
  background: #1c1c1e; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #959595; font-size: 0.7rem;
}
.tp-upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-upload-preview.selected { outline: 2px solid var(--accent-color, #4ecdc4); outline-offset: -2px; }
.tp-file-btn {
  padding: 8px 14px; border-radius: 9px; font-size: 0.85rem; font-weight: 600;
  border: 1px solid #2c2c2e; background: #1c1c1e; color: #fff; cursor: pointer;
  font-family: inherit;
}
.tp-file-btn:hover { background: #2c2c2e; }
.tp-file-hint { color: #959595; font-size: 0.78rem; flex: 1; min-width: 140px; }
.tp-error {
  color: #ff6b6b; font-size: 0.82rem; margin-top: 10px; min-height: 1em;
}
.tp-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
}
.tp-btn {
  padding: 9px 18px; border-radius: 10px; font-size: 0.88rem; font-weight: 600;
  border: 1px solid #2c2c2e; background: #1c1c1e; color: #fff; cursor: pointer;
  font-family: inherit;
}
.tp-btn:hover:not(:disabled) { background: #2c2c2e; }
.tp-btn.primary {
  background: var(--tp-primary-bg, linear-gradient(45deg, #ff6b6b, #4ecdc4)); border-color: transparent;
}
.tp-btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.tp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
  .tp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .tp-file-hint { min-width: 100px; }
}
