/* Search workflow surfaces share the global variables and controls from styles.css. */
.search-console {
  min-width: 0;
}

.search-form {
  min-width: 0;
}

.search-form > label,
.search-form > button {
  min-width: 0;
}

.search-form input,
.search-form select,
.search-form button {
  min-width: 0;
}

.cache-controls {
  align-items: stretch;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 96px minmax(112px, 128px);
  min-width: 0;
}

.cache-mode {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.cache-mode__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cache-toggle {
  min-height: var(--control-height);
  padding: 0 var(--space-2);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color var(--motion-base);
  white-space: nowrap;
}

.cache-toggle:hover {
  color: var(--color-text-primary);
}

.cache-toggle input {
  cursor: pointer;
}

.cache-toggle input:focus {
  box-shadow: none;
}

.cache-toggle input:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

.cache-duration {
  min-width: 0;
}

.cache-duration__input {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto;
  min-width: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: #0d1319;
  transition: border-color var(--motion-base), opacity var(--motion-base);
}

.cache-duration__input input {
  border: 0;
  background: transparent;
}

.cache-duration__input > span {
  color: var(--color-text-tertiary);
  padding-right: var(--space-field-x);
  white-space: nowrap;
}

.cache-controls.is-realtime .cache-duration {
  opacity: 0.5;
}

.advanced-search {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--color-border-subtle);
  padding-top: var(--space-3);
}

.advanced-search > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 800;
  list-style: none;
  min-height: var(--button-height-compact);
}

.advanced-search > summary::-webkit-details-marker {
  display: none;
}

.advanced-search > summary::after {
  content: '+';
  color: var(--color-action-secondary);
  font-size: var(--font-size-lg);
}

.advanced-search[open] > summary::after {
  content: '-';
}

.advanced-search__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.advanced-search__actions {
  align-items: end;
  display: flex;
  gap: var(--space-4);
  justify-content: flex-end;
  margin-top: var(--space-3);
}

.result-toolbar,
.results,
.product,
.product-top,
.product-footer,
.meta,
.favorites-panel,
.favorites-list,
.favorite-item,
.favorite-main,
.favorite-actions {
  min-width: 0;
}

.result-toolbar > div,
.dock-summary,
.favorite-state-card,
.favorite-open,
.favorite-title {
  overflow-wrap: anywhere;
}

.product-title {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.product-title:not([href]) {
  color: var(--color-text-primary);
  cursor: default;
}

.product-top {
  align-items: flex-start;
}

.platform-badge,
.status-badge,
.stock-badge {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.product-footer {
  align-items: flex-end;
}

.price-box,
.cost-box {
  min-width: 0;
}

.price,
.cost {
  overflow-wrap: anywhere;
}

.favorite-button:disabled {
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .search-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .console-topline,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-form .wide,
  .search-form .advanced-search,
  .search-form .cache-controls,
  .search-form .page-size-control,
  .search-form > button {
    grid-column: 1 / -1;
  }

  .search-form .cache-controls {
    grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1.3fr);
  }
}

@media (max-width: 760px) {
  .advanced-search__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .search-form {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-strip div,
  .stat-strip div:first-child {
    border-top: 0;
    border-left: 1px solid var(--color-border-subtle);
  }

  .stat-strip div:first-child {
    border-left: 0;
  }

  .product-footer {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .advanced-search__grid {
    grid-template-columns: 1fr;
  }

  .cache-controls {
    align-items: stretch;
    grid-template-columns: minmax(96px, 0.7fr) minmax(0, 1.3fr);
    width: 100%;
  }

  .advanced-search__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .product-footer .favorite-button {
    margin-left: auto;
  }
}

@media (max-width: 360px) {
  .search-form,
  .product {
    padding: var(--space-4);
  }

  .product {
    gap: var(--space-3);
  }

  .product-top {
    gap: var(--space-2);
  }

  .platform-badge,
  .status-badge,
  .stock-badge {
    font-size: var(--font-size-xs);
    padding: 6px 8px;
  }

  .price {
    font-size: 28px;
  }

  .product-footer .favorite-button {
    margin-left: 0;
    width: 100%;
  }
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
}

.trust-list li,
.meta-pill {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #bfd2e5;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.045);
}

.login-card {
  align-self: start;
  border-radius: var(--radius-lg);
  display: grid;
  gap: 15px;
  padding: 20px;
  position: sticky;
  top: 18px;
}

.card-heading {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-bottom: 6px;
}

.card-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  color: var(--hp-dark-text);
  font-weight: 900;
  background: var(--color-action-secondary);
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  letter-spacing: 0;
}

.remember-row {
  align-items: center;
  display: flex;
  gap: 10px;
  color: #c7d5e7;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.remember-row input {
  appearance: none;
  width: 18px;
  height: 18px;
  min-height: 18px;
  border-radius: 6px;
  border: 1px solid var(--line-bright);
  background: rgba(3, 8, 17, 0.72);
  display: grid;
  place-items: center;
  padding: 0;
}

.remember-row input:checked {
  background: var(--cyan);
  border-color: transparent;
}

.remember-row input:checked::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #031018;
  border-bottom: 2px solid #031018;
  transform: rotate(-45deg) translateY(-1px);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #0d1319;
  color: var(--ink);
  outline: none;
  padding: 0 15px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input,
select {
  min-height: 48px;
}

textarea {
  line-height: 1.55;
  min-height: 96px;
  padding: 13px 15px;
  resize: vertical;
}

select {
  color-scheme: dark;
}

input::placeholder,
textarea::placeholder {
  color: rgba(147, 164, 184, 0.62);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: var(--focus-ring);
  background: #101820;
}

.search-console {
  display: grid;
  gap: 16px;
}

.console-topline {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.stat-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  overflow: hidden;
  background: var(--color-bg-surface);
}

.stat-strip div {
  padding: 8px 14px;
  border-left: 1px solid var(--line);
}

.stat-strip div:first-child {
  border-left: 0;
}

.stat-strip span {
  color: var(--faint);
  display: block;
  font-size: 11px;
  letter-spacing: 0;
}

.stat-strip strong {
  display: block;
  font-size: 16px;
  margin-top: 2px;
}

.search-form {
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 150px 130px 140px 160px minmax(216px, 232px);
  gap: 14px;
  align-items: end;
  padding: 18px;
}

.page-size-control {
  grid-column: 5;
}

.search-form > #searchButton {
  grid-column: 6;
}

.result-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.result-sentinel {
  grid-column: 1 / -1;
  min-height: 1px;
}

.load-more-status {
  color: var(--muted);
  font-size: 13px;
}

.favorites-panel {
  border: 1px solid rgba(160, 186, 218, 0.16);
  border-radius: var(--radius-lg);
  margin-top: 18px;
  padding: 16px;
  background: var(--color-bg-surface);
}

.favorites-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.favorites-head h3 {
  margin-top: 6px;
}

.favorites-head-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.meta-pill--warning {
  border-color: var(--state-warning-border);
  color: var(--color-state-warning);
  background: var(--state-warning-bg);
}

.favorites-list {
  display: grid;
  gap: 10px;
}

.favorite-item {
  align-items: center;
  border: 1px solid rgba(160, 186, 218, 0.14);
  border-radius: var(--radius-md);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
  background: var(--color-bg-surface-soft);
}

.favorite-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.favorite-title {
  color: var(--ink);
  display: block;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none;
  word-break: break-word;
}

.favorite-title:hover {
  color: var(--cyan);
}

.favorite-title.placeholder {
  color: var(--color-text-primary);
  cursor: default;
}

.favorite-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.favorite-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.favorite-open,
.favorite-button {
  align-items: center;
  border: 1px solid rgba(102, 227, 255, 0.22);
  border-radius: var(--radius-md);
  color: #c9e9ff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 0 14px;
  text-align: center;
  text-decoration: none;
  width: auto;
  background: rgba(102, 227, 255, 0.08);
}

.favorite-open:hover,
.favorite-button:hover:not(:disabled) {
  border-color: var(--line-bright);
  background: rgba(102, 227, 255, 0.14);
}

.favorite-open.placeholder {
  border-color: rgba(160, 186, 218, 0.16);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.favorite-button.active {
  color: var(--hp-dark-text);
  border-color: transparent;
  background: var(--gold);
}

.favorite-state-card {
  min-height: 120px;
}

.favorite-state-card span {
  display: block;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.product {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 236px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  position: relative;
  overflow: hidden;
  background: var(--color-bg-surface);
  box-shadow: var(--shadow-card);
  animation: reveal 220ms ease both;
}

.product::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  pointer-events: none;
  background: var(--color-action-primary);
}

.product:hover {
  border-color: var(--line-bright);
}

.product-top,
.product-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.badge-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge,
.platform-badge,
.stock-badge {
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.platform-badge {
  color: #a9e4e1;
  border-color: rgba(72, 199, 194, 0.32);
  background: rgba(72, 199, 194, 0.1);
}

.status-badge.on {
  color: #caffdd;
  border-color: rgba(112, 240, 167, 0.32);
  background: rgba(112, 240, 167, 0.1);
}

.status-badge.off {
  color: #ffd1dc;
  border-color: rgba(255, 109, 143, 0.32);
  background: rgba(255, 109, 143, 0.11);
}

.status-badge.unknown {
  color: #d8e5f3;
  border-color: rgba(160, 186, 218, 0.24);
  background: rgba(160, 186, 218, 0.08);
}

.stock-badge {
  color: #c9e9ff;
}

.product-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.38;
  text-decoration: none;
}

.product-title:hover {
  color: var(--cyan);
}

.description {
  color: var(--muted);
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.meta-pill {
  font-size: 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-footer {
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 14px;
}

.product-footer .favorite-button {
  flex: 0 0 auto;
}

.price-box span,
.cost-box span {
  color: var(--faint);
  display: block;
  font-size: 11px;
  letter-spacing: 0;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.price {
  color: var(--gold);
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1;
}

.cost {
  color: #c7d5e7;
  display: block;
  font-size: 15px;
}

.empty-state {
  border: 1px dashed rgba(102, 227, 255, 0.34);
  border-radius: var(--radius-xl);
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.empty-state strong {
  color: var(--ink);
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
}

.empty-state.compact {
  grid-column: 1 / -1;
  min-height: 120px;
}

.empty-state.compact strong {
  font-size: 18px;
}
