/* ============================================================
   IsoAcoustics Japan - Product Selector Wizard Stylesheet
   BEM prefix: psw (Product Selector Wizard)
   ============================================================ */

:root {
  --z-dropdown: 100;
}

/* ------------------------------------------------------------
   1. CONTAINER
   ------------------------------------------------------------ */

.psw {
  padding: var(--space-section) var(--gutter);
  background-color: var(--iso-white);
}

.psw__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.psw__header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.psw__title {
  font-family: var(--font-primary);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--iso-dark);
  margin: 0 0 var(--space-xs);
}

.psw__subtitle {
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text);
  margin: 0;
}

/* ------------------------------------------------------------
   2. PROGRESS BAR
   ------------------------------------------------------------ */

.psw__progress {
  margin-bottom: var(--space-2xl);
}

.psw__progress-track {
  position: relative;
  height: 3px;
  background-color: var(--iso-mid-gray);
  border-radius: 2px;
  margin-bottom: var(--space-lg);
}

.psw__progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: var(--iso-green);
  border-radius: 2px;
  width: 0%;
  transition: width var(--duration-slow) var(--ease-out);
}

.psw__progress-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: calc(var(--space-lg) * -1 - 14px);
}

.psw__progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  cursor: default;
  padding: 0;
}

.psw__progress-step:not([disabled]) {
  cursor: pointer;
}

.psw__progress-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background-color: var(--iso-mid-gray);
  color: var(--iso-text-muted);
  transition: background-color var(--duration-normal) var(--ease-default),
              color var(--duration-normal) var(--ease-default);
}

.psw__progress-step--active .psw__progress-num,
.psw__progress-step--completed .psw__progress-num {
  background-color: var(--iso-green);
  color: var(--iso-white);
}

.psw__progress-label {
  font-family: var(--font-jp);
  font-size: var(--text-xs);
  color: var(--iso-text-muted);
  white-space: nowrap;
  transition: color var(--duration-normal) var(--ease-default);
}

.psw__progress-step--active .psw__progress-label {
  color: var(--iso-green);
  font-weight: var(--weight-medium);
}

.psw__progress-step--completed .psw__progress-label {
  color: var(--iso-text-dark);
}

/* ------------------------------------------------------------
   3. STEP PANELS
   ------------------------------------------------------------ */

.psw__step {
  display: none;
  animation: psw-fadeIn var(--duration-normal) var(--ease-out);
}

.psw__step--active {
  display: block;
}

@keyframes psw-fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.psw__step-header {
  margin-bottom: var(--space-xl);
}

.psw__step-title {
  font-family: var(--font-primary);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--iso-dark);
  margin: 0 0 var(--space-xs);
}

.psw__step-desc {
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text);
  margin: 0;
}

/* ------------------------------------------------------------
   4. CATEGORY CARDS
   ------------------------------------------------------------ */

.psw__categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .psw__categories {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
  }
}

.psw__category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  background-color: var(--iso-white);
  border: 2px solid var(--iso-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default),
              transform var(--duration-normal) var(--ease-default);
}

.psw__category-card:hover {
  border-color: var(--iso-text-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.psw__category-card:focus-visible {
  outline: 2px solid var(--iso-green);
  outline-offset: 2px;
}

.psw__category-card[aria-checked="true"] {
  border-color: var(--iso-green);
  box-shadow: 0 0 0 1px var(--iso-green), var(--shadow-md);
}

.psw__category-card__icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--iso-dark);
}

.psw__category-card__icon svg {
  width: 100%;
  height: 100%;
}

.psw__category-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.psw__category-card[aria-checked="true"] .psw__category-card__icon {
  color: var(--iso-green);
}

.psw__category-card__name {
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--iso-text-dark);
  line-height: var(--leading-snug);
}

/* ------------------------------------------------------------
   5. FORM ELEMENTS
   ------------------------------------------------------------ */

.psw__form {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.psw__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  position: relative;
}

.psw__field--compact {
  flex: 1;
  min-width: 0;
}

.psw__label {
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--iso-text-dark);
}

.psw__input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-md);
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text-dark);
  background-color: var(--iso-white);
  border: 1px solid var(--iso-border);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-default),
              box-shadow var(--duration-fast) var(--ease-default);
  box-sizing: border-box;
}

.psw__input:focus {
  outline: none;
  border-color: var(--iso-green);
  box-shadow: 0 0 0 3px rgba(10, 138, 62, 0.15);
}

.psw__input::placeholder {
  color: var(--iso-text-muted);
}

.psw__select {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-md);
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text-dark);
  background-color: var(--iso-white);
  border: 1px solid var(--iso-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  box-sizing: border-box;
}

.psw__select:focus {
  outline: none;
  border-color: var(--iso-green);
  box-shadow: 0 0 0 3px rgba(10, 138, 62, 0.15);
}

.psw__fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.psw__legend {
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--iso-text-dark);
  margin-bottom: var(--space-sm);
}

.psw__help-text {
  font-family: var(--font-jp);
  font-size: var(--text-xs);
  color: var(--iso-text-muted);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-sm);
}

.psw__dimensions-grid {
  display: flex;
  gap: var(--space-md);
}

/* ------------------------------------------------------------
   6. SEARCH DROPDOWN (Combobox)
   ------------------------------------------------------------ */

.psw__combobox {
  position: relative;
}

.psw__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  max-height: 300px;
  overflow-y: auto;
  background-color: var(--iso-white);
  border: 1px solid var(--iso-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.psw__dropdown-item {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text-dark);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default);
}

.psw__dropdown-item:hover,
.psw__dropdown-item--highlighted {
  background-color: var(--iso-light-gray);
}

.psw__dropdown-item[aria-selected="true"] {
  background-color: rgba(10, 138, 62, 0.08);
  color: var(--iso-green);
  font-weight: var(--weight-medium);
}

.psw__dropdown-item--other {
  border-top: 1px solid var(--iso-border);
  color: var(--iso-text-muted);
  font-style: italic;
}

/* ------------------------------------------------------------
   7. RADIO BUTTONS
   ------------------------------------------------------------ */

.psw__radio-group {
  display: flex;
  gap: var(--space-lg);
}

.psw__radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  font-family: var(--font-jp);
  font-size: var(--text-base);
}

.psw__radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.psw__radio-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--iso-border);
  border-radius: var(--radius-round);
  transition: border-color var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
}

.psw__radio-mark::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: var(--radius-round);
  background-color: var(--iso-green);
  transform: scale(0);
  transition: transform var(--duration-fast) var(--ease-default);
}

.psw__radio input[type="radio"]:checked + .psw__radio-mark {
  border-color: var(--iso-green);
}

.psw__radio input[type="radio"]:checked + .psw__radio-mark::after {
  transform: scale(1);
}

.psw__radio input[type="radio"]:focus-visible + .psw__radio-mark {
  outline: 2px solid var(--iso-green);
  outline-offset: 2px;
}

.psw__radio-text {
  color: var(--iso-text-dark);
}

/* ------------------------------------------------------------
   8. NAVIGATION BUTTONS
   ------------------------------------------------------------ */

.psw__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2xl);
  gap: var(--space-md);
}

.psw__nav-actions {
  display: flex;
  gap: var(--space-sm);
}

.psw__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 var(--space-xl);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-default),
              color var(--duration-fast) var(--ease-default),
              opacity var(--duration-fast) var(--ease-default);
  white-space: nowrap;
}

.psw__btn:focus-visible {
  outline: 2px solid var(--iso-green);
  outline-offset: 2px;
}

.psw__btn--next,
.psw__btn--results {
  background-color: var(--iso-green);
  color: var(--iso-white);
}

.psw__btn--next:hover:not([disabled]),
.psw__btn--results:hover:not([disabled]) {
  background-color: var(--iso-green-hover);
}

.psw__btn--next[disabled],
.psw__btn--results[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.psw__btn--back {
  background-color: transparent;
  color: var(--iso-text);
  border: 1px solid var(--iso-border);
}

.psw__btn--back:hover {
  border-color: var(--iso-text-muted);
  color: var(--iso-text-dark);
}

.psw__btn--outline {
  background-color: transparent;
  color: var(--iso-text-dark);
  border: 1px solid var(--iso-border);
}

.psw__btn--outline:hover {
  border-color: var(--iso-text-muted);
}

.psw__btn--reset {
  background-color: var(--iso-green);
  color: var(--iso-white);
}

.psw__btn--reset:hover {
  background-color: var(--iso-green-hover);
}

.psw__btn--retry {
  background-color: var(--iso-green);
  color: var(--iso-white);
  margin-top: var(--space-md);
}

.psw__btn--retry:hover {
  background-color: var(--iso-green-hover);
}

/* ------------------------------------------------------------
   9. LOADING
   ------------------------------------------------------------ */

.psw__loading {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) 0;
  gap: var(--space-lg);
}

.psw__loading:not([hidden]) {
  display: flex;
}

.psw__spinner {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.psw__spinner--inline {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.psw__spinner-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-round);
  background-color: var(--iso-green);
  animation: psw-bounce 1.4s ease-in-out infinite;
}

.psw__spinner-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.psw__spinner-dot:nth-child(3) {
  animation-delay: 0.32s;
}

.psw__spinner--inline .psw__spinner-dot {
  width: 6px;
  height: 6px;
}

@keyframes psw-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.psw__loading-text {
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text-muted);
}

/* ------------------------------------------------------------
   10. ERROR
   ------------------------------------------------------------ */

.psw__error {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  gap: var(--space-md);
}

.psw__error:not([hidden]) {
  display: flex;
}

.psw__error-icon {
  width: 48px;
  height: 48px;
  color: #dc3545;
}

.psw__error-icon svg {
  width: 100%;
  height: 100%;
}

.psw__error-title {
  font-family: var(--font-primary);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--iso-text-dark);
  margin: 0;
}

.psw__error-message {
  font-family: var(--font-jp);
  font-size: var(--text-base);
  color: var(--iso-text);
  max-width: 480px;
  margin: 0;
}

/* ------------------------------------------------------------
   11. RESULT CARDS
   ------------------------------------------------------------ */

.psw__results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.psw__result-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background-color: var(--iso-white);
  border: 1px solid var(--iso-border);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--duration-normal) var(--ease-default);
}

.psw__result-card:hover {
  box-shadow: var(--shadow-md);
}

.psw__result-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--iso-light-gray);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

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

.psw__result-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.psw__result-card__name {
  font-family: var(--font-primary);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--iso-dark);
  margin: 0;
}

.psw__result-card__desc {
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--iso-text);
  margin: 0;
}

.psw__result-card__quantity {
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  color: var(--iso-text-dark);
  font-weight: var(--weight-medium);
}

.psw__result-card__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--iso-green);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
}

.psw__result-card__link:hover {
  color: var(--iso-green-hover);
}

/* ------------------------------------------------------------
   12. SUMMARY TABLE
   ------------------------------------------------------------ */

.psw__summary {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background-color: var(--iso-light-gray);
  border-radius: var(--radius-lg);
}

.psw__summary-title {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--iso-text-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 var(--space-md);
}

.psw__summary-table {
  width: 100%;
  border-collapse: collapse;
}

.psw__summary-table td {
  padding: var(--space-xs) 0;
  font-family: var(--font-jp);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--iso-border);
}

.psw__summary-table td:first-child {
  font-weight: var(--weight-medium);
  color: var(--iso-text-dark);
  width: 140px;
}

.psw__summary-table td:last-child {
  color: var(--iso-text);
}

.psw__summary-table tr:last-child td {
  border-bottom: none;
}

/* ------------------------------------------------------------
   13. ANIMATIONS
   ------------------------------------------------------------ */

.psw__step-enter {
  animation: psw-fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.psw__step-exit {
  animation: psw-fadeOut var(--duration-fast) var(--ease-default) forwards;
}

@keyframes psw-fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ------------------------------------------------------------
   14. RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 767px) {
  .psw {
    padding: var(--space-xl) var(--gutter);
  }

  .psw__header {
    margin-bottom: var(--space-xl);
  }

  .psw__title {
    font-size: var(--text-xl);
  }

  .psw__progress-label {
    font-size: 10px;
  }

  .psw__progress-num {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .psw__categories {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .psw__category-card {
    padding: var(--space-lg) var(--space-sm);
  }

  .psw__category-card__icon {
    width: 48px;
    height: 48px;
  }

  .psw__category-card__name {
    font-size: var(--text-xs);
  }

  .psw__dimensions-grid {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .psw__result-card {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .psw__result-card__image {
    max-width: 200px;
    margin: 0 auto;
  }

  .psw__nav {
    flex-direction: row;
  }

  .psw__btn {
    height: 44px;
    padding: 0 var(--space-lg);
    font-size: 12px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .psw__categories {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .psw__categories {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
  }

  .psw__result-card {
    grid-template-columns: 200px 1fr;
  }
}

/* ------------------------------------------------------------
   15. REDUCED MOTION
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .psw__step {
    animation: none;
  }

  .psw__progress-fill {
    transition: none;
  }

  .psw__category-card {
    transition: none;
  }

  .psw__category-card:hover {
    transform: none;
  }

  .psw__spinner-dot {
    animation: none;
    opacity: 1;
  }

  .psw__step-enter,
  .psw__step-exit {
    animation: none;
  }
}

/* ------------------------------------------------------------
   16. PRINT
   ------------------------------------------------------------ */

@media print {
  .psw__progress,
  .psw__nav,
  .psw__btn,
  .site-header,
  .iso-mobile-nav,
  .site-footer,
  .header-spacer,
  .pp-breadcrumb {
    display: none !important;
  }

  .psw {
    padding: 0;
  }

  .psw__step {
    display: none !important;
  }

  #psw-step-4 {
    display: block !important;
  }

  .psw__result-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .psw__result-card:hover {
    box-shadow: none;
  }
}
