/* Track cards (generated result, personal library, community gallery) and the
   prompt presets on the home page. Loaded by index.html on top of its own
   theme variables. */

.tcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tcard {
  display: flex; flex-direction: column;
  background: rgba(20, 24, 38, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}
.tcard-wide { flex-direction: row; }
.tcard-wide .tc-cover { width: 132px; min-width: 132px; padding-top: 0; }

.tc-cover { position: relative; padding-top: 46%; }
.tc-play {
  position: absolute; inset: 0; margin: auto;
  width: 52px; height: 52px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 22px;
  background: rgba(8, 10, 20, 0.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.tc-play:hover { background: rgba(8, 10, 20, 0.75); }
.tc-dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(8, 10, 20, 0.6); color: #fff;
  font-size: 12px; padding: 2px 7px; border-radius: 999px;
}

.tc-body { flex: 1; min-width: 0; padding: 14px 16px 12px; }
.tc-title {
  font-size: 15px; font-weight: 600; margin: 0 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-meta { font-size: 12px; color: var(--color-text-secondary); margin: 0 0 10px; }
.tc-prompt {
  font-size: 12px; color: var(--color-text-secondary); margin: 10px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}

/* waveform with a progress overlay driven by the shared audio element */
.tc-wave {
  position: relative; display: flex; align-items: flex-end; gap: 2px;
  height: 34px; overflow: hidden;
}
.tc-wave span {
  flex: 1; background: var(--color-border-tertiary); border-radius: 2px; min-width: 2px;
}
.tc-prog {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, rgba(91,140,255,0.45), rgba(138,107,255,0.45));
  pointer-events: none; transition: width .2s linear;
}

.tc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.tc-act {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 6px 9px; border-radius: var(--border-radius-md);
  background: transparent; border: 1px solid var(--color-border-tertiary);
  color: var(--color-text-secondary); text-decoration: none;
}
.tc-act:hover { color: var(--color-text-primary); background: var(--color-background-secondary); }
.tc-act i { font-size: 16px; }
.tc-like.liked { color: #ff5b7f; border-color: rgba(255, 91, 127, 0.4); }
.tc-act-label { font-size: 12px; }
@media (max-width: 480px) { .tc-act-label { display: none; } }

/* prompt presets */
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preset {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px;
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border-tertiary);
  color: var(--color-text-primary);
}
.preset:hover { border-color: var(--color-text-info); }
.preset.active { border-color: var(--color-text-info); background: var(--color-background-info); }
.preset i { color: var(--color-text-info); font-size: 15px; }

/* select fields with a chevron and a coloured focus ring */
.select-wrap { position: relative; }
.select-wrap > i {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--color-text-secondary); font-size: 16px;
}
.select-wrap select { width: 100%; padding-right: 32px; }

/* free-track counter next to the generator */
.balance-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; color: var(--color-text-secondary); margin: 0 0 12px;
}
.balance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-background-info); color: var(--color-text-info);
  border-radius: 999px; padding: 4px 11px; font-weight: 600;
}
.balance-line a { color: var(--color-text-info); }

/* community section on the home page */
.gallery-toggle { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.gallery-toggle button {
  font: inherit; font-size: 13px; cursor: pointer; padding: 7px 16px;
  border-radius: 999px; border: 1px solid var(--color-border-tertiary);
  background: transparent; color: var(--color-text-secondary);
}
.gallery-toggle button.active { background: var(--color-text-info); color: #fff; border-color: transparent; }
.gallery-empty { text-align: center; color: var(--color-text-secondary); font-size: 14px; padding: 24px 0; }

/* payment history */
.pay-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pay-table th, .pay-table td {
  text-align: left; padding: 8px 6px;
  border-bottom: 1px solid var(--color-border-tertiary);
  color: var(--color-text-secondary);
}
.pay-table th { color: var(--color-text-primary); font-weight: 600; }
.pay-status { font-weight: 600; }
.pay-status.paid { color: #4ade80; }
.pay-status.pending { color: #fbbf24; }
.pay-status.failed { color: #ff6b6b; }
.pay-status.refunded { color: var(--color-text-secondary); }
