/* =====================================================================
   Fable5 app skin — Box owner workspace (BoxOwnerView + _BoxOwner* partials).
   Token-driven; loads after tokens.css + brand.css + app.css.
   Also carries the styles migrated out of BoxOwnerView's former inline
   <style> block and style="" attributes (QR modal, AI summary states).
   ===================================================================== */

/* ---- page header ---- */
.box-owner-header {
  background: var(--surface-0);
  border-bottom: 1px solid var(--line);
}
.box-owner-header .header-body {
  border-bottom: 0;
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
}
.box-owner-header .header-title {
  font-size: var(--text-2xl);
  letter-spacing: var(--tracking-display);
  margin-bottom: 0;
}
.box-owner-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}
.box-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  white-space: nowrap;
}
.box-status-chip.box-status-archived {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, white);
  border-color: color-mix(in srgb, var(--warning) 30%, white);
}
.box-owner-actions .btn-secondary {
  background: var(--surface-0);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.box-owner-actions .btn-secondary:hover,
.box-owner-actions .btn-secondary:focus,
.box-owner-actions .btn-secondary:active {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
}

/* ---- share bar ---- */
.share-bar .share-bar-body {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.share-bar-heading { display: flex; align-items: baseline; gap: var(--space-3); }
.share-bar-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.share-bar-url-group {
  flex: 1 1 260px;
  display: flex;
  min-width: 220px;
}
.share-bar-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.share-bar-url:focus { background: var(--surface-0); }
.share-bar-copy {
  border: 1px solid var(--line);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface-0);
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.share-bar-copy:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-300); }
.share-bar-items { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.share-bar-item {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-0);
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.share-bar-item:hover {
  border-color: var(--brand-300);
  background: var(--brand-50);
  color: var(--brand-700);
  transform: translateY(-1px);
}
/* labeled pill variant: icon + text, for the less-obvious QR / Embed actions */
.share-bar-item-labeled {
  width: auto;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

/* ---- empty state ---- */
.box-empty-state { text-align: center; padding: var(--space-12) var(--space-6); }
.box-empty-state h2, .box-empty-state h3 { letter-spacing: var(--tracking-tight); }
.box-empty-share-url {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  margin-top: var(--space-2);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.box-empty-share-url .fe-copy { color: var(--brand-600); }
.box-empty-share-url .fe-copy:hover { color: var(--brand-700); }
.box-empty-divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-10) auto;
  max-width: 420px;
}

/* ---- AI insights card (Pro) ---- */
.ai-insights-card { border-top: 2px solid var(--brand-accent); }
.ai-insights-card .card-title { font-weight: 700; color: var(--ink-1); }
.ai-collapse-toggle { color: var(--ink-3); font-size: 1.2rem; }
.ai-collapse-toggle:hover { color: var(--ink-1); }
.sentiment-progress-bar .progress { height: 24px; }
.sentiment-progress-bar .progress-bar { width: 0%; }
/* skeleton line widths (migrated from inline styles) */
.ai-loading-skeleton .skeleton-line:nth-child(2) { width: 90%; }
.ai-loading-skeleton .skeleton-line:nth-child(3) { width: 80%; }
/* summary content + error start hidden; page JS fades them in */
#aiSummaryContent { display: none; }
#aiSummaryError { display: none; }
/* collapsed teaser strip starts hidden; page JS fades it in */
#aiTeaserCollapsed { display: none; }

/* ---- locked AI affordances ---- */
.ai-unlock-trigger { cursor: pointer; }

/* ---- filter tabs ---- */
.filterContainer .nav-tabs .nav-link {
  border: 0;
  border-radius: var(--radius-full);
  padding: 5px 11px;
  margin-right: 2px;
  color: var(--ink-3);
  font-weight: 500;
  font-size: var(--text-sm);
  white-space: nowrap;
}

/* seam that sets the AI sentiment toggles apart as their own group */
.filterContainer .filter-ai-divider {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding-left: var(--space-3);
  margin-left: var(--space-2);
  border-left: 1px solid var(--line);
}
.filterContainer .filter-ai-divider .fe-zap {
  color: var(--brand-accent);
  font-size: var(--text-sm);
}
.filterContainer .nav-tabs .nav-link:hover { color: var(--ink-1); background: var(--surface-2); }
.filterContainer .nav-tabs .nav-link.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.filterContainer .nav-tabs .nav-link.ai-filter.active {
  background: color-mix(in srgb, var(--brand-accent) 10%, white);
  color: var(--brand-accent);
}
.filterContainer .badge.bg-secondary-soft {
  background: var(--surface-2) !important;
  color: var(--ink-3) !important;
}
.filterContainer .nav-tabs .nav-link.active .badge.bg-secondary-soft {
  background: var(--surface-0) !important;
  color: var(--brand-700) !important;
}
.filterContainer .badge.bg-ai {
  color: var(--brand-accent) !important;
  font-weight: 600;
}

/* ---- filter tabs ---- */
/* .header-tabs is a Landkit card-header helper; its -1.5rem bottom margin drags
   the suggestion card up over the tabs when the tabs are used standalone here. */
.filterContainer .header-tabs { margin-bottom: 0; }

/* ---- suggestion list / cards ---- */
.suggestionContainer .card-body { padding-top: 0; padding-bottom: 0; }
/* Inner meta/content/action rows use Bootstrap .row (negative gutters), but the
   comment has no side padding to absorb them, so the bare .suggestion-content sat
   12px left of the timeago. Zero the gutters so every row aligns to the card edge. */
.suggestion-card-body .row { margin-left: 0; margin-right: 0; }
.suggestion-card-body .row > * { padding-left: 0; padding-right: 0; }
.suggestionContainer .comment {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.suggestionContainer .comment:last-child { border-bottom: 0; }
/* legacy .comment-body adds its own padding (16px vertical, 20px horizontal)
   and a grey background (#F9FBFD). Zero the padding — the .comment owns the
   rhythm — and drop the background so the list reads as an airy feed on white
   rather than a stack of grey cards. */
.suggestion-card-body { margin: 0; padding: 0; background: transparent; }
.suggestion-meta { margin-bottom: var(--space-2); }
.suggestion-time {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-3);
}

/* sentiment: a small colored dot + label inline with the timestamp, instead of
   a heavy pill. The dot color comes from the card's sentiment class (a JS filter
   hook), scoped to the dot so it can't tint the whole row. */
.suggestion-sentiment {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.suggestion-sentiment-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--ink-3);
  flex: none;
}
.suggestion-card.sentiment-positive .suggestion-sentiment-dot { background: var(--success); }
.suggestion-card.sentiment-negative .suggestion-sentiment-dot { background: var(--danger); }
.suggestion-card.sentiment-mixed   .suggestion-sentiment-dot,
.suggestion-card.sentiment-neutral .suggestion-sentiment-dot { background: var(--warning); }
.suggestion-card.sentiment-positive .suggestion-sentiment-chip { color: #0F7A47; }
.suggestion-card.sentiment-negative .suggestion-sentiment-chip { color: #B42318; }
.suggestion-card.sentiment-mixed   .suggestion-sentiment-chip,
.suggestion-card.sentiment-neutral .suggestion-sentiment-chip { color: #B54708; }
/* non-Pro locked variant keeps the accent + padlock */
.suggestion-sentiment-locked { color: var(--brand-accent); cursor: pointer; }
.suggestion-sentiment-locked .fe { font-size: 12px; }
.suggestion-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--ink-1);
  font-size: var(--text-base);
  line-height: 1.6;
}

/* reply/comment thread: the owner's response, indented behind a hairline.
   Styles both the server-rendered reply and the one appended by updateReply();
   both now use a bare .suggestion-reply (no Bootstrap col/ml-4), so the indent
   lives entirely here and never stacks. */
.suggestionContainer .suggestion-reply {
  border-left: 2px solid var(--line);
  margin: var(--space-3) 0 0;
  padding: var(--space-1) 0 var(--space-1) var(--space-4);
  color: var(--ink-2);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.suggestion-reply-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--space-1);
}
/* pre-wrap lives ONLY on the response text, never the container — otherwise the
   markup whitespace/newline before @Model.Response gets preserved as a blank
   line and pushes the reply text right. */
.suggestion-reply-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* action toolbar: right-aligned, muted — recedes until needed but stays one tap
   away. Smaller and lower-contrast than before so the content leads. */
.suggestion-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  color: var(--ink-3);
}
.suggestion-actions .hand,
.suggestion-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  opacity: .65;
  transition: background var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.suggestion-actions .hand:hover,
.suggestion-actions > a:hover { background: var(--surface-2); opacity: 1; }
.suggestion-actions .fe { font-size: .9rem; color: var(--ink-3); transition: color var(--dur-fast) var(--ease-out); }
.suggestion-actions .hand:hover .fe, .suggestion-actions a:hover .fe { color: var(--brand-600); }
/* starred / archived stay clearly on, at full strength */
.suggestionContainer .on { color: var(--success); }
.suggestion-actions .hand .on { opacity: 1; }
.suggestion-actions .star .fe, .suggestionContainer .comment.star .starButton { color: var(--warning); }

/* reply composer */
.suggestion-reply-pane { margin-top: var(--space-3); }
.suggestion-reply-note {
  font-size: var(--text-xs);
  color: var(--ink-3);
  line-height: 1.5;
  margin: var(--space-2) 0 var(--space-3);
}
.suggestion-reply-note .fw-bold { color: var(--ink-2); }
.suggestion-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* sort control: right-aligned on the filter row (desktop) and below the tabs
   (mobile), never crushed into the tab row. app.css hides the shared
   .listing-sort under 767px (for the box listing); keep it shown here — the
   suggestion feed wants sort on mobile — via the more specific selector. */
.suggestion-sort .listing-sort { display: inline-flex; justify-content: flex-end; }
@media (max-width: 991.98px) {
  .filterContainer .suggestion-sort { margin-top: var(--space-2); }
  .suggestion-sort .listing-sort { width: 100%; }
}

/* mobile: bigger tap targets; composer buttons go full-width and wrap */
@media (max-width: 575.98px) {
  .suggestion-actions { gap: var(--space-2); }
  .suggestion-actions .hand,
  .suggestion-actions > a { width: 40px; height: 40px; }
  .suggestionContainer .suggestion-reply { padding-left: var(--space-3); }
  .suggestion-reply-actions { flex-direction: column-reverse; }
  .suggestion-reply-actions .btn { width: 100%; }
}

/* =====================================================================
   QR code modal (migrated from BoxOwnerView's inline <style> block)
   ===================================================================== */
.qr-code-wrapper {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: inline-block;
  box-shadow: var(--shadow-2);
}

#qrCodeCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

#qrCodeImage { max-width: 200px; max-height: 200px; }

#qrCodeModal .modal-body { padding: var(--space-8); }

#qrCodeModal .input-group input {
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2);
  background: var(--surface-2);
}

#qrCodeModal .alert {
  text-align: left;
  margin-bottom: 0;
  border-radius: var(--radius-md);
}

/* Mobile responsive adjustments */
@media (max-width: 576px) {
  #qrCodeModal .modal-body { padding: var(--space-6); }
  .qr-code-wrapper { padding: var(--space-3); }
}

/* ---- responsive: header actions wrap below title on small screens ---- */
@media (max-width: 767.98px) {
  .box-owner-header .header-body { padding-top: var(--space-6); padding-bottom: var(--space-4); }

  /* Header actions: a deliberate full-width bar. Export / Notifications /
     Settings share a row; Preview (primary) spans full width beneath. */
  .box-owner-actions { margin-top: var(--space-2); width: 100%; }
  .box-owner-actions .btn-group { flex: 1 1 auto; }
  .box-owner-actions .btn-group > .btn { width: 100%; }

  /* Share bar stacks. Critically, reset the url-group flex — its desktop
     flex-basis of 260px otherwise becomes the input's HEIGHT once the bar is
     a column, rendering a ~260px-tall copy box. */
  .share-bar .share-bar-body { align-items: flex-start; flex-direction: column; }
  .share-bar-url-group { flex: 0 0 auto; width: 100%; }
  /* Embedding on your own site isn't a mobile task — hide it on phones. */
  .share-bar-embed { display: none; }

  /* Filters: one horizontally-scrollable line instead of wrapping to rows. */
  .filterContainer .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filterContainer .nav-tabs::-webkit-scrollbar { display: none; }
  .filterContainer .filter-ai-divider { align-self: center; }
}

/* Embed modal — live, auto-scaling preview of the widget */
.embed-preview-stage {
    position: relative;
    height: 240px;
    border: 1px solid var(--border, #d9dee5);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.embed-preview-stage .embed-preview-caption {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 11px;
    color: #9aa4b2;
    text-transform: uppercase;
    letter-spacing: .04em;
    pointer-events: none;
    z-index: 1;
}
#embedPreview {
    border: 0;
    transform-origin: top left;
    background: #fff;
}

/* ---- confirm page: sharing-first ---- */
.confirm-share-page { padding: var(--space-8) var(--space-4); }
.confirm-share-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
}
.confirm-hero { margin-bottom: var(--space-6); }
.confirm-hero-emoji { font-size: 2.5rem; line-height: 1; margin-bottom: var(--space-3); }
.confirm-hero-title { font-size: var(--text-2xl); font-weight: 700; color: var(--ink-1); margin: 0 0 var(--space-2); }
.confirm-hero-sub { color: var(--ink-3); margin: 0; }

/* primary: copy link */
.confirm-copy { display: flex; margin-bottom: var(--space-6); }
.confirm-share-url {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.confirm-share-url:focus { background: var(--surface-0); }
.confirm-copy-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* one-tap share channels */
.confirm-share-label {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: var(--space-3);
}
.confirm-share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.confirm-share-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  color: var(--ink-2);
  font-weight: 600; font-size: var(--text-sm);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.confirm-share-btn img { display: block; }
.confirm-share-btn:hover {
  border-color: var(--brand-300);
  background: var(--brand-50);
  color: var(--brand-700);
  transform: translateY(-1px);
}

/* in-person: QR */
.confirm-qr {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.confirm-qr-img { width: 200px; height: 200px; max-width: 100%; background: #fff; border-radius: var(--radius-sm); }
.confirm-qr-caption { color: var(--ink-3); font-size: var(--text-sm); }
.confirm-qr-save { font-size: var(--text-sm); color: var(--brand-600); text-decoration: none; }
.confirm-qr-save:hover { text-decoration: underline; }

/* secondary actions */
.confirm-secondary { display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.confirm-secondary a { color: var(--ink-3); font-size: var(--text-sm); text-decoration: none; }
.confirm-secondary a:hover { color: var(--brand-700); text-decoration: underline; }
.confirm-sep { color: var(--line); }

@media (max-width: 576px) {
  .confirm-share-grid { grid-template-columns: repeat(2, 1fr); }
  .confirm-share-card { padding: var(--space-6) var(--space-4); }
}
