/* 1-Go Templates Search Hub Styles */
.templates-search-hub {
  padding: 120px 0 80px;
  background: #f9fafb;
  min-height: 100vh;
}

.search-hero {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 3rem;
}

.search-hero-title {
  font-size: 3rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 1rem;
}

.search-hero-subtitle {
  font-size: 1.125rem;
  color: #4b5563;
  margin-bottom: 2.5rem;
}

.search-bar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 650px;
  margin: 0 auto 2rem;
  background: #fff;
  border-radius: 50px;
  padding: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.3s;
}

.search-bar-wrapper:focus-within {
  box-shadow: 0 0 0 2px #4338CA, 0 10px 30px rgba(67, 56, 202, 0.15);
  border-color: #4338CA;
}

.search-icon {
  font-size: 1.5rem;
  color: #9ca3af;
  margin-left: 1rem;
}

.massive-search-input {
  flex: 1;
  border: none !important;
  outline: none !important;
  padding: 15px 15px;
  font-size: 1.125rem;
  background: transparent;
  color: #111827;
  box-shadow: none !important;
}

.massive-search-input:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.search-btn {
  background: linear-gradient(135deg, #4338CA 0%, #6366F1 100%);
  color: #fff;
  padding: 12px 24px;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}
.search-btn:hover {
  transform: scale(1.05);
}

.category-pills-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-pill {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s;
}

.category-pill:hover, .category-pill.active {
  background: #4338CA;
  color: #fff;
  border-color: #4338CA;
}

.pill-count {
  font-size: 0.85em;
  opacity: 0.6;
  margin-left: 3px;
  font-weight: 500;
}

.category-pill:hover .pill-count, .category-pill.active .pill-count {
  opacity: 0.9;
}

/* Zero-Latency Grid */
.results-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
}
.results-header h2 {
  font-size: 1.25rem;
  color: #111827;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 30px;
}

.template-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border: 1px solid #f3f4f6;
  transition: transform 0.3s, box-shadow 0.3s;
}
.template-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  padding-top: 65%;
  overflow: hidden;
  background: #f3f4f6;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.template-card:hover .card-img {
  transform: scale(1.05);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.template-card:hover .card-overlay {
  opacity: 1;
}

.preview-btn {
  background: #fff;
  color: #111827;
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transform: translateY(20px);
  transition: transform 0.3s, background 0.2s;
}
.template-card:hover .preview-btn {
  transform: translateY(0);
}
.preview-btn:hover {
  background: #4338CA;
  color: #fff;
}

.card-themes {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.theme-dot:hover, .theme-dot.active {
  transform: scale(1.3);
}

.card-info {
  padding: 20px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-category {
  font-size: 0.8rem;
  color: #6366F1;
  font-weight: 600;
  text-transform: uppercase;
}
.card-badge.trending {
  font-size: 0.75rem;
  background: #FEF2F2;
  color: #EF4444;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0;
}

/* No Results State (Psychology-driven) */
.no-results-state {
  text-align: center;
  padding: 5rem 1.5rem;
  background: var(--bg-secondary, #f8f9fc);
  border-radius: 24px;
  margin-top: 2rem;
  border: 1px dashed var(--border-color, #e5e7eb);
}

.no-results-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-primary, #ffffff);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
  margin-bottom: 1.5rem;
  color: var(--primary-color, #4338CA);
}

.no-results-icon-wrapper i {
  font-size: 40px;
}

.no-results-state h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark, #111827);
  margin-bottom: 1rem;
}

.no-results-state p {
  font-size: 1.1rem;
  color: var(--text-muted, #4b5563);
  max-width: 500px;
  margin: 0 auto 2rem auto;
  line-height: 1.6;
}

.no-results-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.no-results-actions .btn-primary,
.no-results-actions .btn-outline,
.no-results-actions .btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.no-results-actions .btn-primary {
  background: var(--primary-color, #4338CA);
  color: #fff;
  border: none;
}

.no-results-actions .btn-primary:hover {
  background: var(--primary-dark, #3730a3);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(67, 56, 202, 0.2);
}

.no-results-actions .btn-outline {
  background: transparent;
  color: var(--text-dark, #111827);
  border: 1px solid var(--border-color, #e5e7eb);
}

.no-results-actions .btn-outline:hover {
  background: var(--bg-primary, #ffffff);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.no-results-actions .btn-whatsapp {
  background: #25D366;
  color: #ffffff;
  border: none;
}

.no-results-actions .btn-whatsapp:hover {
  background: #128C7E;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(37, 211, 102, 0.2);
}

.no-results-msg {
  text-align: center;
  padding: 4rem;
}

/* Modal Styles */
.template-preview-modal {
  position: fixed;
  inset: 0;
  background: #f3f4f6;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.template-preview-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: relative;
}

.modal-left, .modal-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.modal-center {
  display: flex;
  align-items: center;
  gap: 15px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.modal-close-btn {
  background: #f3f4f6;
  border: none;
  color: #4b5563;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close-btn i {
  font-size: 1.2rem;
}

.modal-close-btn:hover {
  background: #e5e7eb;
  color: #111827;
  transform: rotate(90deg);
}

.modal-template-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-template-info h3 {
  margin: 0;
  font-size: 1rem;
  color: #111827;
}

.template-id-badge {
  font-size: 0.8rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}
.template-id-badge:hover {
  background: #e5e7eb;
}

.device-toggles {
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  gap: 4px;
}

.device-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 1.1rem;
  transition: all 0.2s;
}
.device-btn.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.modal-theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-label {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
}

.theme-dots-wrap {
  display: flex;
  gap: 8px;
}

.modal-theme-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}
.modal-theme-dot:hover {
  transform: scale(1.1);
}
.modal-theme-dot.active {
  border-color: #111827;
}

.start-building-btn {
  background: linear-gradient(135deg, #4338CA 0%, #6366F1 100%);
  color: #fff;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.2);
  transition: transform 0.2s;
}
.start-building-btn:hover {
  transform: translateY(-1px);
}

.modal-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.iframe-wrapper {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 768px) {
  .modal-left .modal-template-info, .modal-center {
      display: none; /* hide device toggles on mobile */
  }
}

@media (max-width: 500px) {
  .search-hero-title {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }
  .search-bar-wrapper {
    flex-direction: column;
    border-radius: 20px;
    padding: 10px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  .search-bar-wrapper .search-btn {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
  .search-icon {
    display: none;
  }
  .massive-search-input {
    width: 100%;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
  }
  .no-results-actions .btn-primary,
  .no-results-actions .btn-outline,
  .no-results-actions .btn-whatsapp {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
}
