/* Native fallback uses fixed-width padded labels only within the AI model picker. */
#proAiModel {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Customizable native selects put the popup in the top layer, outside panel overflow clipping. */
@supports (appearance: base-select) {
  #proAiModel,
  #proAiModel::picker(select) {
    /* Preserve modern select behavior without relying on the IDE's appearance-value list. */
    --pro-ai-select-appearance: base-select;
    appearance: var(--pro-ai-select-appearance);
    font-family: inherit;
  }

  #proAiModel {
    /* Override Bootstrap's block layout so selectedcontent and the native arrow share one row. */
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    background-image: none;
    padding-right: 0.75rem;
  }

  #proAiModel > button {
    /* Allow space for the arrow even when the browser gives this button its own layout box. */
    flex: 1;
    min-width: 0;
  }

  /* The native button may be display:contents; let selectedcontent shrink in that case too. */
  #proAiModel selectedcontent {
    flex: 1;
    min-width: 0;
  }

  #proAiModel::picker-icon {
    flex-shrink: 0;
  }

  /* Both the closed selection and every option share the same right-edge price column. */
  #proAiModel selectedcontent,
  #proAiModel option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    column-gap: 0.75rem;
    width: 100%;
  }

  #proAiModel option {
    padding: 0.375rem 0.75rem;
  }

  #proAiModel option::checkmark {
    display: none;
  }

  #proAiModel .pro-ai-model-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #proAiModel .pro-ai-model-price {
    text-align: right;
    white-space: nowrap;
  }
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  padding-bottom: 60px;
}

.jd-navbar {
  background-color: #166534;
  position: relative;
  z-index: 1080;
}

.jd-navbar .navbar-brand,
.jd-navbar .nav-link,
.jd-navbar .navbar-toggler {
  color: #fff;
}

.jd-navbar .nav-link:hover,
.jd-navbar .nav-link:focus,
.jd-navbar .navbar-brand:hover,
.jd-navbar .navbar-brand:focus {
  color: #d1fae5;
}

.jd-navbar .navbar-collapse {
  position: relative;
  z-index: 1080;
}

/* Keep Bootstrap gates above the custom navbar so modal headers and close buttons stay fully visible. */
.modal-backdrop {
  z-index: 1090;
}

.modal {
  z-index: 1100;
}

.modal-content {
  position: relative;
}

/* Floating helper for long acknowledgement gates. */
.modal-scroll-bottom-btn {
  position: absolute;
  right: 1.25rem;
  bottom: 4.75rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 0.35rem 0.8rem rgba(0, 0, 0, 0.25);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.index-option-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.index-option-row:first-of-type {
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.index-option-row:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.index-option-price {
  /* Reserve a fixed price column width so shorter prices (like €0) do not shift inline inputs. */
  flex: 0 0 1.5rem;
  text-align: right;
  white-space: nowrap;
}

.index-enabled-label {
  color: #166534;
  font-weight: 700;
}

.index-option-row .form-check-input:not(:disabled) {
  border-color: #166534;
  border-width: 2px;
  opacity: 1;
}

.index-option-row .form-check-input:not(:disabled):checked {
  background-color: #166534;
  border-color: #166534;
}

.index-option-row .form-check-input:not(:disabled):focus {
  border-color: #166534;
  box-shadow: 0 0 0 0.2rem rgba(22, 101, 52, 0.2);
}

.index-coming-soon-note {
  color: #7c3aed;
  font-style: italic;
}

.index-option-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
}

.index-option-inline .form-check {
  margin-right: 0.25rem;
  flex: 1 1 auto;
}

/* Keep option input controls aligned to the right edge immediately before the price. */
.index-option-inline > .index-inline-input,
.index-option-inline > .index-inline-select,
.index-option-inline > .index-inline-controls {
  margin-left: auto;
}

/* Give the long Lost ECU label and ECU SN textbox separate columns before the price. */
.index-option-lost {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  column-gap: 0.75rem;
  align-items: center;
}

/* The Lost ECU grid owns its spacing, so the textbox should stay in the second grid column. */
.index-option-lost > .index-inline-input {
  margin-left: 0;
}

/* Keep the copied Full Mod Engine Hours textbox directly under the copied serial textbox. */
.index-option-lost > #lostFullModEngineHoursInput {
  grid-column: 2;
}

/* Keep the long ProgramOnPnMismatch label and its Part Number textbox in separate columns before the price. */
.index-option-pn-mismatch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  column-gap: 0.75rem;
  align-items: center;
}

/* The ProgramOnPnMismatch grid owns spacing, so keep the textbox fixed in its second column. */
.index-option-pn-mismatch > .index-inline-input {
  margin-left: 0;
}

/* Keep the multi-controller-hours label and textbox stack in fixed columns like other long-label options. */
.index-option-multi-hours {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem;
  column-gap: 0.75rem;
  align-items: start;
}

/* The multi-controller-hours grid owns spacing, so keep the textbox stack in its second column. */
.index-option-multi-hours > .index-multi-hours-stack {
  margin-left: 0;
}

.index-inline-input {
  width: 10rem;
  background-color: var(--bs-body-bg);
}

/* Shrink the inline hours placeholder text so longer controller labels fit inside the existing textbox width. */
.index-inline-input::placeholder {
  font-size: 0.7rem;
}

/* Hide the placeholder while the user is actively editing the inline hours fields. */
.index-inline-input:focus::placeholder {
  color: transparent;
}

/* Keep both inline hours inputs on the same background when the browser fills a suggested/autofill value. */
.index-inline-input:-webkit-autofill,
.index-inline-input:-webkit-autofill:hover,
.index-inline-input:-webkit-autofill:focus,
.index-inline-input:-webkit-autofill:active {
  background-color: var(--bs-body-bg);
  -webkit-text-fill-color: var(--bs-body-color);
  -webkit-box-shadow: 0 0 0 1000px var(--bs-body-bg) inset;
  box-shadow: 0 0 0 1000px var(--bs-body-bg) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.index-inline-select {
  width: 10rem;
}

/* Keep empty inline validation placeholders from taking flex space and shifting option textboxes left. */
.index-inline-validation:empty {
  display: none;
}

/* Give the promotional poster card a more polished ad-like presentation before upload. */
.promo-poster {
  position: relative;
  min-height: 100%;
  color: #f8fafc;
  background: linear-gradient(135deg, #0f172a 0%, #111827 48%, #1e3a8a 100%);
}

.promo-poster-accent {
  height: 0.45rem;
  background: linear-gradient(90deg, #22c55e 0%, #38bdf8 45%, #a78bfa 100%);
}

.promo-poster-body {
  position: relative;
  padding: 1.5rem;
}

.promo-poster-kicker {
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.promo-poster-title {
  color: #ffffff;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
}

.promo-poster-copy {
  max-width: 34rem;
  color: #dbeafe;
  font-size: 1rem;
}

.promo-poster-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(255, 255, 255, 0.12);
  color: #e0f2fe;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.promo-poster-list {
  margin: 0;
  padding-left: 1.15rem;
  color: #eff6ff;
}

.promo-poster-list li + li {
  margin-top: 0.55rem;
}

.promo-poster-cta {
  padding: 0.75rem 1.15rem;
  border: 0;
  border-radius: 999px;
  color: #0f172a;
  font-weight: 800;
  box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.22);
}

.promo-poster-cta:hover,
.promo-poster-cta:focus {
  color: #0f172a;
  transform: translateY(-1px);
}

.promo-poster-footnote {
  color: #bfdbfe;
  font-size: 0.9rem;
}

.promo-poster .btn-light {
  --bs-btn-bg: #e2e8f0;
  --bs-btn-hover-bg: #f8fafc;
  --bs-btn-hover-border-color: #f8fafc;
  --bs-btn-active-bg: #cbd5e1;
  --bs-btn-active-border-color: #cbd5e1;
}

@media (max-width: 767.98px) {
  .promo-poster-body {
    padding: 1.25rem;
  }

  .promo-poster-cta {
    width: 100%;
  }
}

/* Keep the multi-controller hours textboxes in a right-aligned vertical stack and align validation text with each input. */
.index-multi-hours-stack {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.index-multi-hours-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.pro-editor-card .card-body {
  display: flex;
  flex-direction: column;
}

/* Keep toolbar action buttons anchored while allowing long file names to shrink/truncate. */
.pro-editor-toolbar-row {
  min-width: 0;
}

/* Let the uploaded file name use only remaining space and shrink when needed. */
.pro-editor-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(0.78rem, 1.6vw, 1.25rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keep Undo/Redo/Maximize controls in a fixed-width, non-shrinking action block. */
.pro-editor-toolbar-actions {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pro-page {
  position: relative;
  min-height: auto;
}

/* One shared spacing value controls outer containers on Pro and Index, not their internal controls. */
.editor-container-spacing {
  --editor-container-gap: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: var(--editor-container-gap);
}

/* Use a real row gap so Bootstrap top gutters do not add extra space above the first containers. */
.editor-container-spacing > .editor-container-row {
  --bs-gutter-x: var(--editor-container-gap);
  --bs-gutter-y: 0;
  margin-top: 0;
  row-gap: var(--editor-container-gap);
}

/* Sidebar containers use the same gap in both desktop and stacked layouts. */
.editor-container-row > div > .editor-container-following {
  margin-top: var(--editor-container-gap);
}

.pro-loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(2px);
  z-index: 20;
}

.pro-loading-overlay.show {
  display: flex;
}

.pro-loading-spinner,
.pro-loading-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pro-loading-progress.d-none,
.pro-loading-spinner.d-none {
  display: none !important;
}

.pro-progress-circle {
  --progress-value: 0;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: conic-gradient(#0d6efd calc(var(--progress-value) * 1%), #dce3ea 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pro-progress-circle-inner {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
  background: #fff;
  color: #0d6efd;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pro-layout-row {
  min-height: 0;
}

/* Preserve the stacked chat viewport; desktop flex sizing below uses only the available space. */
#proAiTranscript {
  display: block;
  height: 480px;
}

/* Fit AI controls and long messages within the tab without horizontal scrolling. */
#proAiPane,
#proAiChat {
  min-width: 0;
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

/* Bootstrap row gutters must not extend the side-by-side selectors beyond the chat width. */
#proAiChat > .row {
  margin-inline: 0;
}

/* Dropdown selections stay on one line even though conversation text wraps within the tab. */
#proAiChatPicker {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}

/* Let saved-chat names shrink beside their delete icons without widening the menu. */
#proAiChatMenu .dropdown-item {
  min-width: 0;
}

/* Override Bootstrap's overflow-auto utility only on the transcript's horizontal axis. */
#proAiTranscript {
  min-width: 0;
  overflow-x: hidden !important;
  overflow-wrap: anywhere;
}

/* Keep these processing dots animated even with reduced motion, as explicitly requested; other animations are unchanged. */
.pro-ai-status-dots {
  display: inline-flex;
  gap: 0.12em;
  /* Enlarge only the leading dots, keeping the status label's typography unchanged. */
  margin-inline-end: 0.4em;
  font-size: 1.75em;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.pro-ai-status-dots > span {
  animation: pro-ai-status-jump 1.2s ease-in-out infinite;
}

.pro-ai-status-dots > span:nth-child(2) { animation-delay: 0.15s; }
.pro-ai-status-dots > span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pro-ai-status-jump {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-0.3em); }
}

/* Keep File Details rows inside the tab instead of overflowing through Bootstrap's negative gutters. */
#proDetailsPane > .row {
  margin-inline: 0;
}

/* Long identifiers wrap within File Details; horizontal scrolling is unnecessary in this pane. */
#proDetailsPane {
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

/* Contain both xl columns above the footer without changing the stacked or fullscreen layout. */
@media (min-width: 1200px) {
  .pro-viewport-panels > .pro-sidebar-column,
  .pro-viewport-panels > .pro-editor-column {
    height: var(--pro-panel-height);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Keep the upload controls at their content height as zoom changes; the details panel shrinks instead. */
  .pro-viewport-panels .pro-upload-card {
    flex: 0 0 auto;
    min-width: 0;
  }

  .pro-viewport-panels .pro-sidebar-panel,
  .pro-viewport-panels .pro-editor-card,
  .pro-viewport-panels .pro-editor-card > .card-body {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
  }

  /* Tabs and editor tools retain their natural size; their content owns the scrollbars. */
  .pro-viewport-panels .pro-sidebar-panel > .nav,
  .pro-viewport-panels .pro-editor-card > .card-body > :not(.pro-editor) {
    flex-shrink: 0;
  }

  .pro-viewport-panels .pro-sidebar-panel > .tab-content {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    /* Sidebar tabs retain vertical scrolling without an outer horizontal scrollbar. */
    min-width: 0;
    overflow-x: hidden;
  }

  .pro-viewport-panels #proAiPane,
  .pro-viewport-panels #proAiChat {
    height: 100%;
    min-height: 0;
  }

  .pro-viewport-panels #proAiChat {
    display: flex;
    flex-direction: column;
  }

  .pro-viewport-panels #proAiChat > :not(#proAiTranscript) {
    flex-shrink: 0;
  }

  /* History shrinks first; very short windows scroll the tab so the composer remains reachable. */
  .pro-viewport-panels #proAiTranscript {
    flex: 1 0 96px;
    height: auto;
    min-height: 96px;
  }

  .pro-viewport-panels .pro-editor {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
  }

  .pro-viewport-panels .promo-poster {
    min-height: 0;
    overflow: auto;
  }
}

.pro-editor {
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  height: 100%;
  min-height: 20rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  background-color: var(--bs-body-bg);
}

.pro-editor-toggle {
  line-height: 1;
  min-width: 2rem;
  padding-inline: 0.5rem;
}

.pro-editor-toggle-icon {
  display: inline-block;
  font-size: 1rem;
}

.pro-editor-toolbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.pro-cursor-info-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.1rem;
}

.pro-cursor-location-label {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  display: inline-block;
  cursor: pointer;
  user-select: text;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.pro-selection-size-label {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  display: inline-block;
  user-select: text;
  margin-top: 2px;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .pro-cursor-info-block {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
  }

  .pro-selection-size-label::before {
    content: "|";
    margin-right: 0.4rem;
    color: var(--bs-secondary-color, #6c757d);
  }
}

.pro-editor-history-btn:disabled {
  opacity: 0.65;
}

.pro-editor-status-success {
  color: #198754;
}

.pro-editor-status-error {
  color: #dc3545;
}

.pro-editor-status-info {
  color: #0d6efd;
}

/* Match the Fix Header Sizes button to the navbar green before header-size-relevant edits occur. */
.pro-fix-header-sizes-btn {
  color: #166534;
  border-color: #166534;
}

/* Keep the three PRO file action buttons equal in width/height and auto-shrink label text to fit one line. */
.pro-file-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(1.5em + .75rem + 2px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-size: clamp(0.58rem, 1.35vw, 1rem);
  line-height: 1.2;
}

/* Keep the default hover state aligned with the navbar green styling. */
.pro-fix-header-sizes-btn:hover,
.pro-fix-header-sizes-btn:focus,
.pro-fix-header-sizes-btn:active {
  color: #fff;
  background-color: #166534;
  border-color: #166534;
}

/* Use a red warning state after inserts or deletes indicate header sizes may need fixing. */
.pro-fix-header-sizes-btn.pro-fix-header-sizes-btn-alert {
  color: #dc3545;
  border-color: #dc3545;
}

/* Preserve the red warning treatment while the user hovers or focuses the alert state. */
.pro-fix-header-sizes-btn.pro-fix-header-sizes-btn-alert:hover,
.pro-fix-header-sizes-btn.pro-fix-header-sizes-btn-alert:focus,
.pro-fix-header-sizes-btn.pro-fix-header-sizes-btn-alert:active {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}

/* Match the login trial notice's red text while retaining the countdown's bold weight. */
.pro-free-trial-label {
  color: #dc3545;
  font-weight: 700;
}

/* Give only the AI tab's New stamp a glossy gold finish, without motion or changes to other controls. */
.pro-ai-new-badge {
  color: #5b3d00;
  background: linear-gradient(135deg, #fff8d6 0%, #ffd454 40%, #fff3b0 52%, #f4b400 100%);
  border: 1px solid #d69d00;
  box-shadow: 0 0 0.45rem rgba(244, 180, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: rotate(-8deg);
}

.pro-layout-row.pro-editor-maximized {
  --bs-gutter-x: 0;
}

/* In PRO fullscreen mode, pin the editor column above global layout chrome and use the full viewport area. */
html.pro-editor-fullscreen-active,
body.pro-editor-fullscreen-active {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Keep the fullscreen Monaco container fixed so it can consume navbar/footer/support line space. */
.pro-editor-column.pro-editor-column-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  margin: 0;
  padding: 0.75rem;
  background: var(--bs-body-bg, #fff);
  touch-action: none;
  overscroll-behavior: none;
}

/* Ensure the card and body inside the fullscreen column stretch to full height. */
.pro-editor-column.pro-editor-column-fullscreen .pro-editor-card,
.pro-editor-column.pro-editor-column-fullscreen .card-body {
  height: 100%;
}

/* Remove default viewport-based minimum heights in fullscreen so Monaco can shrink with the mobile keyboard. */
.pro-editor-column.pro-editor-column-fullscreen .pro-editor {
  min-height: 0;
  height: 100%;
}

/* Keep Monaco's own pointer handling authoritative during fullscreen drag operations on touch devices. */
.pro-editor-column.pro-editor-column-fullscreen .pro-editor,
.pro-editor-column.pro-editor-column-fullscreen .monaco-editor,
.pro-editor-column.pro-editor-column-fullscreen .monaco-editor .overflow-guard {
  touch-action: none;
  overscroll-behavior: none;
}

@media (max-width: 767.98px) {
  .index-option-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .jd-navbar .navbar-collapse {
    background-color: #166534;
  }

  /* Keep a small gap under the toggler so the expanded mobile menu does not cover the button edge. */
  .jd-navbar .navbar-collapse.show,
  .jd-navbar .navbar-collapse.collapsing {
    margin-top: 0.35rem;
  }

  .index-option-price {
    margin-left: 1.5rem;
  }

  .index-inline-input,
  .index-inline-select {
    width: 100%;
  }

  .pro-editor {
    min-height: 20rem;
  }

}