/* ==========================================================
   IMPERIO STUDIO — templates.css
   Página de Templates: tabs, categorías, filtros y grid
   ========================================================== */

/* ============ TYPE TABS (Videos / Logos / Mockups / Designs / AI Images) ============ */
.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2);
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  width: fit-content;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.type-tab {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-full);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}

.type-tab svg { width: 18px; height: 18px; }

.type-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.type-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.type-tab.is-active svg { color: var(--accent); }

/* ============ CATEGORY BAR (11 categorías) ============ */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-4);
}

.category {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}

.category:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.category.is-active {
  color: var(--accent-contrast);
  background: var(--ink);
}

/* ============ FILTROS ============ */
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* Filtros: layout */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: var(--r-full);
  transition: background var(--t-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-fast);
  box-shadow: var(--shadow-sm);
}

.switch.is-on {
  background: var(--accent);
}

.switch.is-on .switch__thumb {
  transform: translateX(16px);
}

.filters__right {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.filter-select {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.filter-select svg { width: 16px; height: 16px; color: var(--text-muted); }
.filter-select .chev { width: 14px; height: 14px; transition: transform var(--t-fast); }

.filter-select:hover {
  border-color: var(--accent);
}

.filter-select.is-open .chev {
  transform: rotate(180deg);
}

/* ============ GRID DE TEMPLATES ============ */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-5);
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  cursor: pointer;
  transition: transform var(--t-fast);
}

.template-card:hover { transform: translateY(-3px); }

.template-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
}

.template-card__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: inherit;
  pointer-events: none;
}

.template-card__gradient {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 38px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.template-card__quality {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.template-card__premium {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.template-card__premium svg { width: 11px; height: 11px; color: var(--accent); }

.template-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

.template-card__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-card__meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Estado animado de entrada en grid */
.template-card {
  opacity: 0;
  animation: fadeUp 0.4s cubic-bezier(.2,.8,.2,1) forwards;
}

@media (max-width: 640px) {
  .type-tabs { width: 100%; justify-content: flex-start; overflow-x: auto; border-radius: var(--r-md); }
  .type-tab { padding: var(--sp-2) var(--sp-4); }
  .templates-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-4); }
  .filters { flex-direction: column; align-items: stretch; }
  .filters__right { justify-content: flex-start; }
}

/* Botón fav en template-card */
.template-card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}
