/* ==========================================================================
   FLINOVA — Templates marketplace stylesheet (assets/templates.css)
   Loaded ONLY by templates.html, alongside the existing assets/styles.css
   (for shared nav/footer/button/typography styling). This file is purely
   additive — it does not redeclare or override anything in styles.css,
   and nothing outside templates.html references it. Uses the same design
   tokens (var(--blue), var(--radius), etc.) already defined in styles.css
   so the marketplace still looks like part of the same site.
   ========================================================================== */

.templates-filter-bar {
  margin-bottom: 32px;
}
#categoryFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.filter-pill {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.filter-pill:hover { border-color: var(--blue); color: var(--blue); }
.filter-pill.active { background: var(--blue); border-color: var(--blue); color: var(--white); }
/* Primary (business-model) filters are visually dominant — slightly
   larger and bolder than the secondary curation row below them. */
#categoryFilters .filter-pill { font-size: 14px; padding: 10px 18px; }
#curationFilters { display: flex; flex-wrap: wrap; gap: 8px; }
#curationFilters .filter-pill { font-size: 12.5px; padding: 7px 14px; }
#curationFilters .filter-pill.active { background: var(--orange); border-color: var(--orange); }

/* Secondary business-type filter: a single select, not more pills —
   keeps the interface from getting overwhelming (brief section 16). */
#businessTypeFilter { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
#businessTypeFilter label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
#businessTypeFilter select {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
@media (max-width: 1024px) { .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .templates-grid { grid-template-columns: 1fr; } }

.templates-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
  font-size: 15px;
}

.template-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(11, 22, 60, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.template-card:hover { transform: translateY(-4px); box-shadow: 0 24px 44px -18px rgba(11,22,60,0.2); }

.template-preview-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
  font: inherit;
}

/* Pure-CSS "browser preview" mock — see templates.js templatePreviewMock().
   Deliberately not a real screenshot: no stock imagery, nothing to 404,
   nothing that implies functionality that doesn't exist. */
.tpl-browser { aspect-ratio: 4/3; display: flex; flex-direction: column; background: var(--bg); }
.tpl-browser-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.tpl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tpl-browser-url {
  margin-left: 8px;
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 10px;
  flex-grow: 1;
  max-width: 160px;
}
.tpl-browser-body {
  flex-grow: 1;
  padding: 16px 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tpl-accent) 12%, white), color-mix(in srgb, var(--tpl-accent) 4%, white));
  display: flex; flex-direction: column; gap: 14px;
}
.tpl-mock-nav { display: flex; gap: 8px; }
.tpl-mock-nav span { width: 22px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--tpl-accent) 45%, white); }
.tpl-mock-hero { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.tpl-mock-line { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--tpl-accent) 55%, white); }
.tpl-mock-line.long { width: 80%; }
.tpl-mock-line.short { width: 45%; }
.tpl-mock-btn { width: 64px; height: 18px; border-radius: 999px; background: var(--tpl-accent); margin-top: 6px; }

.template-preview-overlay {
  position: absolute; inset: 0;
  background: rgba(10, 16, 35, 0.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
@media (hover: hover) {
  .template-preview-trigger:hover .template-preview-overlay,
  .template-preview-trigger:focus-visible .template-preview-overlay { opacity: 1; }
}
@media (hover: none) {
  /* Touch devices: no hover to depend on (brief section 31/32) */
  .template-preview-overlay { opacity: 0; }
}

.template-body { padding: 22px 22px 24px; }
.template-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.template-model-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-tint);
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.template-type-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}
.template-body h3 { font-size: 18px; margin-bottom: 6px; }
.template-body p { font-size: 13.5px; color: var(--text-soft); margin-bottom: 14px; line-height: 1.6; }
.template-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.template-tags span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
}
.template-footer { display: flex; flex-direction: column; gap: 12px; }
.template-price { font-size: 13px; color: var(--text-soft); }
.template-price strong { color: var(--text); font-family: var(--font-display); }
.template-footer-btns { display: flex; gap: 8px; }
.template-footer-btns .btn { flex: 1; justify-content: center; }

/* Preview modal */
.preview-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.preview-modal.open { display: flex; }
.preview-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 16, 35, 0.6); }
.preview-modal-panel {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  max-width: 800px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px -20px rgba(10, 16, 35, 0.45);
}
.preview-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 2;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-soft);
}
.preview-modal-close:hover { color: var(--text); border-color: var(--text-faint); }
.preview-modal-body { display: grid; grid-template-columns: 1fr; }
@media (min-width: 640px) { .preview-modal-body { grid-template-columns: 1.1fr 1fr; } }
.preview-modal-visual .tpl-browser { aspect-ratio: auto; height: 100%; min-height: 220px; }
.preview-modal-info { padding: 28px 26px; }
.preview-modal-info h2 { font-size: 22px; margin: 4px 0 10px; }
.preview-modal-info p { font-size: 14.5px; color: var(--text-soft); margin-bottom: 16px; line-height: 1.6; }
.preview-modal-features { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.preview-modal-features li { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--text-soft); }
.preview-modal-features li svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--orange); }
.preview-modal-price { font-size: 14px; color: var(--text-soft); margin-bottom: 20px; }
.preview-modal-price strong { color: var(--text); font-family: var(--font-display); font-size: 18px; }

/* Package selection (revealed after "Choose template") */
.package-section-inner .section-head { margin-bottom: 32px; }