/*! qog-add-line core 1.2.0 — canonical source: director hub shared/add-line. Do not edit in a plugin. */
/* ═══════════════════════════════════════════════════════════════════════
 *  "Add another line" entry rows and typeahead (My order view)
 *  Colours come from the platform's --qog-* variables only; no platform ids.
 * ═══════════════════════════════════════════════════════════════════════ */

/* Invoice layout: the grid collapses to its rows, so the AG theme's reserved
   heights would leave an empty gap under a short order. The platform container
   loses its fixed height from the core's JS. */
.qog-order-mode:not(.qog-fullscreen) .ag-root-wrapper,
.qog-order-mode:not(.qog-fullscreen) .ag-body,
.qog-order-mode:not(.qog-fullscreen) .ag-body-viewport,
.qog-order-mode:not(.qog-fullscreen) .ag-center-cols-viewport {
  min-height: 0 !important;
}

/* In My order the entry line is always there, so "no rows" is never the whole story. */
.qog-order-view .ag-overlay-no-rows-wrapper,
.qog-order-view .ag-overlay-no-matching-rows-wrapper {
  display: none !important;
}

/* "+ Add another line" below the grid */
.qog-add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  padding: 8px 16px;
  border: 1px dashed var(--qog-primary, #1a1a1a);
  border-radius: var(--qog-border-radius, 4px);
  background: transparent;
  color: var(--qog-primary, #1a1a1a);
  font-size: var(--qog-font-size, 14px);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.qog-add-row-btn[hidden] { display: none; }
.qog-add-row-btn:hover,
.qog-add-row-btn:focus-visible {
  background: color-mix(in srgb, var(--qog-primary, #1a1a1a) 8%, transparent);
}
.qog-add-row-btn svg { flex: 0 0 auto; }

/* Entry row */
.ag-row.qog-entry-row {
  background: color-mix(in srgb, var(--qog-primary, #4472C4) 4%, #fff);
}
.qog-entry-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: #6c757d;
  font-style: italic;
  cursor: text;
}
.qog-entry-placeholder:focus-visible {
  outline: 2px solid var(--qog-primary, #4472C4);
  outline-offset: 2px;
}
.qog-entry-placeholder svg { flex: 0 0 auto; opacity: 0.6; }

/* Typeahead editor */
.qog-typeahead {
  position: relative;
  min-width: 260px;
}
.qog-typeahead-input {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 2px solid var(--qog-primary, #4472C4);
  border-radius: 3px;
  font-size: var(--qog-font-size, 14px);
  outline: none;
}
.qog-typeahead-list {
  /* position, left, width, top and bottom are set inline (position: fixed) so the list
     escapes the autoHeight grid's overflow and stacking context. */
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  z-index: 100000;
}
.qog-typeahead-list.qog-typeahead-list-up {
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.15);
}
.qog-typeahead-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f3f5;
  cursor: pointer;
}
.qog-typeahead-item:last-child { border-bottom: none; }
.qog-typeahead-item.is-active,
.qog-typeahead-item:hover:not(.is-disabled) {
  background: color-mix(in srgb, var(--qog-primary, #4472C4) 10%, #fff);
}
.qog-typeahead-item.is-disabled { opacity: 0.5; cursor: not-allowed; }
.qog-typeahead-thumb {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: #f8f9fa;
  object-fit: contain;
}
.qog-typeahead-thumb-empty { display: inline-block; }
.qog-typeahead-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}
.qog-typeahead-title,
.qog-typeahead-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qog-typeahead-title { font-size: 13px; font-weight: 600; }
.qog-typeahead-meta { font-size: 11px; color: #6c757d; }
.qog-typeahead-title strong,
.qog-typeahead-meta strong {
  color: var(--qog-primary, #1a1a1a);
  font-weight: 700;
}
.qog-typeahead-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}
.qog-typeahead-price { font-size: 13px; font-weight: 600; white-space: nowrap; }
.qog-typeahead-stock { font-size: 11px; font-weight: 500; }
.qog-stk-ok { color: #157347; }
.qog-stk-out { color: #b02a37; }
.qog-typeahead-tag {
  padding: 1px 8px;
  border: 1px solid #f5c2c7;
  border-radius: 10px;
  background: #fff5f5;
  color: #b02a37;
  font-size: 11px;
  white-space: nowrap;
}
.qog-typeahead-mt {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: #eef1f4;
  color: #495057;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.qog-typeahead-empty,
.qog-typeahead-more {
  padding: 8px 10px;
  color: #6c757d;
  text-align: center;
}
.qog-typeahead-empty { font-size: 13px; }
.qog-typeahead-more {
  font-size: 12px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.qog-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .qog-add-row-btn { transition: none; }
}
