/**
 * Helix dashboard / product launchpad (index.htm only).
 * See docs/ui-style-guide.md
 */

header.hub-header {
  position: sticky;
}

.hub-hero {
  padding: var(--space-8) var(--page-gutter) var(--space-7);
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--hero-gradient);
}

.hub-hero h1 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: -0.03em;
}

.hub-hero p {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  max-width: 40rem;
  margin: 0 auto;
  line-height: var(--line-height-relaxed);
}

.hub-main {
  max-width: var(--layout-max-width);
}

.hub-section-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hub-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  order: 2;
  min-width: 2rem;
}

.refresh-status-btn {
  order: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-4);
  min-height: var(--control-height-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: border-color var(--transition-normal), color var(--transition-normal), background var(--transition-normal);
}

.refresh-status-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--surface-hover);
}

.refresh-status-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.refresh-status-btn.loading .refresh-icon {
  animation: spin 1s linear infinite;
}

.refresh-icon {
  font-size: var(--font-size-md);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-6);
}

.product-card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  cursor: pointer;
  min-height: 0;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.product-card:not(.inactive):hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.product-card.inactive {
  opacity: 0.55;
  filter: grayscale(35%);
  pointer-events: none;
  cursor: not-allowed;
}

.product-card.inactive:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.product-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.product-icon {
  width: auto;
  min-width: 150px;
  max-width: 200px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-4);
}

.product-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.product-card[data-product="hz"] .product-icon {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(196, 92, 104, 0.22);
}

.product-card[data-product="sp"] .product-icon {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(61, 155, 106, 0.22);
}

.product-card[data-product="dd"] .product-icon {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(107, 159, 212, 0.22);
}

.product-card[data-product="ddqa"] .product-icon {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(201, 162, 39, 0.22);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.product-status {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.product-status.active {
  background: rgba(var(--success-rgb), 0.12);
  color: var(--success);
  border: 1px solid rgba(var(--success-rgb), 0.28);
}

.product-status.beta {
  background: rgba(var(--warning-rgb), 0.12);
  color: var(--warning);
  border: 1px solid rgba(var(--warning-rgb), 0.28);
}

.product-status.inactive {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.product-status.checking {
  background: rgba(var(--info-rgb), 0.12);
  color: var(--info);
  border: 1px solid rgba(var(--info-rgb), 0.28);
}

.product-status.rollout-pending {
  color: var(--warning);
  border-color: rgba(var(--warning-rgb), 0.35);
}

.product-description {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

.product-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.feature-tag {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
}

a.feature-tag:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.product-link {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--link);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.product-link::after {
  content: '→';
  transition: transform var(--transition-normal);
}

.product-card:not(.inactive):hover .product-link::after {
  transform: translateX(4px);
}

.product-card.inactive .product-link::after {
  content: '';
}

.inactive-reason {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

.lookup-section {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--page-gutter) 0;
}

.lookup-input-wrap {
  position: relative;
  margin-bottom: var(--space-4);
}

.lookup-input-wrap.glass-panel {
  border-radius: var(--radius-lg);
  padding: var(--space-2);
}

.lookup-input-wrap .lookup-icon {
  position: absolute;
  left: var(--space-5);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  pointer-events: none;
  font-weight: var(--font-weight-medium);
}

#global-search {
  width: 100%;
  padding: var(--space-4) var(--space-5) var(--space-4) 3rem;
  font-size: var(--font-size-lg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
  box-sizing: border-box;
  min-height: var(--control-height-lg);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

#global-search:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: var(--focus-ring);
}

.lookup-status {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  min-height: 1.25em;
}

.lookup-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.lookup-item {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.lookup-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.lookup-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

.lookup-meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.lookup-badge {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.lookup-open {
  font-size: var(--font-size-sm);
  color: var(--link);
  font-weight: var(--font-weight-medium);
}

.lookup-open::after {
  content: ' →';
}

.lookup-empty {
  font-size: var(--font-size-md);
  color: var(--text-muted);
  padding: var(--space-4) 0;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  z-index: 1000;
}

.settings-overlay.open {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), transform var(--transition-normal), visibility var(--transition-normal);
  z-index: 1001;
}

.settings-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.settings-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.settings-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  line-height: 1;
  border-radius: var(--radius-sm);
}

.settings-close:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.settings-body {
  padding: var(--space-6);
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.settings-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.settings-endpoint {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.settings-endpoint-label {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.settings-endpoint-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: var(--eci-font-family-mono);
  min-height: var(--control-height-md);
}

.settings-endpoint-input:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--action);
}

.settings-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

.hub-footer {
  text-align: center;
  padding: var(--space-8) var(--page-gutter);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-8);
}

@media (max-width: 768px) {
  .hub-hero {
    padding: var(--space-6) var(--page-gutter);
  }

  .hub-hero h1 {
    font-size: var(--font-size-2xl);
  }

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

@media (max-width: 430px) {
  .product-header {
    flex-wrap: wrap;
  }

  .product-icon {
    min-width: 100%;
    max-width: 100%;
  }
}
