/**
 * SmartHomeU Smart Switch Finder Styles
 */

[x-cloak] {
  display: none !important;
}

.switch-finder {
  margin: 0 auto;
  padding: 2rem;
}

/* Intro Screen */
.switch-finder__intro {
  text-align: center;
  padding: 3rem 2rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.switch-finder__intro .intro-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, #4a90d9 0%, #3a7bc8 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch-finder__intro .intro-icon .icon {
  width: 3rem;
  height: 3rem;
  color: #fff;
}

.switch-finder__intro h2 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  color: #333;
}

.switch-finder__intro .lead {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

/* Step Screen */
.switch-finder__step {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem;
}

/* Progress Navigation */
.sf-progress-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.sf-progress-nav--desktop::before {
  content: '';
  position: absolute;
  bottom: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: #e0e0e0;
  z-index: 0;
}

.sf-progress-nav__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: default;
}

.sf-progress-nav__step:disabled {
  cursor: default;
  opacity: 1;
}

.sf-progress-nav__step.is-clickable {
  cursor: pointer;
}

.sf-progress-nav__step.is-clickable:hover .sf-progress-nav__indicator {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.sf-progress-nav__step.is-clickable:hover .sf-progress-nav__label {
  color: #4a90d9;
}

.sf-progress-nav__step.is-clickable:focus {
  outline: none;
}

.sf-progress-nav__step.is-clickable:focus .sf-progress-nav__indicator {
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);
}

.sf-progress-nav__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
}

.sf-progress-nav__indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: #999;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.sf-progress-nav__indicator .icon {
  width: 1rem;
  height: 1rem;
  color: inherit;
}

.sf-progress-nav__indicator.is-active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

.sf-progress-nav__indicator.is-completed {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

/* Mobile dropdown (hidden on desktop) */
.sf-progress-nav--mobile {
  display: none;
}

.sf-progress-nav__select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #4a90d9;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  background: #fff;
  cursor: pointer;
  appearance: auto;
  margin-bottom: 1.5rem;
}

.sf-progress-nav__select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.sf-progress-nav__select option:disabled {
  color: #ccc;
}

.switch-finder__step h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  color: #333;
}

.sf-hint {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Option Cards */
.sf-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sf-options--compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.switch-finder .option-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.switch-finder .option-card:hover {
  border-color: #4a90d9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.15);
}

.switch-finder .option-card:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);
}

.switch-finder .option-card.selected {
  border-color: #4a90d9;
  background: #f0f7ff;
}

.switch-finder .option-card.selected .option-icon {
  background: #4a90d9;
  color: #fff;
}

.switch-finder .option-card.selected .option-icon .icon {
  color: #fff;
}

.switch-finder .option-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #f0f7ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.switch-finder .option-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #4a90d9;
}

.switch-finder .option-content {
  flex: 1;
  min-width: 0;
}

.switch-finder .option-content h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.switch-finder .option-content p {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

/* Compact ecosystem cards */
.switch-finder .option-card--compact {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  gap: 0.5rem;
}

.switch-finder .option-card--compact .option-icon {
  width: 50px;
  height: 50px;
}

.switch-finder .option-card--compact h3 {
  font-size: 0.9rem;
  margin: 0;
}

/* Info callout */
.sf-info {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  background: #e8f4fd;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #1565c0;
  line-height: 1.5;
}

.sf-info .icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
}

.sf-info--warning {
  background: #fff3cd;
  color: #856404;
}

/* Navigation */
.sf-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
}

.sf-nav .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Results Screen */
.switch-finder__results {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem;
}

/* Results Header */
.sf-results-header {
  margin-bottom: 1.5rem;
}

.sf-results-header h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  color: #333;
}

.sf-results-count {
  font-size: 1.05rem;
  color: #555;
  margin-bottom: 0.75rem;
}

.sf-results-count .count {
  font-weight: 700;
  color: #4a90d9;
}

/* Inputs Summary (editable) */
.sf-inputs-summary {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.sf-inputs-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sf-inputs-summary__header h3 {
  margin: 0;
  font-size: 1rem;
  color: #333;
}

.sf-inputs-summary .btn-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sf-inputs-summary .btn-copy-link:hover {
  border-color: #4a90d9;
  color: #4a90d9;
}

.sf-inputs-summary .btn-copy-link .icon {
  width: 0.8rem;
  height: 0.8rem;
}

.sf-inputs-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.sf-inputs-summary__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.sf-inputs-summary__item:hover {
  border-color: #4a90d9;
  background: #f0f7ff;
}

.sf-inputs-summary__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #999;
  display: block;
}

.sf-inputs-summary__value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  flex: 1;
}

.sf-inputs-summary__edit {
  flex-shrink: 0;
  color: #ccc;
  transition: color 0.15s ease;
}

.sf-inputs-summary__item:hover .sf-inputs-summary__edit {
  color: #4a90d9;
}

.sf-inputs-summary__edit .icon {
  width: 0.7rem;
  height: 0.7rem;
}

/* Filter Pills */
.sf-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.sf-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  background: #e8f4fd;
  color: #1565c0;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Contextual Warnings */
.sf-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #fff3cd;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #856404;
  line-height: 1.5;
}

.sf-warning .icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
}

/* Sort Controls */
.sf-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.sf-sort__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-right: 0.25rem;
}

.sf-sort__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sf-sort__btn .icon {
  width: 0.75rem;
  height: 0.75rem;
}

.sf-sort__btn:hover {
  border-color: #4a90d9;
  color: #4a90d9;
}

.sf-sort__btn.is-active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
}

/* Product Results Grid */
.sf-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.sf-product-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.sf-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.sf-product-card__image {
  height: 160px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.sf-product-card__image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sf-product-card__placeholder {
  color: #ccc;
}

.sf-product-card__placeholder .icon {
  width: 3rem;
  height: 3rem;
}

/* Verified Badge */
.sf-verified-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: #28a745;
  color: #fff;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
}

.sf-verified-badge .icon {
  width: 0.7rem;
  height: 0.7rem;
}

.sf-product-card__content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sf-product-card__title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.sf-product-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.sf-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
}

.sf-badge--protocol {
  background: #f0f0f0;
  color: #666;
}

.sf-badge--neutral {
  background: #e8f5e9;
  color: #2e7d32;
}

.sf-product-card__meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sf-product-card__price {
  font-weight: 700;
  color: #333;
  font-size: 1.05rem;
}

.sf-product-card__ecosystems {
  display: flex;
  gap: 0.25rem;
}

.sf-eco-badge {
  padding: 0.15rem 0.4rem;
  background: #e8f4fd;
  border-radius: 4px;
  font-size: 0.65rem;
  color: #1565c0;
}

/* No Results */
.sf-no-results {
  text-align: center;
  padding: 3rem 2rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.sf-no-results .icon {
  width: 3rem;
  height: 3rem;
  color: #ccc;
  margin-bottom: 1rem;
}

.sf-no-results h3 {
  margin: 0 0 0.5rem;
  color: #333;
}

.sf-no-results p {
  color: #666;
  margin: 0 0 1rem;
}

/* Loading */
.sf-loading {
  text-align: center;
  padding: 3rem;
  color: #666;
}

/* Restart */
.sf-restart {
  text-align: center;
  padding-top: 1rem;
}

.sf-restart .btn-link {
  color: #666;
  text-decoration: none;
  font-weight: 500;
}

.sf-restart .btn-link:hover {
  color: #4a90d9;
}

.sf-restart .btn-link .icon {
  margin-right: 0.5rem;
  width: 0.9rem;
  height: 0.9rem;
  vertical-align: -0.1em;
}

/* Backward transition override */
.switch-finder.going-back .switch-finder__step,
.switch-finder.going-back .switch-finder__results {
  transition: none !important;
  animation: none !important;
}

/* Loading spinner on init */
.sf-init-loading {
  text-align: center;
  padding: 3rem 2rem;
}

.sf-init-loading p {
  color: #666;
  margin-top: 1rem;
}

.sf-init-loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #4a90d9;
  border-radius: 50%;
  margin: 0 auto;
  animation: sf-spin 0.8s linear infinite;
}

@keyframes sf-spin {
  to { transform: rotate(360deg); }
}

/* Contextual tips */
.sf-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f0f7ff;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #37474f;
  line-height: 1.5;
}

.sf-tip .icon {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
  color: #4a90d9;
}

/* Actions container (copy link + print) */
.sf-inputs-summary__actions {
  display: flex;
  gap: 0.5rem;
}

/* Print styles */
@media print {
  body * {
    visibility: hidden;
  }

  .switch-finder__results,
  .switch-finder__results * {
    visibility: visible;
  }

  .switch-finder__results {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
  }

  .sf-progress-nav,
  .sf-inputs-summary__actions,
  .sf-restart,
  .sf-loading {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .switch-finder {
    padding: 1rem;
  }

  .sf-progress-nav {
    gap: 0.25rem;
    margin-bottom: 1.5rem;
  }

  .sf-progress-nav--desktop::before {
    left: 20px;
    right: 20px;
  }

  .sf-progress-nav__label {
    font-size: 0.6rem;
    letter-spacing: 0;
  }

  .sf-progress-nav__indicator {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .sf-progress-nav__indicator .icon {
    width: 0.8rem;
    height: 0.8rem;
  }

  .switch-finder__intro {
    padding: 2rem 1.5rem;
  }

  .switch-finder__intro h2 {
    font-size: 1.5rem;
  }

  .switch-finder__step {
    padding: 1.5rem;
  }

  .sf-options {
    grid-template-columns: 1fr;
  }

  .sf-options--compact {
    grid-template-columns: repeat(2, 1fr);
  }

  .sf-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .sf-inputs-summary__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .sf-progress-nav--desktop {
    display: none !important;
  }

  .sf-progress-nav--mobile {
    display: block;
  }
}

@media (max-width: 480px) {
  .switch-finder__intro .intro-icon {
    width: 80px;
    height: 80px;
  }

  .switch-finder__intro .intro-icon .icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .switch-finder__intro h2 {
    font-size: 1.25rem;
  }

  .sf-options--compact {
    grid-template-columns: 1fr;
  }

  .sf-nav {
    flex-direction: column;
  }

  .sf-nav .btn {
    width: 100%;
  }

  .sf-products-grid {
    grid-template-columns: 1fr;
  }

  .sf-product-card {
    flex-direction: row;
  }

  .sf-product-card__image {
    width: 110px;
    height: auto;
    min-height: 90px;
    flex-shrink: 0;
  }

  .sf-product-card__content {
    padding: 0.75rem;
  }

  .sf-product-card__title {
    font-size: 0.9rem;
  }

  .sf-verified-badge {
    top: 4px;
    right: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.6rem;
  }

  .sf-inputs-summary__grid {
    grid-template-columns: 1fr;
  }
}
