/* Configuration action buttons (dock footer) and the saved-configurations dialog. */
.action-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ui-ink-2);
  font-family: var(--font-sans);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease;
}

.action-button:hover,
.action-button.active {
  color: var(--ui-accent-text);
}

.action-button:focus-visible {
  outline: 2px solid var(--ui-ring);
  outline-offset: 2px;
}

.action-button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.action-caret {
  font-size: 9px;
}

/* Total (mockup): muted label, large amount. */
.config-info-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.config-total-price {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--ui-ink);
  font-variant-numeric: tabular-nums;
}

.config-total-amount {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.config-total-meta {
  color: var(--ui-mute);
  font-size: 11px;
}

.shared-config-readonly .shared-readonly-locked {
  cursor: not-allowed !important;
  opacity: 0.42 !important;
}

.shared-config-readonly .variant-item.active,
.shared-config-readonly .variant-item.primary-active,
.shared-config-readonly .color-swatch.selected,
.shared-config-readonly .accessory-item.selected {
  opacity: 1 !important;
}

/* Load menu (mockup ".menu"): saved configurations above the Load action. */
.load-menu {
  position: absolute;
  right: 26px;
  bottom: calc(100% - 12px);
  z-index: 5;
  width: min(300px, calc(100% - 52px));
  padding: 6px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow-lg);
}

.load-menu[hidden] {
  display: none;
}

.saved-configs {
  display: grid;
  max-height: min(50vh, 320px);
  overflow-y: auto;
}

.saved-empty {
  margin: 0;
  padding: 10px 12px;
  color: var(--ui-mute);
  font-size: 13px;
  line-height: 1.45;
}

.saved-item {
  display: flex;
  align-items: center;
  border-radius: 10px;
}

.saved-item:hover {
  background: var(--ui-hover);
}

.saved-item-delete {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ui-mute);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

:is(.saved-item-btn, .saved-item-delete):focus-visible {
  outline: 2px solid var(--ui-ring);
  outline-offset: -2px;
}

/* ================================
   INFO PANE (mockup specs): section titles, then label/value rows
   ================================ */
#product-info {
  margin-bottom: 22px;
}

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

.dock-info td {
  padding: 10px 0;
  border-top: 1px solid var(--ui-line);
  color: var(--ui-ink);
  font-size: 14px;
  vertical-align: baseline;
}

#product-info td:first-child {
  padding-right: 12px;
  color: var(--ui-mute);
}

#partsTable td.parts-group-title-cell {
  padding: 18px 0 6px;
  border-top: 0;
}

#partsTable tr:first-child td.parts-group-title-cell {
  padding-top: 0;
}

.parts-group-title {
  font-size: 13px;
  font-weight: 700;
}

.parts-item-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.parts-row-subtitle {
  min-width: 0;
  overflow-wrap: anywhere;
}

#partsTable tr.detail-row .parts-row-subtitle {
  padding-left: 12px;
  color: var(--ui-mute);
}

/* PROFILER HUD (internal tool, tabbed window): keeps its own dark palette. */
.profiler-hud {
  position: fixed;
  top: calc(var(--header-h) + 16px);
  right: 16px;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--header-h) - var(--safe-bottom) - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(166, 197, 216, 0.18);
  background: linear-gradient(180deg, #1a2330, #0c1118);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  z-index: var(--z-modal);
  overflow: hidden;
  pointer-events: auto;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: #eef5fb;
}

.profiler-hud.hidden {
  display: none;
}

.profiler-hud__header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(166, 197, 216, 0.1);
  background: #070b10;
}

.profiler-hud__tabs {
  display: flex;
  gap: 6px;
  align-items: center;
}

.profiler-hud__tab {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid rgba(166, 197, 216, 0.12);
  background: rgba(7, 11, 16, 0.35);
  color: rgba(224, 235, 244, 0.65);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.profiler-hud__tab:hover {
  background: rgba(122, 225, 186, 0.06);
  color: #eef5fb;
}

.profiler-hud__tab[aria-selected="true"] {
  background: rgba(122, 225, 186, 0.12);
  border-color: rgba(122, 225, 186, 0.4);
  color: #d8fff1;
}

.profiler-hud__body {
  padding: 14px;
  overflow: auto;
  scrollbar-width: thin;
}

.profiler-hud__body::-webkit-scrollbar { width: 6px; }
.profiler-hud__body::-webkit-scrollbar-thumb {
  background: rgba(166, 197, 216, 0.2);
  border-radius: 3px;
}

.profiler-hud__pane {
  display: none;
}

.profiler-hud__pane.is-active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Metric cards (FPS, DC, VRAM) --- */
#profiler-hud #fps-meter,
#profiler-hud #drawcall-meter,
#profiler-hud #res-meter,
#profiler-hud #vram-meter {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  width: 100%;
  max-width: none;
  pointer-events: auto;
  margin: 0;
  border: 1px solid rgba(166, 197, 216, 0.14);
  background: linear-gradient(180deg, #1a2330, #0c1118);
  border-radius: 14px;
  padding: 12px 14px;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  color: #eef5fb;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

#profiler-hud #fps-meter {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#profiler-hud #fps-meter::before {
  content: "FPS";
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(224, 235, 244, 0.5);
  text-transform: uppercase;
  align-self: center;
}

#profiler-hud #drawcall-meter {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  white-space: nowrap;
  transition: border-color 0.2s ease;
}

#profiler-hud #drawcall-meter:hover {
  border-color: rgba(122, 225, 186, 0.3);
}

#drawcall-meter .drawcall-main {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  font-size: 16px;
}

#drawcall-meter .drawcall-main::before {
  content: "DC";
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(224, 235, 244, 0.5);
  text-transform: uppercase;
  align-self: center;
}

#drawcall-meter .drawcall-sub {
  opacity: 0.55;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
}

#drawcall-meter .drawcalls-breakdown {
  margin: 0;
  padding: 10px 12px;
  background: #070b10;
  border: 1px solid rgba(166, 197, 216, 0.08);
  border-radius: 10px;
  white-space: pre;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(224, 235, 244, 0.75);
  width: 100%;
  max-height: min(240px, calc(100vh - 360px));
  overflow: auto;
}

#profiler-hud #res-meter {
  font-size: 11px;
  font-weight: 600;
  color: rgba(224, 235, 244, 0.7);
  letter-spacing: 0.02em;
}

#profiler-hud #vram-meter {
  font-size: 11px;
  font-weight: 600;
  white-space: pre-wrap;
  max-height: none;
  line-height: 1.6;
  color: rgba(224, 235, 244, 0.85);
}

.profiler-texgrid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.profiler-card {
  border: 1px solid rgba(166, 197, 216, 0.14);
  border-radius: 14px;
  background: linear-gradient(180deg, #1a2330, #0c1118);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.profiler-card__title {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(224, 235, 244, 0.55);
}

.profiler-card__title--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profiler-card__heading {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.profiler-card__heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profiler-card__actions {
  display: inline-flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.profiler-card__collapse {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(166, 197, 216, 0.16);
  border-radius: 6px;
  background: rgba(7, 11, 16, 0.42);
  cursor: pointer;
}

.profiler-card__collapse::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(216, 255, 241, 0.82);
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.profiler-card__collapse:hover {
  border-color: rgba(122, 225, 186, 0.36);
  background: rgba(122, 225, 186, 0.08);
}

.profiler-card.is-collapsed .profiler-card__collapse::before {
  transform: rotate(-90deg);
}

.profiler-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profiler-card.is-collapsed .profiler-card__body {
  display: none;
}

.profiler-card__summary {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  color: rgba(224, 235, 244, 0.7);
  white-space: pre-wrap;
  line-height: 1.55;
}

.profiler-texture-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profiler-texture-system {
  border: 1px solid rgba(166, 197, 216, 0.1);
  border-radius: 8px;
  background: rgba(7, 11, 16, 0.48);
  padding: 8px 10px;
  color: rgba(224, 235, 244, 0.78);
}

.profiler-budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.profiler-budget-card {
  min-width: 0;
  border: 1px solid rgba(166, 197, 216, 0.12);
  border-radius: 8px;
  background: #0b1219;
  padding: 9px 10px;
}

.profiler-budget-card.is-total {
  border-color: rgba(122, 225, 186, 0.32);
  background: rgba(16, 42, 36, 0.42);
}

.profiler-budget-card.is-cache {
  border-color: rgba(244, 190, 104, 0.28);
  background: rgba(44, 31, 13, 0.34);
}

.profiler-budget-card.is-estimate {
  border-color: rgba(166, 197, 216, 0.16);
  background: rgba(18, 26, 36, 0.6);
}

.profiler-budget-card__label {
  overflow: hidden;
  color: rgba(224, 235, 244, 0.56);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.profiler-budget-card__value {
  margin-top: 5px;
  color: #eef5fb;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
}

.profiler-budget-card__meta {
  margin-top: 2px;
  color: rgba(224, 235, 244, 0.52);
  font-size: 10px;
  font-weight: 700;
}

.profiler-estimate-breakdown {
  border: 1px solid rgba(166, 197, 216, 0.12);
  border-radius: 8px;
  background: rgba(7, 11, 16, 0.42);
  padding: 8px 10px;
}

.profiler-estimate-breakdown__title {
  color: rgba(224, 235, 244, 0.62);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profiler-estimate-breakdown__list {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.profiler-estimate-breakdown__row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(72px, auto) minmax(180px, 2fr);
  gap: 10px;
  align-items: baseline;
  min-width: 0;
  color: rgba(224, 235, 244, 0.7);
  font-size: 10px;
  font-weight: 700;
}

.profiler-estimate-breakdown__section,
.profiler-estimate-breakdown__note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profiler-estimate-breakdown__bytes {
  color: #eef5fb;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.profiler-estimate-breakdown__note {
  color: rgba(224, 235, 244, 0.48);
  font-weight: 650;
}

.profiler-warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profiler-warning,
.profiler-warnings.is-empty {
  border: 1px solid rgba(244, 190, 104, 0.24);
  border-radius: 8px;
  background: rgba(44, 31, 13, 0.34);
  padding: 8px 10px;
  color: rgba(255, 226, 176, 0.92);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
}

.profiler-warnings.is-empty {
  border-color: rgba(122, 225, 186, 0.2);
  background: rgba(16, 42, 36, 0.32);
  color: rgba(216, 255, 241, 0.74);
}

.profiler-subtabs {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.profiler-export-button {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid rgba(122, 225, 186, 0.26);
  border-radius: 7px;
  background: rgba(122, 225, 186, 0.09);
  color: rgba(216, 255, 241, 0.86);
  cursor: pointer;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.profiler-export-button:hover {
  border-color: rgba(122, 225, 186, 0.44);
  background: rgba(122, 225, 186, 0.15);
}

.profiler-export-button:disabled {
  cursor: default;
  opacity: 0.42;
  border-color: rgba(166, 197, 216, 0.12);
  background: rgba(7, 11, 16, 0.35);
  color: rgba(224, 235, 244, 0.52);
}

.profiler-subtab {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid rgba(166, 197, 216, 0.12);
  background: rgba(7, 11, 16, 0.35);
  color: rgba(224, 235, 244, 0.6);
  border-radius: 999px;
  padding: 3px 10px;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.profiler-subtab:hover {
  color: #eef5fb;
  background: rgba(122, 225, 186, 0.06);
}

.profiler-subtab[aria-selected="true"] {
  color: #d8fff1;
  border-color: rgba(122, 225, 186, 0.4);
  background: rgba(122, 225, 186, 0.12);
}

.profiler-table {
  overflow: auto;
  max-height: min(46dvh, 520px);
  border-radius: 10px;
  border: 1px solid rgba(166, 197, 216, 0.1);
  background: #070b10;
  scrollbar-width: thin;
}

.profiler-table::-webkit-scrollbar { width: 6px; height: 6px; }
.profiler-table::-webkit-scrollbar-thumb {
  background: rgba(166, 197, 216, 0.2);
  border-radius: 3px;
}

.profiler-table table {
  width: 100%;
  border-collapse: collapse;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
}

.profiler-table th,
.profiler-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(166, 197, 216, 0.06);
  vertical-align: top;
}

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

.profiler-table tbody tr:hover {
  background: rgba(122, 225, 186, 0.04);
}

.profiler-table th {
  position: sticky;
  top: 0;
  background: #070b10;
  color: rgba(224, 235, 244, 0.55);
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 1;
}

.profiler-table td {
  color: rgba(224, 235, 244, 0.85);
  font-weight: 500;
}

.profiler-table td.num,
.profiler-table th.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.profiler-table td.num {
  color: rgba(224, 235, 244, 0.95);
  font-weight: 600;
}

.profiler-table td.name {
  word-break: break-word;
  color: rgba(224, 235, 244, 0.75);
}

.profiler-table td.status {
  color: rgba(216, 255, 241, 0.82);
  font-weight: 700;
}

.profiler-empty-state {
  border-top: 1px solid rgba(166, 197, 216, 0.06);
  color: rgba(224, 235, 244, 0.58);
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 10px 12px;
}

/* Hidden state for all profiler meters */
#fps-meter.hidden,
#drawcall-meter.hidden,
#res-meter.hidden,
#vram-meter.hidden {
  display: none;
  pointer-events: none;
}
