/* THOMZY.com — history-page.css : Neocities-style FULL history view.
   Designed to live inside index.html as the #/history SPA view.
*/

/* ---- SPA layout glue ----
   Views are hidden/shown via [hidden]. The desktop is fixed-position;
   history view is handled via .view-history in windows.css.
*/
.view[hidden] { display: none !important; }

/* History/queue views span both columns of the layout grid. */
.col-wide { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---- HP root panel ---- */
.hp-root { display: flex; flex-direction: column; gap: 12px; }

/* ---- Toolbar (search + date) ---- */
.hp-toolbar {
  display: flex; flex-wrap: wrap; gap: 14px;
  border: 2px ridge var(--cyan); padding: 8px;
  background: rgba(0,0,0,0.45);
}
.hp-label {
  font-family: var(--mono); font-size: 11px;
  color: var(--cyan); text-transform: uppercase; letter-spacing: 1px;
  align-self: center;
}
.hp-search-block, .hp-date-block { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hp-search-block { flex: 1; min-width: 240px; }
.hp-search-wrap { display: flex; gap: 4px; flex: 1; }
.hp-search-input {
  flex: 1; min-width: 160px;
  background: #000; color: var(--yellow);
  border: 2px inset var(--magenta);
  font-family: var(--mono); padding: 4px 6px; font-size: 12px;
}
.hp-search-input:focus { outline: 1px dashed var(--cyan); }

.hp-date-block { position: relative; }
.hp-date-btn { min-width: 140px; }
.hp-date-btn.active { background: var(--magenta); color: #000; }

/* ---- Date picker popup (Neocities style) ---- */
.hp-date-picker {
  position: absolute; top: calc(100% + 6px); right: 0;
  z-index: 80;
  background: #000;
  border: 3px ridge var(--magenta);
  padding: 8px;
  font-family: var(--mono);
  width: 280px;
  box-shadow: 4px 4px 0 var(--violet);
}
.hp-date-picker-header {
  display: grid; grid-template-columns: 28px 1fr 28px;
  gap: 4px; align-items: center; margin-bottom: 6px;
}
.hp-date-selectors { display: flex; gap: 4px; }
.hp-date-select {
  flex: 1; min-width: 0;
  background: #000; color: var(--yellow);
  border: 2px inset var(--cyan);
  font-family: var(--mono); font-size: 11px;
  padding: 2px 4px; cursor: pointer;
  text-align-last: center;
}
.hp-date-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  font-size: 10px; color: var(--cyan); text-align: center; user-select: none;
  margin-bottom: 4px;
}
.hp-date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.hp-date-cell {
  height: 24px;
  background: #000; color: var(--fg);
  border: 1px outset var(--violet);
  font-family: var(--mono); font-size: 11px;
  cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.hp-date-cell:hover { background: var(--magenta); color: #000; }
.hp-date-cell.muted { color: rgba(255,255,255,0.3); }
.hp-date-cell.today { outline: 1px dashed var(--cyan); outline-offset: -2px; }
.hp-date-cell.selected { background: var(--yellow); color: #000; border-style: inset; }
.hp-date-cell.in-range { background: rgba(255,232,58,0.25); color: var(--fg); }
.hp-date-selection {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; font-size: 10px; color: var(--cyan);
}

/* ---- Source filter row ---- */
.hp-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 2px ridge var(--yellow); padding: 8px;
  background: rgba(0,0,0,0.45);
}
.hp-filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.hp-filter-btn {
  background: #000; color: var(--fg);
  border: 2px outset var(--cyan);
  font-family: var(--mono); font-size: 11px;
  padding: 3px 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.hp-filter-btn:hover { background: var(--cyan); color: #000; }
.hp-filter-btn.active {
  background: var(--magenta); color: #000;
  border-style: inset; border-color: var(--magenta);
}
.hp-filter-btn .badge {
  font-size: 10px; padding: 1px 5px;
  background: rgba(0,0,0,0.4); color: var(--yellow);
  border: 1px solid currentColor;
}
.hp-filter-btn.active .badge { color: #000; background: var(--yellow); }

/* Provider source colors (used on the icon) */
.src-youtube     { color: #ff5050; }
.src-soundcloud  { color: #ff9933; }
.src-vimeo       { color: #25e8ff; }
.src-twitch      { color: #b65cff; }
.src-spotify     { color: #1ed760; }
.src-bandcamp    { color: #7fc7d4; }
.src-dailymotion { color: #5db7ff; }
.src-tiktok      { color: #ff3ec9; }
.src-instagram   { color: #ff7aa6; }
.src-twitter     { color: #25e8ff; }
.src-bilibili    { color: #66ddff; }
.src-generic     { color: var(--yellow); }

/* ---- Info row ---- */
.hp-info {
  text-align: right; padding: 0 4px;
  border-bottom: 1px dashed var(--violet);
  padding-bottom: 4px;
}

/* ---- List ---- */
.hp-content-wrapper {
  max-height: 65vh; overflow-y: auto;
  border: 2px inset rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.4);
  padding: 6px;
}
.hp-list { display: flex; flex-direction: column; gap: 6px; }

.hp-loading, .hp-error, .hp-empty {
  text-align: center; padding: 24px;
  color: var(--cyan); font-family: var(--mono); font-size: 12px;
}
.hp-error { color: var(--crimson); }

.hp-item {
  display: flex; gap: 8px; align-items: stretch;
  background: rgba(0,0,0,0.5);
  border: 2px ridge var(--magenta);
  padding: 6px;
}
.hp-item:hover {
  border-color: var(--cyan);
  background: rgba(255,62,201,0.1);
}

.hp-item-thumb {
  width: 96px; height: 72px; flex-shrink: 0;
  border: 1px solid var(--cyan);
  background: #000;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.hp-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hp-thumb-fallback {
  font-size: 24px; color: var(--magenta);
}

.hp-item-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--mono); font-size: 11px;
}
.hp-item-title {
  font-family: 'Comic Sans MS', sans-serif; font-size: 13px;
  color: var(--yellow);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hp-item-artist { color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hp-item-metadata { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.hp-meta-chip {
  font-size: 10px; color: var(--fg);
  background: #000;
  border: 1px solid var(--violet);
  padding: 1px 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.hp-meta-chip.src-badge { border-color: currentColor; }
.hp-meta-chip i { font-size: 10px; color: var(--magenta); }
.hp-meta-chip.src-badge i { color: inherit; }

.hp-item-actions {
  display: flex; flex-direction: column; gap: 4px; justify-content: center;
  flex-shrink: 0;
}
.hp-action-btn {
  background: #000; color: var(--magenta);
  border: 2px outset var(--magenta);
  font-family: var(--mono); font-size: 11px;
  padding: 3px 6px; cursor: pointer;
  min-width: 30px;
}
.hp-action-btn:hover { background: var(--magenta); color: #000; border-style: inset; }
.hp-action-btn.open { color: var(--cyan); border-color: var(--cyan); }
.hp-action-btn.open:hover { background: var(--cyan); color: #000; }

/* ---- Sentinel ---- */
.hp-sentinel {
  text-align: center; padding: 8px;
  font-family: var(--mono); font-size: 10px; color: var(--violet);
}

/* ---- BTN extra size variant ---- */
.btn.tiny {
  font-size: 10px; padding: 2px 6px;
}

/* ---- Mobile ---- */
@media (max-width: 700px) {
  .hp-toolbar { flex-direction: column; align-items: stretch; }
  .hp-search-block, .hp-date-block { width: 100%; }
  .hp-date-picker { left: 0; right: auto; }
  .hp-item { flex-direction: column; }
  .hp-item-thumb { width: 100%; height: auto; aspect-ratio: 16/9; max-height: 180px; }
  .hp-item-actions { flex-direction: row; justify-content: flex-end; }
}
