/* =====================================================================
   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: 6px 14px;
  margin-right: var(--space-1);
  color: var(--ink-3);
  font-weight: 500;
  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 20px side padding, double-indenting the suggestion
   text past the card's own padding; zero it so content aligns with the card edge
   (and the AI insights / share bar content above). */
.suggestion-card-body { margin-bottom: 0; padding-left: 0; padding-right: 0; }
.suggestion-meta { margin-bottom: var(--space-2); }
.suggestion-time {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-3);
}
.suggestion-sentiment-chip {
  color: var(--brand-accent) !important;
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 25%, white);
}
.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: indented behind a hairline (also styles JS-appended replies) */
.suggestionContainer .suggestion-reply {
  border-left: 2px solid var(--line);
  margin: var(--space-3) 0 0 var(--space-2);
  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-actions { color: var(--ink-3); margin-top: var(--space-2); }
.suggestion-actions .fe { font-size: 1rem; transition: color var(--dur-fast) var(--ease-out); }
.suggestion-actions .hand:hover .fe, .suggestion-actions a:hover .fe { color: var(--brand-600); }
.suggestionContainer .on { color: var(--success); }

/* =====================================================================
   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); }
  .box-owner-actions { margin-top: var(--space-2); }
  .share-bar .share-bar-body { align-items: flex-start; flex-direction: column; }
  .share-bar-url-group { width: 100%; }
}

/* 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); }
}
