/* ==========================================================================
   TGDL Media Pipeline - Aesthetic Workstation Styles
   Engineered to harmonize with Departure Mono & Noto Serif SC typography
   ========================================================================== */

.tgdl-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  font-family: var(--mono-font);
}

.tgdl-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-ui);
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border: 1px solid currentColor;
  opacity: 0.85;
  margin-bottom: 24px;
}

.tgdl-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* --- Search & Control Bar --- */
.tgdl-search-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid currentColor;
  margin-bottom: 28px;
  background: rgba(var(--chrome-surface), 0.35);
  backdrop-filter: blur(4px);
}

.tgdl-search-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tgdl-select, .tgdl-input {
  font-family: var(--mono-font);
  font-size: var(--text-ui);
  padding: 8px 12px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  outline: none;
}

.tgdl-select {
  cursor: pointer;
  min-width: 160px;
}

.tgdl-input {
  flex: 1;
  min-width: 200px;
}

.tgdl-btn {
  font-family: var(--mono-font);
  font-size: var(--text-ui);
  padding: 8px 16px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.tgdl-btn:hover {
  background: currentColor;
  color: rgba(var(--chrome-surface), 1);
}

.tgdl-btn--primary {
  font-weight: bold;
}

.tgdl-btn--danger {
  border-color: #ef4444;
  color: #ef4444;
}
.tgdl-btn--danger:hover {
  background: #ef4444;
  color: #fff;
}

.tgdl-btn--sm {
  padding: 4px 8px;
  font-size: var(--font-size-xs);
}

.tgdl-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-xs);
  opacity: 0.8;
}

.tgdl-tag-pill {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* --- Media Cards Stream --- */
.tgdl-stream-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 32px;
}

.tgdl-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  padding: 16px;
  border: 1px solid currentColor;
  background: rgba(var(--chrome-surface), 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 640px) {
  .tgdl-card {
    grid-template-columns: 1fr;
  }
}

.tgdl-card:hover {
  box-shadow: 2px 2px 0 currentColor;
}

.tgdl-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid currentColor;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tgdl-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tgdl-thumb-placeholder {
  font-size: 2rem;
  opacity: 0.4;
}

.tgdl-duration-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 2px 5px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.tgdl-card-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.tgdl-card-title {
  font-family: var(--mono-font);
  font-size: var(--text-ui);
  font-weight: 600;
  word-break: break-all;
  line-height: 1.35;
}

.tgdl-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--font-size-xs);
  opacity: 0.75;
}

.tgdl-badge {
  padding: 2px 6px;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.tgdl-badge--cached {
  border-color: #10b981;
  color: #10b981;
}

.tgdl-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* --- Task Progress Bars & Pipeline --- */
.tgdl-task-card {
  padding: 16px;
  border: 1px solid currentColor;
  margin-bottom: 16px;
  background: rgba(var(--chrome-surface), 0.35);
}

.tgdl-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tgdl-progress-track {
  width: 100%;
  height: 10px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.tgdl-progress-fill {
  height: 100%;
  background: currentColor;
  width: 0%;
  transition: width 0.25s ease-out;
}

.tgdl-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  opacity: 0.85;
}

/* --- Modals & Drawers --- */
.tgdl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tgdl-modal-overlay.active {
  display: flex;
}

.tgdl-modal {
  width: 100%;
  max-width: 580px;
  background: rgb(var(--chrome-surface));
  border: 2px solid currentColor;
  padding: 24px;
  font-family: var(--mono-font);
  box-shadow: 6px 6px 0 currentColor;
}

.tgdl-modal-title {
  font-size: var(--text-title);
  margin-bottom: 16px;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 8px;
}

/* --- Toasts --- */
#tgdl-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 400;
  pointer-events: none;
}

.tgdl-toast {
  padding: 10px 16px;
  background: rgb(var(--chrome-surface));
  border: 1px solid currentColor;
  box-shadow: 3px 3px 0 currentColor;
  font-family: var(--mono-font);
  font-size: var(--text-ui);
  pointer-events: auto;
  animation: slide-in 0.2s ease-out;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
