/* ============================================================
   FreeResumeOnline — Templates Gallery v3 (FlowCV-style)
   Working filters · Real previews · Industry-tagged
   ============================================================ */

/* ─── Page Layout ────────────────────────────────────────────── */
.templates-page { position: relative; }
.templates-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 60px;
  align-items: start;
  position: relative;
  z-index: 1;
}

/* ─── Category tabs (top bar) ─────────────────────────────────── */
.cat-tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-full);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 1100px;
  margin: 0 auto;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.cat-tab.active {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: white;
}
.cat-count {
  font-size: 0.75rem;
  opacity: 0.8;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}
.cat-tab:not(.active) .cat-count {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* ─── Filter Sidebar ─────────────────────────────────────────── */
.filter-sidebar {
  padding: 0;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
}
.filter-sidebar::-webkit-scrollbar { width: 4px; }
.filter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.filter-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.filter-sidebar-header h3 { font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.clear-filters-btn {
  font-size: .8125rem; font-weight: 600; color: var(--text-muted);
  background: none; border: none; cursor: pointer; transition: var(--transition);
  font-family: inherit;
}
.clear-filters-btn:hover { color: var(--red); }

.filter-search-wrap { padding: 14px 20px; border-bottom: 1px solid var(--glass-border); }
.filter-search {
  width: 100%; padding: 10px 12px 10px 36px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: .875rem; outline: none; transition: var(--transition);
  background: var(--bg-tertiary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
  font-family: inherit; color: var(--text-primary);
}
.filter-search:focus { border-color: var(--cyan); background-color: var(--bg-secondary); }
.filter-search::placeholder { color: var(--text-muted); }

.filter-group { padding: 16px 20px; border-bottom: 1px solid var(--glass-border); }
.filter-group:last-child { border-bottom: none; }
.filter-group-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: 12px; }

/* Checkbox filters */
.filter-option {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; cursor: pointer; font-size: .875rem; color: var(--text-secondary);
  transition: var(--transition); user-select: none;
}
.filter-option:hover { color: var(--text-primary); }
.filter-option input[type=checkbox] { display: none; }
.filter-checkbox {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1.5px solid var(--border); background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--transition);
}
.filter-option input:checked + .filter-checkbox {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border-color: var(--cyan);
}
.filter-option input:checked + .filter-checkbox::after {
  content: '✓'; color: white; font-size: .6875rem; font-weight: 800;
}

/* Color swatches */
.colour-filter-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; border: 2px solid var(--bg-secondary);
  box-shadow: 0 0 0 1.5px var(--border);
  transition: var(--transition);
  position: relative;
  padding: 0;
}
.color-swatch:hover { transform: scale(1.1); box-shadow: 0 0 0 2px var(--cyan); }
.color-swatch.active { box-shadow: 0 0 0 2.5px var(--cyan); }
.color-swatch.active::after {
  content: '✓';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .8125rem; font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ─── Main Content ──────────────────────────────────────────── */
.templates-main { min-width: 0; }

/* Sort bar */
.sort-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.results-count { font-size: .9rem; color: var(--text-muted); font-weight: 500; }
.results-count span { color: var(--text-primary); font-weight: 700; }
.sort-select {
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 600; color: var(--text-secondary);
  outline: none; cursor: pointer;
  background: var(--bg-secondary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  font-family: inherit;
}
.sort-select:focus { border-color: var(--cyan); }

/* Active filter chips */
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 5px 5px 12px; border-radius: 100px;
  background: var(--indigo-soft); color: var(--indigo);
  font-size: .8125rem; font-weight: 600;
  border: 1px solid var(--glass-border-h);
}
.chip-x {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--indigo); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; line-height: 1; padding: 0;
  font-family: inherit;
  transition: var(--transition);
}
.chip-x:hover { background: var(--red); }

/* Template grid */
.templates-grid-main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* Template Card */
.template-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.template-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 16px 40px rgba(15,23,42,0.10);
  transform: translateY(-3px);
}

.tc-preview-wrap {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.tc-preview {
  width: 100%;
  height: 100%;
  transform: scale(0.42);
  transform-origin: top left;
  width: 238%;       /* compensate for scale */
  height: 238%;
  pointer-events: none;
}

.tc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
}
.template-card:hover .tc-overlay { opacity: 1; }
.tc-use-btn {
  padding: 11px 22px;
  background: white;
  color: #0f172a;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  transition: var(--transition);
}
.tc-use-btn:hover {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: white;
  transform: scale(1.03);
}

.tc-meta {
  padding: 14px 16px 16px;
}
.tc-name {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.tc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tc-sample-link {
  font-size: .75rem;
  color: var(--text-muted);
}
.tc-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.tc-badge {
  font-size: .625rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tc-pop   { background: var(--cyan-soft);   color: var(--cyan); }
.tc-new   { background: var(--green-soft);  color: var(--green); }
.tc-photo { background: var(--purple-soft); color: var(--purple); }

/* Load more */
.load-more-wrap { text-align: center; margin-top: 40px; }
.load-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 32px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text-primary); font-size: .9375rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.load-more-btn:hover {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(6,182,212,0.20);
}

/* No results */
.no-results {
  text-align: center; padding: 80px 20px; color: var(--text-muted);
}
.no-results h3 { font-size: 1.25rem; margin-bottom: 8px; color: var(--text-primary); }
.no-results p { font-size: .9375rem; }

/* Country pills */
.country-pill {
  text-decoration: none;
  padding: 9px 18px;
  background: var(--bg-secondary);
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.country-pill:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  transform: translateY(-2px);
}

/* ─── TEMPLATE PREVIEW STYLES (the actual mini resumes) ────── */

.tpl {
  width: 100%;
  height: 100%;
  background: white;
  color: #1a1a1a;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
}

.tpl .serif { font-family: Georgia, 'Times New Roman', serif; }
.tpl .mono  { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

.tpl .tp-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.tpl .tp-title {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
  margin-top: 3px;
}
.tpl .tp-contact {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
}
.tpl .tp-contact-row {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tpl .tp-head-center {
  text-align: center;
  padding: 24px 28px 16px;
}
.tpl .tp-head-left {
  padding: 24px 28px 14px;
}
.tpl .tp-head-bold {
  padding: 26px 28px 22px;
  color: white;
}
.tpl .tp-head-bold .tp-name { color: #fff; }
.tpl .tp-head-compact {
  padding: 20px 28px 12px;
  border-bottom: 1px solid #e5e7eb;
}
.tpl .tp-head-compact .tp-name { font-size: 22px; }
.tpl .tp-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.tpl .tp-contact-thin {
  font-size: 10px;
  color: #94a3b8;
}
.tpl .tp-head-mono {
  padding: 22px 26px 16px;
  background: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
}
.tpl .tp-head-photo {
  padding: 24px 28px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid #e5e7eb;
}
.tpl .tp-photo {
  width: 70px; height: 70px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.tpl .tp-head-exec {
  padding: 26px 28px;
  text-align: center;
}
.tpl .tp-head-exec .tp-name { font-size: 22px; }
.tpl .tp-contact-bar {
  padding: 10px 28px;
  font-size: 11px;
  color: #475569;
  text-align: center;
}
.tpl .tp-rule {
  height: 2px;
  width: 60px;
  margin-top: 8px;
}

.tpl .tp-body {
  padding: 18px 28px 24px;
}
.tpl .tp-body.tight { padding: 14px 28px 20px; }

.tpl .tp-section {
  margin-bottom: 16px;
}
.tpl .tp-section:last-child { margin-bottom: 0; }
.tpl .tp-section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 14px;
}
.tpl .tp-summary-box {
  padding: 12px 14px;
  border-radius: 6px;
}

.tpl .tp-h {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.tpl .tp-h.tight { margin-bottom: 4px; padding-bottom: 2px; }
.tpl .tp-h-line {
  width: 28px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 6px;
}

.tpl p, .tpl .tp-summary {
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 6px;
}

.tpl .tp-job { margin-bottom: 12px; }
.tpl .tp-job:last-child { margin-bottom: 0; }
.tpl .tp-job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.tpl .tp-job-role {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
}
.tpl .tp-job-date {
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
}
.tpl .tp-job-co {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
  margin-bottom: 4px;
}
.tpl .tp-bullets {
  list-style: disc;
  padding-left: 16px;
  margin: 4px 0 0;
}
.tpl .tp-bullets li {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 2px;
}

.tpl .tp-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tpl .tp-skill {
  display: inline-block;
  padding: 3px 9px;
  background: #f1f5f9;
  border-radius: 999px;
  font-size: 11px;
  color: #334155;
  font-weight: 500;
}
.tpl .tp-skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.tpl .tp-skills-grid .tp-skill {
  background: transparent;
  border: 1px solid;
  border-radius: 3px;
  text-align: center;
  font-size: 10px;
  padding: 3px 6px;
}

.tpl .tp-edu > div {
  margin-bottom: 6px;
}
.tpl .tp-edu b {
  display: block;
  font-size: 12px;
  color: #1a1a1a;
  font-weight: 700;
}
.tpl .tp-edu span {
  font-size: 11px;
  color: #64748b;
}

/* Sidebar layouts (sidebar-left + sidebar-right) */
.tpl-sidebar {
  display: grid;
  height: 100%;
}
.tpl-sidebar-left { grid-template-columns: 38% 62%; }
.tpl-sidebar-right { grid-template-columns: 62% 38%; }

.tpl-sidebar .tp-sidebar {
  padding: 24px 18px;
  color: white;
}
.tpl-sidebar .tp-sidebar .tp-name {
  font-size: 18px;
  color: white;
  margin-top: 12px;
}
.tpl-sidebar .tp-sidebar .tp-title {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 18px;
}
.tpl-sidebar .tp-side-h {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.6);
  margin-top: 14px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.tpl-sidebar .tp-side-text {
  font-size: 10px;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  margin-bottom: 6px;
}
.tpl-sidebar .tp-side-text b {
  color: white;
  font-weight: 700;
}

.tpl-sidebar .tp-avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
}

.tpl-sidebar .tp-main {
  padding: 22px 22px 22px 24px;
  background: white;
}

/* Timeline layout */
.tpl-timeline .tp-timeline {
  position: relative;
  padding-left: 22px;
  margin-bottom: 14px;
}
.tpl-timeline .tp-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--tl-c);
  opacity: 0.4;
}
.tpl-timeline .tp-tl-item {
  position: relative;
  margin-bottom: 12px;
}
.tpl-timeline .tp-tl-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--tl-c);
}

/* Tech grid */
.tpl-tech-grid .tp-h-line { display: none; }

/* Monochrome */
.tpl-monochrome .tp-h {
  letter-spacing: 2px;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media(max-width:1180px) {
  .templates-grid-main { grid-template-columns: repeat(2, 1fr); }
}
@media(max-width:900px) {
  .templates-layout { grid-template-columns: 1fr; padding: 0 16px 60px; }
  .filter-sidebar {
    position: static; max-height: none;
    margin-bottom: 16px;
  }
  .filter-sidebar-header { position: static; }
  .cat-tabs { flex-wrap: nowrap; overflow-x: auto; }
}
@media(max-width:520px) {
  .templates-grid-main { grid-template-columns: 1fr; }
  .cat-tab { padding: 9px 14px; font-size: .8125rem; }
}
