/* ── TE Downloads — Frontend Styles ─────────────────────────────────── */
:root {
  --te-bg:      #0f1311;
  --te-bg2:     #151b18;
  --te-bg3:     #1d2621;
  --te-line:    #2b332e;
  --te-text:    #d8ded9;
  --te-muted:   #a2aaa4;
  --te-heading: #eef3ef;
  --te-accent:  #42c07d;
  --te-accent2: #6cdfa3;
  --te-ink:     #05230f;
}

/* Wrap */
.te-dl-wrap { color: var(--te-text); font-family: inherit; }

/* Search */
.te-dl-search { display: flex; gap: .5rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.te-dl-search input {
  flex: 1; min-width: 180px;
  background: var(--te-bg2); border: 1px solid var(--te-line); color: var(--te-text);
  padding: .45rem .8rem; border-radius: .5rem; font-size: .9rem; outline: none;
}
.te-dl-search input:focus { border-color: var(--te-accent); }
.te-dl-search button {
  background: var(--te-accent); color: var(--te-ink); border: none;
  padding: .45rem 1rem; border-radius: .5rem; font-weight: 600; cursor: pointer;
}
.te-dl-search button:hover { background: var(--te-accent2); }

/* Filter groups (category + tag rows) */
.te-dl-filter-group {
  display: flex; align-items: center; gap: .5rem;
  flex-wrap: wrap; margin-bottom: .6rem;
}
.te-dl-filter-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--te-muted);
  white-space: nowrap; min-width: 60px;
}
.te-dl-filter-chips { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Category chips */
.te-dl-cat-link {
  background: var(--te-bg2); border: 1px solid var(--te-line);
  color: var(--te-muted); padding: .22rem .65rem; border-radius: 2rem;
  font-size: .8rem; text-decoration: none; transition: all .15s;
}
.te-dl-cat-link:hover, .te-dl-cat-link.active {
  border-color: var(--te-accent); color: var(--te-accent2);
  background: rgba(66,192,125,.1);
}

/* Tag chips (teal-tinted, slightly different shade) */
.te-dl-tag-link {
  background: var(--te-bg2); border: 1px solid var(--te-line);
  color: var(--te-muted); padding: .22rem .65rem; border-radius: 2rem;
  font-size: .8rem; text-decoration: none; transition: all .15s;
}
.te-dl-tag-link:hover, .te-dl-tag-link.active {
  border-color: #5ba3d9; color: #93c9f5;
  background: rgba(91,163,217,.1);
}

/* Active filter bar */
.te-dl-active-filters {
  font-size: .8rem; color: var(--te-muted);
  padding: .4rem .8rem; background: var(--te-bg3);
  border: 1px solid var(--te-line); border-radius: .4rem;
  margin-bottom: .8rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
}
.te-dl-filter-clear {
  color: var(--te-muted); text-decoration: none; font-weight: 700;
  padding: 0 3px; line-height: 1;
}
.te-dl-filter-clear:hover { color: #e05c7a; }
.te-dl-filter-reset {
  margin-left: auto; color: var(--te-muted); font-size: .75rem; text-decoration: underline;
}
.te-dl-filter-reset:hover { color: var(--te-accent2); }

/* Bulk bar */
.te-dl-bulk-bar {
  background: var(--te-bg3); border: 1px solid var(--te-accent);
  border-radius: .5rem; padding: .6rem 1rem;
  display: flex; align-items: center; gap: .8rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.te-dl-bulk-count { color: var(--te-accent2); font-weight: 600; font-size: .9rem; }

/* Grid */
.te-dl-grid {
  display: grid;
  gap: 1.1rem;
}
.te-dl-cols-1 { grid-template-columns: 1fr; }
.te-dl-cols-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.te-dl-cols-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.te-dl-cols-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Card */
.te-dl-card {
  background: var(--te-bg2); border: 1px solid var(--te-line);
  border-radius: .75rem; overflow: hidden;
  display: flex; flex-direction: column;
  position: relative; transition: border-color .2s, box-shadow .2s;
}
.te-dl-card:hover {
  border-color: var(--te-accent);
  box-shadow: 0 4px 20px rgba(66,192,125,.12);
}
.te-dl-card.te-dl-featured { border-color: var(--te-accent); }

/* Bulk select */
.te-dl-select-wrap {
  position: absolute; top: 8px; left: 8px; z-index: 10;
  background: rgba(15,19,17,.7); border-radius: .3rem; padding: 2px 4px;
  cursor: pointer;
}
.te-dl-select { accent-color: var(--te-accent); cursor: pointer; }

/* Thumbnail */
.te-dl-card-thumb {
  position: relative; background: var(--te-bg3);
  height: 130px; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.te-dl-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.te-dl-icon { font-size: 3rem; line-height: 1; }
.te-dl-badge-featured {
  position: absolute; top: 8px; right: 8px;
  background: var(--te-accent); color: var(--te-ink);
  font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 2rem;
}

/* Body */
.te-dl-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.te-dl-card-title { margin: 0; font-size: 1rem; color: var(--te-heading); }
.te-dl-card-title a { color: var(--te-heading); text-decoration: none; }
.te-dl-card-title a:hover { color: var(--te-accent2); }
.te-dl-card-desc { color: var(--te-muted); font-size: .85rem; margin: 0; line-height: 1.5; }

.te-dl-card-cats { display: flex; flex-wrap: wrap; gap: .3rem; }
.te-dl-cat-badge {
  background: rgba(66,192,125,.1); border: 1px solid rgba(66,192,125,.25);
  color: var(--te-accent2); padding: 1px 8px; border-radius: 2rem;
  font-size: .72rem; text-decoration: none;
}
.te-dl-cat-badge:hover { background: rgba(66,192,125,.2); }

.te-dl-tag-badge {
  background: rgba(91,163,217,.1); border: 1px solid rgba(91,163,217,.25);
  color: #93c9f5; padding: 1px 8px; border-radius: 2rem;
  font-size: .72rem; text-decoration: none;
}
.te-dl-tag-badge:hover { background: rgba(91,163,217,.2); }

.te-dl-card-meta {
  display: flex; flex-wrap: wrap; gap: .5rem;
  font-size: .75rem; color: var(--te-muted); margin-top: auto;
}

/* Access badges */
.te-dl-access-badge {
  padding: 1px 8px; border-radius: 2rem; font-weight: 600;
}
.te-dl-access-public  { background: rgba(66,192,125,.1); color: var(--te-accent2); }
.te-dl-access-member  { background: rgba(100,140,255,.12); color: #9ab4ff; }
.te-dl-access-admin   { background: rgba(255,160,60,.12);  color: #ffb86c; }
.te-dl-badge-pkg      { color: var(--te-muted); }

/* Footer */
.te-dl-card-footer { padding: .75rem 1rem; border-top: 1px solid var(--te-line); }
.te-dl-card-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Buttons */
.te-dl-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .4rem .9rem; border-radius: .5rem; font-size: .85rem;
  font-weight: 600; cursor: pointer; border: none; text-decoration: none;
  transition: all .15s;
}
.te-dl-btn-dl {
  background: var(--te-accent); color: var(--te-ink) !important;
}
.te-dl-btn-dl:hover { background: var(--te-accent2); color: var(--te-ink) !important; text-decoration: none !important; }
.te-dl-btn-pay {
  background: #f0a500; color: #1a0e00;
}
.te-dl-btn-pay:hover { background: #ffc120; }
.te-dl-btn-login {
  background: var(--te-bg3); border: 1px solid var(--te-line); color: var(--te-text);
}
.te-dl-btn-login:hover { border-color: var(--te-accent); color: var(--te-accent2); }
.te-dl-btn-locked, .te-dl-btn-limit {
  color: var(--te-muted); background: var(--te-bg3); cursor: default;
  border: 1px solid var(--te-line);
}
.te-dl-btn-topola {
  background: rgba(66,192,125,.12); color: var(--te-accent2);
  border: 1px solid rgba(66,192,125,.25);
}
.te-dl-btn-topola:hover { background: rgba(66,192,125,.22); }
.btn.btn-ghost {
  background: transparent; border: 1px solid var(--te-line);
  color: var(--te-text); padding: .35rem .8rem; border-radius: .5rem;
  cursor: pointer; font-size: .85rem;
}
.btn.btn-ghost:hover { border-color: var(--te-accent); color: var(--te-accent2); }

/* Favourite */
.te-dl-fav {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--te-muted); padding: 0 4px;
  transition: color .15s; line-height: 1;
}
.te-dl-fav:hover, .te-dl-fav.active { color: #e05c7a; }

/* PayPal container */
.te-dl-paypal-container { padding: .5rem 0; }

/* Modal overlay */
.te-dl-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.75);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 24px 16px;
}
.te-dl-modal-box {
  background: var(--te-bg2); border: 1px solid var(--te-accent);
  border-radius: 10px; padding: 2rem 2.5rem;
  max-width: 420px; width: 100%; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  margin: auto; /* vertically centres when content is shorter than viewport */
}
.te-dl-modal-box h3 { color: var(--te-heading); margin: 0 0 .5rem; font-size: 1.1rem; }
.te-dl-modal-box p  { color: var(--te-muted); font-size: .9rem; margin: 0 0 1.2rem; }
.te-dl-modal-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* Toast */
.te-dl-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 99999;
  background: var(--te-bg3); border: 1px solid var(--te-accent);
  color: var(--te-accent2); padding: .8rem 1.4rem; border-radius: .5rem;
  font-size: .9rem; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: te-slide-in .25s ease; max-width: 340px;
}
.te-dl-toast.error { border-color: #e05c7a; color: #e05c7a; }
@keyframes te-slide-in {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Empty / notice */
.te-dl-empty, .te-dl-notice {
  color: var(--te-muted); font-style: italic; padding: 1.5rem 0;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.te-dl-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  font-size: .82rem; color: var(--te-muted); margin-bottom: 1.2rem;
}
.te-dl-breadcrumb a { color: var(--te-accent2); text-decoration: none; }
.te-dl-breadcrumb a:hover { text-decoration: underline; }
.te-dl-bc-sep { color: var(--te-line); }
.te-dl-bc-current { color: var(--te-text); font-weight: 600; }

/* ── Single-page filter bar (collapsible feel) ──────────────────────────── */
.te-dl-single-filters {
  background: var(--te-bg2); border: 1px solid var(--te-line);
  border-radius: .6rem; padding: .8rem 1rem; margin-bottom: 1.4rem;
}

/* ── Single-page card ───────────────────────────────────────────────────── */
.te-dl-card-single { max-width: 560px; margin-bottom: 2rem; }

/* ── Hover description overlay ──────────────────────────────────────────── */
.te-dl-hover-desc {
  position: absolute; inset: 0;
  background: rgba(15,19,17,.93);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1.2rem;
  opacity: 0; transition: opacity .2s ease;
  pointer-events: none;
  border-radius: .75rem;
  z-index: 3;
  text-align: center;
}
.te-dl-card:hover .te-dl-hover-desc {
  opacity: 1;
  pointer-events: auto;
}
.te-dl-hover-desc p {
  color: var(--te-text); font-size: .84rem; line-height: 1.55; margin: 0 0 .8rem;
}
.te-dl-hover-cta {
  font-size: .78rem; color: var(--te-accent2); font-weight: 600;
  letter-spacing: .03em;
}

/* ── "Details & Download" button ────────────────────────────────────────── */
.te-dl-btn-view {
  background: var(--te-accent); color: #05230f !important;
  flex: 1;
}
.te-dl-btn-view:hover { background: var(--te-accent2); color: #05230f !important; text-decoration: none; }

/* ── Price badge ────────────────────────────────────────────────────────── */
.te-dl-price-badge {
  background: rgba(240,165,0,.12); border: 1px solid rgba(240,165,0,.3);
  color: #fbbf24; padding: 1px 8px; border-radius: 2rem; font-size: .72rem; font-weight: 700;
}

/* ── Access filter chips ─────────────────────────────────────────────────── */
.te-dl-access-chip {
  background: var(--te-bg2); border: 1px solid var(--te-line);
  color: var(--te-muted); padding: .22rem .65rem; border-radius: 2rem;
  font-size: .8rem; text-decoration: none; transition: all .15s;
}
.te-dl-access-chip:hover, .te-dl-access-chip.active {
  background: rgba(66,192,125,.08);
}
.te-dl-ac-public:hover, .te-dl-ac-public.active  { border-color: var(--te-accent); color: var(--te-accent2); }
.te-dl-ac-member:hover, .te-dl-ac-member.active  { border-color: #9ab4ff; color: #9ab4ff; background: rgba(100,140,255,.1); }
.te-dl-ac-admin:hover,  .te-dl-ac-admin.active   { border-color: #ffb86c; color: #ffb86c; background: rgba(255,184,108,.1); }

/* ── PWYW badge (card meta) ──────────────────────────────────────────────── */
.te-dl-pwyw-badge {
  background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.3);
  color: #c4b5fd; padding: 1px 8px; border-radius: 2rem;
  font-size: .72rem; font-weight: 700;
}

/* ── PWYW buttons ────────────────────────────────────────────────────────── */
.te-dl-btn-pwyw { background: var(--te-accent); color: var(--te-ink) !important; flex: 1; }
.te-dl-btn-pwyw:hover { background: var(--te-accent2); }
.te-dl-btn-pwyw-tip {
  background: transparent; border: 1px solid rgba(139,92,246,.4);
  color: #c4b5fd !important; font-size: .8rem; padding: .3rem .8rem;
}
.te-dl-btn-pwyw-tip:hover { background: rgba(139,92,246,.1); border-color: #c4b5fd; }

/* ── PWYW price-step modal ───────────────────────────────────────────────── */
.te-dl-pwyw-note { color: var(--te-muted); font-size: .85rem; margin: .25rem 0 1rem; line-height: 1.5; }
.te-dl-pwyw-input-wrap {
  display: flex; align-items: center; gap: .5rem;
  background: var(--te-bg3); border: 1px solid var(--te-line);
  border-radius: .5rem; padding: .5rem .8rem; margin-bottom: .75rem;
}
.te-dl-pwyw-currency { color: var(--te-muted); font-size: 1rem; font-weight: 700; }
.te-dl-pwyw-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--te-heading); font-size: 1.5rem; font-weight: 700;
  width: 100%; min-width: 0;
}
.te-dl-pwyw-input::-webkit-inner-spin-button,
.te-dl-pwyw-input::-webkit-outer-spin-button { opacity: 0.4; }
.te-dl-pwyw-free-link {
  display: block; text-align: center; font-size: .8rem;
  color: var(--te-muted); text-decoration: none; margin-bottom: .8rem;
}
.te-dl-pwyw-free-link:hover { color: var(--te-accent2); text-decoration: underline; }

/* ── Stripe payment modal ────────────────────────────────────────────────── */
.te-dl-stripe-box { max-width: 440px; text-align: left; }
.te-dl-modal-title { color: var(--te-heading); margin: 0 0 .25rem; font-size: 1.1rem; }
.te-dl-modal-subtitle { color: var(--te-muted); font-size: .9rem; margin: 0 0 .4rem; }
.te-dl-modal-price { color: var(--te-text); font-size: .95rem; margin: 0 0 1rem; }
.te-stripe-element {
  background: var(--te-bg3); border: 1px solid var(--te-line);
  border-radius: .5rem; padding: 1rem; min-height: 48px; margin-bottom: 1rem;
}
.te-stripe-msg {
  font-size: .82rem; line-height: 1.5; margin: -.4rem 0 .8rem; padding: 0;
}

/* ── Contact-to-purchase button (Stripe not configured) ──────────────────── */
.te-dl-btn-contact {
  background: var(--te-bg3); border: 1px solid var(--te-accent);
  color: var(--te-accent2) !important; text-decoration: none;
}
.te-dl-btn-contact:hover { background: rgba(66,192,125,.1); }
.te-dl-payment-notice {
  width: 100%; margin: .5rem 0 0;
  font-size: .78rem; color: var(--te-muted); line-height: 1.5;
}
.te-dl-payment-notice a { color: var(--te-accent2); text-decoration: underline; }

/* ── Guest CTA note ──────────────────────────────────────────────────────── */
.te-dl-guest-cta {
  width: 100%; margin: .6rem 0 0;
  font-size: .78rem; color: var(--te-muted); line-height: 1.5;
}
.te-dl-guest-cta a { color: var(--te-accent2); text-decoration: underline; }
.te-dl-guest-cta a:hover { color: var(--te-accent); }

/* ── Related downloads section ──────────────────────────────────────────── */
.te-dl-related { margin-top: 2.5rem; }
.te-dl-related-heading {
  font-size: 1rem; font-weight: 700; color: var(--te-heading);
  margin: 0 0 1rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--te-line);
}

/* Responsive */
@media (max-width: 600px) {
  .te-dl-cols-2, .te-dl-cols-3, .te-dl-cols-4 {
    grid-template-columns: 1fr;
  }
}
