/* ============================================
   WORKFLOW TEMPLATES GALLERY STYLES
   ============================================ */

/* ---- Hero ---- */
.rn-wf-hero {
  background: var(--rn-secondary);
  color: var(--rn-white);
  padding: 3rem 0 2.5rem;
  margin-top: -2rem;
  margin-bottom: 2rem;
}

.rn-wf-hero__title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  text-align: center;
}

.rn-wf-hero__subtitle {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ---- Workflow Grid ---- */
.rn-wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.rn-wf-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.rn-wf-grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================
   WORKFLOW CARD — Redesigned
   ============================================ */
.rn-wf-card {
  background: var(--rn-white);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-lg);
  overflow: hidden;
  transition: border-color var(--rn-transition), box-shadow var(--rn-transition), transform var(--rn-transition);
  display: flex;
  flex-direction: column;
}

.rn-wf-card:hover {
  border-color: var(--rn-primary);
  box-shadow: var(--rn-shadow-md);
  transform: translateY(-2px);
}

.rn-wf-card__link {
  color: inherit;
  text-decoration: none;
  flex: 1;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ---- Card Header (icon + title) ---- */
.rn-wf-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.rn-wf-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--rn-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
  background: var(--rn-primary-light);
  color: var(--rn-primary);
}

/* Platform-specific colours */
.rn-wf-card__icon--n8n {
  background: #FFF1E6;
  color: #EA4B18;
}

.rn-wf-card__icon--zapier {
  background: #FFF4E6;
  color: #FF4F00;
}

.rn-wf-card__icon--make {
  background: #F0E6FF;
  color: #6D29D9;
}

.rn-wf-card__icon--crewai {
  background: #E6F4FF;
  color: #0066CC;
}

.rn-wf-card__icon--langchain {
  background: #E6FFE6;
  color: #1A8C1A;
}

.rn-wf-card__title-wrap {
  flex: 1;
  min-width: 0;
}

.rn-wf-card__title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--rn-secondary);
  margin-bottom: 0.125rem;
}

.rn-wf-card__platform {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--rn-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---- Excerpt ---- */
.rn-wf-card__excerpt {
  font-size: 0.8125rem;
  color: var(--rn-gray-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Flow Chain (Tool → Tool → Tool) ---- */
.rn-wf-card__flow {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.625rem 0.75rem;
  background: var(--rn-gray-50);
  border-radius: var(--rn-radius-md);
}

.rn-wf-card__flow-node {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--rn-gray-700);
  background: var(--rn-white);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-sm);
  white-space: nowrap;
}

.rn-wf-card__flow-arrow {
  flex-shrink: 0;
  color: var(--rn-gray-300);
}

.rn-wf-card__flow-more {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--rn-gray-400);
  padding: 0.1875rem 0.375rem;
  background: var(--rn-gray-100);
  border-radius: var(--rn-radius-sm);
}

/* ---- Card Footer (stats + difficulty badge) ---- */
.rn-wf-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rn-gray-100);
  margin-top: auto;
}

.rn-wf-card__stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rn-wf-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--rn-gray-400);
}

.rn-wf-card__stat svg {
  flex-shrink: 0;
}

/* ---- Badges (shared) ---- */
.rn-wf-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--rn-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rn-wf-badge--platform {
  background: var(--rn-primary-light);
  color: var(--rn-primary);
}

.rn-wf-badge--cat {
  background: var(--rn-gray-100);
  color: var(--rn-gray-600);
  text-decoration: none;
}

.rn-wf-badge--diff {
  text-transform: capitalize;
}

.rn-wf-badge--beginner {
  background: rgba(0, 212, 170, 0.1);
  color: #00b892;
}

.rn-wf-badge--intermediate {
  background: rgba(255, 193, 7, 0.15);
  color: #b78a00;
}

.rn-wf-badge--advanced {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ---- Tool Pills (single page) ---- */
.rn-wf-tool-pill {
  display: inline-block;
  font-size: 0.6875rem;
  color: var(--rn-gray-600);
  background: var(--rn-gray-100);
  padding: 0.15rem 0.5rem;
  border-radius: var(--rn-radius-full);
}

.rn-wf-tool-pill--lg {
  font-size: 0.8125rem;
  padding: 0.3rem 0.75rem;
}

/* ============================================
   FLOW DIAGRAM (Single Page)
   ============================================ */
.rn-wf-flow {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 1.5rem;
  background: var(--rn-gray-50);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rn-wf-flow__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rn-wf-flow__node-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--rn-radius-lg);
  background: var(--rn-white);
  border: 2px solid var(--rn-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--rn-primary);
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.rn-wf-flow__node-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--rn-gray-700);
  text-align: center;
  max-width: 72px;
  line-height: 1.3;
}

.rn-wf-flow__connector {
  display: flex;
  align-items: center;
  color: var(--rn-gray-300);
  flex-shrink: 0;
  padding: 0 0.125rem;
  margin-bottom: 1.25rem;
}

/* ============================================
   SINGLE WORKFLOW PAGE
   ============================================ */
.rn-wf-single {
  margin: 2rem 0 3rem;
}

.rn-wf-single__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.rn-wf-single__title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.rn-wf-single__badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rn-wf-single__meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--rn-gray-400);
}

.rn-wf-single__meta span + span::before {
  content: "\00b7";
  margin-right: 1rem;
}

.rn-wf-single__actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ---- Body layout ---- */
.rn-wf-single__body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.rn-wf-single__section {
  margin-bottom: 2rem;
}

.rn-wf-single__section h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--rn-gray-900);
}

.rn-wf-single__screenshot {
  border-radius: var(--rn-radius-lg);
  overflow: hidden;
  border: 1px solid var(--rn-gray-200);
  background: var(--rn-gray-50);
}

.rn-wf-single__screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

.rn-wf-single__content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--rn-gray-700);
}

.rn-wf-single__content p {
  margin-bottom: 1rem;
}

.rn-wf-single__tools {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rn-wf-single__tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* ---- What You'll Need (sidebar) ---- */
.rn-wf-single__needs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rn-wf-single__needs li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  color: var(--rn-gray-700);
  border-bottom: 1px solid var(--rn-gray-100);
}

.rn-wf-single__needs li:last-child {
  border-bottom: none;
}

.rn-wf-single__needs-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--rn-radius-sm);
  background: var(--rn-primary-light);
  color: var(--rn-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ---- Related ---- */
.rn-wf-single__related {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rn-gray-200);
}

.rn-wf-single__related h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

/* ============================================
   HORIZONTAL FILTER TOOLBAR
   ============================================ */
.rn-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rn-gray-100);
}

.rn-filter-toolbar__count {
  font-size: 0.875rem;
  color: var(--rn-gray-500);
  white-space: nowrap;
}

.rn-filter-toolbar__count strong {
  color: var(--rn-gray-900);
}

.rn-filter-toolbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.rn-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rn-filter-pill {
  position: relative;
}

.rn-filter-pill__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--rn-font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rn-gray-600);
  background: var(--rn-white);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-full);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: all var(--rn-transition);
  white-space: nowrap;
}

.rn-filter-pill__btn:hover {
  border-color: var(--rn-gray-300);
  background: var(--rn-gray-50);
}

.rn-filter-pill.is-active .rn-filter-pill__btn {
  color: var(--rn-primary);
  border-color: var(--rn-primary);
  background: var(--rn-primary-light);
}

.rn-filter-pill.is-open .rn-filter-pill__btn {
  border-color: var(--rn-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.rn-filter-pill__arrow {
  transition: transform 0.2s ease;
}

.rn-filter-pill.is-open .rn-filter-pill__arrow {
  transform: rotate(180deg);
}

.rn-filter-pill__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--rn-white);
  background: var(--rn-primary);
  border-radius: 9px;
  padding: 0 0.25rem;
  line-height: 1;
}

.rn-filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--rn-white);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-lg);
  box-shadow: var(--rn-shadow-lg);
  padding: 0.375rem;
  z-index: 100;
}

.rn-filter-pill.is-open .rn-filter-dropdown {
  display: block;
}

.rn-filter-dropdown__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.625rem;
  border-radius: var(--rn-radius-sm);
  cursor: pointer;
  transition: background var(--rn-transition);
  font-size: 0.8125rem;
}

.rn-filter-dropdown__option:hover {
  background: var(--rn-gray-50);
}

.rn-filter-dropdown__option input[type="checkbox"],
.rn-filter-dropdown__option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--rn-primary);
}

.rn-filter-dropdown__label {
  flex: 1;
  color: var(--rn-gray-700);
  font-weight: 500;
}

.rn-filter-dropdown__count {
  font-size: 0.6875rem;
  color: var(--rn-gray-400);
  background: var(--rn-gray-100);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--rn-radius-full);
  font-weight: 600;
}

.rn-filter-sort {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.rn-filter-sort__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rn-gray-500);
  white-space: nowrap;
}

.rn-filter-sort__select {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rn-gray-700);
  background: var(--rn-white);
  border: 1px solid var(--rn-gray-200);
  border-radius: var(--rn-radius-md);
  padding: 0.375rem 1.75rem 0.375rem 0.625rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color var(--rn-transition);
}

.rn-filter-sort__select:hover {
  border-color: var(--rn-gray-300);
}

.rn-filter-sort__select:focus {
  outline: none;
  border-color: var(--rn-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.rn-filter-clear {
  font-family: var(--rn-font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rn-gray-400);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  transition: color var(--rn-transition);
  white-space: nowrap;
}

.rn-filter-clear:hover {
  color: var(--rn-primary);
}

/* ============================================
   ACTIVE FILTER CHIPS
   ============================================ */
.rn-filter-chips {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.rn-filter-chips:empty {
  display: none;
}

.rn-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rn-primary);
  background: var(--rn-primary-light);
  padding: 0.25rem 0.5rem;
  border-radius: var(--rn-radius-full);
  white-space: nowrap;
}

.rn-filter-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  color: var(--rn-primary);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  opacity: 0.6;
  transition: opacity var(--rn-transition), background var(--rn-transition);
}

.rn-filter-chip__remove:hover {
  opacity: 1;
  background: rgba(99, 102, 241, 0.15);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .rn-wf-single__body {
    grid-template-columns: 1fr;
  }

  .rn-wf-single__header {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .rn-wf-hero__title {
    font-size: 1.75rem;
  }

  .rn-wf-grid {
    grid-template-columns: 1fr;
  }

  .rn-wf-single__title {
    font-size: 1.5rem;
  }

  .rn-filter-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .rn-filter-toolbar__right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .rn-filter-bar {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .rn-filter-sort__label {
    display: none;
  }

  .rn-filter-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    border-radius: var(--rn-radius-lg) var(--rn-radius-lg) 0 0;
    z-index: 1000;
  }

  .rn-wf-flow {
    padding: 1rem;
    gap: 0.25rem;
  }

  .rn-wf-flow__node-icon {
    width: 40px;
    height: 40px;
    font-size: 0.75rem;
  }

  .rn-wf-flow__node-label {
    font-size: 0.625rem;
    max-width: 56px;
  }

  .rn-wf-card__flow {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}
