/* assets/nl-ai-widget.css */

:root {
  --nl-bg: #f6f7fb;
  --nl-panel: rgba(255, 255, 255, 0.72);
  --nl-panel-strong: rgba(255, 255, 255, 0.92);
  --nl-border: rgba(14, 24, 42, 0.12);
  --nl-border-strong: rgba(14, 24, 42, 0.18);
  --nl-text: rgba(14, 24, 42, 0.92);
  --nl-subtext: rgba(14, 24, 42, 0.68);
  --nl-muted: rgba(14, 24, 42, 0.5);
  --nl-accent: rgba(31, 111, 255, 0.14);
  --nl-accent-strong: rgba(31, 111, 255, 0.22);
  --nl-shadow: 0 18px 60px rgba(10, 18, 40, 0.1);
  --nl-success: rgba(34, 197, 94, 0.95);

  --nl-mono:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --nl-sans:
    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

.nl-ai-wrap {
  max-width: 1050px;
  margin: 0 auto;
  padding: 24px 0 34px;
  color: var(--nl-text);
}

/* Input row */
.nl-ai-input {
  width: 100%;
  background: var(--nl-panel);
  border: 1px solid var(--nl-border);
  border-radius: 14px;
  padding: 18px 18px;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--nl-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nl-ai-placeholder {
  font-family: var(--nl-mono);
  font-size: 18px;
  line-height: 1.4;
  color: var(--nl-subtext);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 640px) {
  .nl-ai-input {
    padding: 16px 16px;
  }
  .nl-ai-placeholder {
    font-size: 15px;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    align-items: flex-start;
  }
  .nl-ai-caret {
    margin-top: 2px;
  }

  .nl-ai-input {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.nl-ai-caret {
  width: 10px;
  height: 22px;
  background: rgba(14, 24, 42, 0.55);
  border-radius: 2px;
  animation: nlBlink 1.05s steps(1, end) infinite;
  flex: 0 0 auto;
}

@keyframes nlBlink {
  50% {
    opacity: 0;
  }
}

/* Submit morph */
.nl-submit {
  flex: 0 0 auto;
  height: 44px;
  width: 46px;
  border-radius: 12px;
  border: 1px solid var(--nl-border);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 28px rgba(10, 18, 40, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  overflow: hidden;

  transition:
    width 560ms cubic-bezier(0.18, 0.98, 0.18, 1),
    border-radius 560ms cubic-bezier(0.18, 0.98, 0.18, 1),
    background 420ms ease,
    border-color 420ms ease;
}

.nl-submit svg {
  width: 18px;
  height: 18px;
  opacity: 0.92;
  transform: translateY(0) scale(1);
  transition:
    transform 520ms cubic-bezier(0.18, 0.98, 0.18, 1),
    opacity 380ms ease;
}

.nl-submit::after {
  content: "";
  position: absolute;
  inset: 8px 10px;
  border-radius: 999px;
  background: var(--nl-accent-strong);
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 380ms ease,
    transform 560ms cubic-bezier(0.18, 0.98, 0.18, 1);
}

.nl-submit.is-working {
  width: 108px;
  border-radius: 999px;
  border-color: rgba(31, 111, 255, 0.22);
  background: rgba(31, 111, 255, 0.1);
}

.nl-submit.is-working svg {
  opacity: 0;
  transform: translateY(2px) scale(0.88);
}

.nl-submit.is-working::after {
  opacity: 1;
  transform: scale(1);
}

.nl-submit-shape {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(2px);
  transition:
    opacity 380ms ease,
    transform 560ms cubic-bezier(0.18, 0.98, 0.18, 1);
  pointer-events: none;
}

.nl-submit.is-working .nl-submit-shape {
  opacity: 1;
  transform: translateY(0);
}

.nl-submit-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(14, 24, 42, 0.52);
  animation: nlDot 1100ms infinite ease-in-out;
}
.nl-submit-dot:nth-child(2) {
  animation-delay: 180ms;
}
.nl-submit-dot:nth-child(3) {
  animation-delay: 360ms;
}

@keyframes nlDot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-3px);
    opacity: 0.95;
  }
}

/* Card */
.nl-answer-wrap {
  margin-top: 14px;
}

.nl-answer-card {
  background: var(--nl-panel-strong);
  border: 1px solid var(--nl-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--nl-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  opacity: 0;
  transform: translateY(10px) scale(0.995);
  height: 0;

  transition:
    height 1240ms cubic-bezier(0.18, 0.98, 0.18, 1),
    opacity 920ms cubic-bezier(0.18, 0.98, 0.18, 1),
    transform 1240ms cubic-bezier(0.18, 0.98, 0.18, 1);
  will-change: height, opacity, transform;
}

.nl-answer-card.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 640px) {
  .nl-answer-card {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.nl-answer-inner {
  padding: 14px 16px 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Header row: Status + pills */
.nl-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(14, 24, 42, 0.1);
  margin-bottom: 5px;
  flex-wrap: nowrap;
  min-height: 46px;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .nl-head {
    flex-wrap: wrap;
    align-items: flex-start;
    min-height: 0;
  }
}

.nl-status {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  min-width: 127px;
}

.nl-status-label {
  font-family: var(--nl-mono);
  font-size: 12px;
  letter-spacing: 0.2px;
  color: var(--nl-muted);
}

.nl-status-value {
  font-family: var(--nl-mono);
  font-size: 12px;
  color: var(--nl-text);
  transition:
    opacity 220ms ease,
    transform 260ms ease;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}

.nl-status-value.is-fadeout {
  opacity: 0;
  transform: translateY(1px);
}

/* Thinking dots in header status */
.nl-status-dots {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 20px; /* reserves space, prevents jitter */
  margin-left: 2px;
}

.nl-status-dots span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(14, 24, 42, 0.62);
  display: inline-block;
  margin-left: 2px;
  opacity: 0.15;
  transform: translateY(0);
  animation: nlStatusDot 900ms infinite ease-in-out;
}

.nl-status-dots span:nth-child(2) {
  animation-delay: 150ms;
}
.nl-status-dots span:nth-child(3) {
  animation-delay: 300ms;
}

@keyframes nlStatusDot {
  0%,
  100% {
    opacity: 0.18;
    transform: translateY(0);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-1px);
  }
}

/* Pills */
.nl-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 240px;
  min-height: 32px;

  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nl-pills::-webkit-scrollbar {
  display: none;
}

@media (max-width: 640px) {
  .nl-pills {
    flex-wrap: wrap;
    overflow-x: visible;
    min-height: 0;
  }
}

.nl-pill-item {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  position: relative;
}

.nl-pill-item:not(:first-child)::before {
  content: "→";
  font-family: var(--nl-mono);
  font-size: 12px;
  color: rgba(14, 24, 42, 0.52);
  margin: 0 10px 0 2px;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
}

.nl-pill {
  font-family: var(--nl-mono);
  font-size: 12px;
  line-height: 1.6;
  color: rgba(14, 24, 42, 0.88);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(14, 24, 42, 0.14);
  border-radius: 999px;
  padding: 6px 13px;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(10, 18, 40, 0.1);

  opacity: 0;
  transform: translateY(7px) scale(0.96);
  filter: blur(6px);
  animation: nlPillIn 520ms cubic-bezier(0.18, 0.98, 0.18, 1) forwards;

  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

@keyframes nlPillIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.nl-pill.is-settle {
  background: rgba(14, 24, 42, 0.06);
  border-color: rgba(14, 24, 42, 0.1);
  box-shadow: none;
  transition:
    background 560ms ease,
    border-color 560ms ease,
    box-shadow 560ms ease;
}

.nl-pill:hover {
  border-color: rgba(14, 24, 42, 0.18);
}
.nl-pill:active {
  transform: translateY(1px) scale(0.99);
}
.nl-pill:focus {
  outline: none;
}
.nl-pill:focus-visible {
  box-shadow:
    0 0 0 3px rgba(31, 111, 255, 0.22),
    0 10px 24px rgba(10, 18, 40, 0.1);
}

.nl-pill.is-selected {
  background: rgba(31, 111, 255, 0.12);
  border-color: rgba(31, 111, 255, 0.26);
}

.nl-pill.is-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.nl-pill-check {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* Output */
.nl-output {
  font-family: var(--nl-mono);
  font-size: 14px;
  line-height: 1.6;
  color: rgba(14, 24, 42, 0.86);
  white-space: pre-wrap;

  flex: 1 1 auto;
  min-height: 0;

  overflow: auto;
  overscroll-behavior: auto;
  scroll-behavior: smooth;

  padding: 12px 2px 0;
  border-radius: 10px;
}

.nl-output.is-switching {
  opacity: 0;
  transform: translateY(2px);
  transition:
    opacity 220ms ease,
    transform 280ms ease;
}

.nl-output.is-switching.is-in {
  opacity: 1;
  transform: translateY(0);
}

.nl-step-label {
  margin-top: 12px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-family: var(--nl-mono);
  font-size: 12px;
  color: rgba(14, 24, 42, 0.62);
  flex: 0 0 auto;

  flex-wrap: nowrap;
  white-space: nowrap;
}

.nl-step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(31, 111, 255, 0.1);
  border: 1px solid rgba(31, 111, 255, 0.18);
  color: rgba(14, 24, 42, 0.78);

  white-space: nowrap;
  line-height: 1;
}

#nlStepName {
  line-height: 1.25;
  white-space: normal;
}

.nl-step-check {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(14, 24, 42, 0.1);
  margin-left: 6px;
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 220ms ease,
    transform 320ms cubic-bezier(0.18, 0.98, 0.18, 1);
}

.nl-step-check svg {
  width: 12px;
  height: 12px;
}

.nl-step-check.is-on {
  opacity: 1;
  transform: scale(1);
}

.nl-output.is-report {
  font-family: var(--nl-sans);
  font-size: 15px;
  color: rgba(14, 24, 42, 0.92);
  margin-top: 12px;
  padding-top: 5px;
  padding-bottom: 20px;
  white-space: normal;
}

/* Report content enter animation */
.nl-report-content {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(6px);
  transition:
    opacity 520ms cubic-bezier(0.18, 0.98, 0.18, 1),
    transform 720ms cubic-bezier(0.18, 0.98, 0.18, 1),
    filter 720ms cubic-bezier(0.18, 0.98, 0.18, 1);
  will-change: opacity, transform, filter;
}
.nl-report-content.is-in {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Report rows appear smoothly when rendered row-by-row */
.nl-report-row {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 340ms cubic-bezier(0.18, 0.98, 0.18, 1),
    transform 420ms cubic-bezier(0.18, 0.98, 0.18, 1);
}
.nl-report-row.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* Review bar */
.nl-review-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 10px;
  padding: 10px 10px;
  border: 1px solid rgba(14, 24, 42, 0.1);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  flex: 0 0 auto;
}

.nl-review-bar.is-on {
  display: flex;
}

.nl-review-title {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-family: var(--nl-mono);
  font-size: 12px;
  color: rgba(14, 24, 42, 0.72);
  min-width: 0;
}

.nl-review-title strong {
  color: rgba(14, 24, 42, 0.92);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46ch;
}

.nl-review-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(14, 24, 42, 0.12);
  background: rgba(255, 255, 255, 0.72);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  padding: 0;

  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 160ms ease;
}

.nl-review-close:hover {
  border-color: rgba(14, 24, 42, 0.18);
  background: rgba(255, 255, 255, 0.86);
}

.nl-review-close:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.78);
}

.nl-review-close:focus {
  outline: none;
}
.nl-review-close:focus-visible {
  box-shadow: 0 0 0 3px rgba(31, 111, 255, 0.22);
}

.nl-review-close svg {
  width: 14px;
  height: 14px;
}

/* Minimal report table */
.nl-report-intro {
  font-family: var(--nl-sans);
  font-size: 15px;
  line-height: 1.55;
  color: rgba(14, 24, 42, 0.92);
  margin: 0 0 10px;
}

.nl-report-actions {
  margin-top: 12px;
  font-family: var(--nl-sans);
  font-size: 15px;
  line-height: 1.55;
  color: rgba(14, 24, 42, 0.92);
}

.nl-table-wrap {
  margin-top: 10px;
  border: 1px solid rgba(14, 24, 42, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.58);
}

/* Table style reset (Elementor override shield) */
.nl-ai-wrap .nl-table-wrap table,
.nl-ai-wrap .nl-table-wrap thead,
.nl-ai-wrap .nl-table-wrap tbody,
.nl-ai-wrap .nl-table-wrap tfoot,
.nl-ai-wrap .nl-table-wrap tr,
.nl-ai-wrap .nl-table-wrap th,
.nl-ai-wrap .nl-table-wrap td,
.nl-ai-wrap .nl-table-wrap caption {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: normal !important;
  color: inherit !important;
  font: inherit !important;
  vertical-align: top !important;
  width: auto !important;
  max-width: none !important;
}

.nl-ai-wrap .nl-table-wrap table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
  table-layout: auto !important;
}

.nl-ai-wrap .nl-table-wrap th,
.nl-ai-wrap .nl-table-wrap td {
  text-align: left !important;
}

.nl-report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.nl-report-table thead th {
  text-align: left;
  font-family: var(--nl-mono);
  font-size: 11px;
  letter-spacing: 0.2px;
  color: rgba(14, 24, 42, 0.62);
  font-weight: 600;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(14, 24, 42, 0.1);
  white-space: nowrap;
}

.nl-report-table tbody td {
  padding: 11px 12px;
  font-family: var(--nl-sans);
  font-size: 13px;
  line-height: 1.45;
  color: rgba(14, 24, 42, 0.9);
  border-bottom: 1px solid rgba(14, 24, 42, 0.06);
  vertical-align: top;
}

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

.nl-report-table tbody tr:nth-child(even) td {
  background: rgba(14, 24, 42, 0.02);
}

.nl-report-table tbody tr:hover td {
  background: rgba(31, 111, 255, 0.05);
}

.nl-td-num {
  font-family: var(--nl-mono);
  font-size: 12px;
  color: rgba(14, 24, 42, 0.86);
  white-space: nowrap;
  text-align: right;
}

.nl-td-activity {
  min-width: 280px;
}

@media (max-width: 640px) {
  .nl-table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .nl-report-table {
    min-width: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nl-ai-caret {
    animation: none;
  }
  .nl-submit-dot {
    animation: none;
  }
  .nl-status-dots span {
    animation: none;
    opacity: 0.6;
    transform: none;
  }
  .nl-answer-card,
  .nl-submit,
  .nl-submit svg,
  .nl-submit::after,
  .nl-submit-shape,
  .nl-pill,
  .nl-step-check,
  .nl-report-content,
  .nl-report-row {
    transition: none;
    animation: none;
  }
  .nl-output.is-switching {
    transition: none;
    transform: none;
  }
  .nl-status-value {
    transition: none;
  }
  .nl-pill {
    opacity: 1;
    transform: none;
    filter: none;
    box-shadow: none;
  }
  .nl-output {
    scroll-behavior: auto;
  }
  .nl-report-content {
    opacity: 1;
    transform: none;
    filter: none;
  }
  .nl-report-row {
    opacity: 1;
    transform: none;
  }
}

/* Override block (wins against resets) */
.nl-ai-wrap .nl-table-wrap {
  background: rgba(255, 255, 255, 0.58) !important;
  border: 1px solid rgba(14, 24, 42, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table thead th {
  padding: 14px 14px !important;
  background: rgba(255, 255, 255, 0.82) !important;
  border-bottom: 1px solid rgba(14, 24, 42, 0.12) !important;

  font-family: var(--nl-mono) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.25px !important;
  text-transform: uppercase !important;
  color: rgba(14, 24, 42, 0.65) !important;

  vertical-align: middle !important;
  white-space: nowrap !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table tbody td {
  padding: 14px 14px !important;
  background: transparent !important;
  border-bottom: 1px solid rgba(14, 24, 42, 0.06) !important;

  font-family: var(--nl-sans) !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
  color: rgba(14, 24, 42, 0.92) !important;

  vertical-align: top !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table tbody tr:nth-child(even) td {
  background: rgba(14, 24, 42, 0.025) !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table tbody tr:hover td {
  background: rgba(31, 111, 255, 0.06) !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table td.nl-td-activity {
  font-weight: 500 !important;
  min-width: 280px !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table td.nl-td-num {
  text-align: right !important;
  font-family: var(--nl-mono) !important;
  font-size: 12px !important;
  color: rgba(14, 24, 42, 0.82) !important;
  white-space: nowrap !important;
}

.nl-ai-wrap .nl-table-wrap table.nl-report-table thead tr th:first-child {
  border-top-left-radius: 10px !important;
}
.nl-ai-wrap .nl-table-wrap table.nl-report-table thead tr th:last-child {
  border-top-right-radius: 10px !important;
}
.nl-ai-wrap
  .nl-table-wrap
  table.nl-report-table
  tbody
  tr:last-child
  td:first-child {
  border-bottom-left-radius: 10px !important;
}
.nl-ai-wrap
  .nl-table-wrap
  table.nl-report-table
  tbody
  tr:last-child
  td:last-child {
  border-bottom-right-radius: 10px !important;
}

@media (max-width: 640px) {
  .nl-ai-wrap .nl-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .nl-ai-wrap .nl-table-wrap table.nl-report-table {
    min-width: 720px !important;
  }
}

/* Hide the report table wrapper until the table is actually inserted */
.nl-table-wrap.is-hidden {
  display: none !important;
}

/* Stop pills shifting: dots do not affect layout */
.nl-status {
  flex: 0 0 150px;       /* lock column width */
  min-width: 150px;
}

.nl-status-value {
  position: relative;
  display: inline-block;
  padding-right: 26px;   /* permanently reserves room for dots */
  white-space: nowrap;
}

.nl-status-dots {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 3px;
  pointer-events: none;
}
