/* ═══════════════════════════════════════════════════════════════════════════
   ForceLens — Support Portal Stylesheet (support.css)
   Ported from the extension support portal. Scoped under .support-root so it
   inherits the site's design tokens without touching nav/footer/global styles.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Fallbacks for a few tokens the extension used that the site doesn't define. */
.support-root {
  --font-size-sm: 13px;
  --bg-overlay: #E9EEF5;
  --status-neutral: #64748B;
  --border-light: #E2E8F0;
  --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.support-page-shell {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.support-root {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.support-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border-default);
}

.support-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.support-brand .logo-icon {
  width: 44px;
  height: 44px;
}
.support-brand .logo-icon img { width: 44px; height: 44px; display: block; }

.brand-titles h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-titles p {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.support-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
  font-family: inherit;
}

.support-btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border: none;
}
.support-btn-primary:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.support-btn-ghost {
  background: var(--bg-sunken);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  text-decoration: none;
}
.support-btn-ghost:hover {
  background: var(--bg-overlay);
  border-color: var(--border-strong);
}

/* ── Stats Dashboard ─────────────────────────────────────────────────────── */
.support-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}

.support-root .stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.support-root .stat-num.stat-success { color: var(--status-success); }
.support-root .stat-num.stat-info { color: var(--status-info); }
.support-root .stat-num.stat-primary { color: var(--brand-primary); }

.support-root .stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Skeleton shimmer for stats before data loads (no fake numbers). */
.stat-num.is-loading {
  color: transparent;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-overlay) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: support-shimmer 1.2s ease-in-out infinite;
  min-width: 48px;
}
@keyframes support-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Workspace ───────────────────────────────────────────────────────────── */
.support-workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  /* Stretch both columns to equal height so the board's bottom lines up with
     the sidebar's bottom (no empty gap on the right). */
  align-items: stretch;
}

@media (max-width: 900px) {
  .support-workspace {
    grid-template-columns: 1fr;
  }

  /* On a single-column layout, don't pin the sidebar or cap the feed — let the
     page scroll naturally so the form isn't stuck over the board. */
  .support-aside {
    position: static;
    top: auto;
  }

}

.support-aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* Keep the form + contact card in view while the board scrolls. 70px clears
     the sticky site nav. */
  position: sticky;
  top: 86px;
  align-self: start;
}

.support-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* ── Form Tabs ───────────────────────────────────────────────────────────── */
.form-tabs {
  display: flex;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
}

.form-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.form-tab:hover {
  color: var(--text-primary);
  background: var(--bg-overlay);
}
.form-tab.active {
  background: var(--bg-surface);
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

/* ── Form Inputs ─────────────────────────────────────────────────────────── */
.form-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-group input[type="text"],
.field-group input[type="email"],
.field-group textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-group input[type="text"]:focus,
.field-group input[type="email"]:focus,
.field-group textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ── Dropzone ────────────────────────────────────────────────────────────── */
.image-dropzone {
  border: 2px dashed var(--border-default);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s;
}
.image-dropzone:hover {
  border-color: var(--brand-primary);
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--brand-primary) 4%, var(--bg-sunken));
}
.image-dropzone svg {
  color: var(--text-muted);
}

.image-preview-container {
  position: relative;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--bg-sunken);
  max-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-container img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.remove-image-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.remove-image-btn:hover {
  background: var(--status-error);
}

/* ── Contact Card ────────────────────────────────────────────────────────── */
/* A global card rule sets flex-row, which squeezed the title/description/pills
   into 3 cramped columns and forced the email to wrap 4 lines. Force a normal
   vertical stack so each pill spans the full card width. */
.contact-card {
  display: block;
}

.contact-card h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
}

.contact-card p {
  margin: 0 0 16px 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.contact-methods {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;                 /* allow the row to shrink within the card */
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  transition: all 0.2s;
}

/* The long email/version string must wrap inside the pill instead of pushing
   the card wider (which caused the overflow past the sidebar edge). */
.contact-link span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

a.contact-link:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 5%, var(--bg-surface));
}

.contact-link svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Feed Header ─────────────────────────────────────────────────────────── */
.support-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;   /* allow the feed child to scroll within a stretched column */
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.feed-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.feed-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#feed-search {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}
#feed-search:focus {
  border-color: var(--border-focus);
}

/* ── Custom themed dropdown (replaces native <select> filters) ────────────── */

/* Fallback styling for the native select before JS enhances it (and if JS is
   disabled). Once enhanced it's hidden inside .fl-select. */
.feed-filters select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 12px;
  padding: 6px 24px 6px 10px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.feed-filters select:hover { border-color: var(--border-strong); }

/* Wrapper */
.fl-select {
  position: relative;
  display: inline-block;
}

/* The real <select> is kept for the value/change API but hidden visually. */
.fl-select select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

/* Trigger button (the closed dropdown) */
.fl-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  padding: 7px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fl-select-trigger:hover { border-color: var(--border-strong); }
.fl-select-trigger:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.fl-select-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}
.fl-select-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.fl-select.is-open .fl-select-trigger {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.fl-select.is-open .fl-select-chevron {
  transform: rotate(180deg);
}

/* Options panel */
.fl-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 5px;
  list-style: none;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-lg, 0 10px 25px -5px rgba(15, 23, 42, 0.15));
  z-index: 50;
  opacity: 0;
  transform: translateY(-4px);
  visibility: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}
.fl-select.is-open .fl-select-menu {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.fl-select-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.fl-select-option:hover,
.fl-select-option:focus {
  outline: none;
  background: var(--brand-primary-subtle);
  color: var(--brand-primary);
}
.fl-select-option.is-selected {
  background: var(--brand-primary-subtle);
  color: var(--brand-primary);
}
/* Checkmark on the selected row */
.fl-select-option.is-selected::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 16px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ── Feed List & Cards ───────────────────────────────────────────────────── */
/* The board scrolls on its own so a long list (e.g. 100 open bugs) never pushes
   the page down endlessly — the left form and board header stay in view. */
.support-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;

  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 14px 4px 4px;
  margin: -4px -6px -4px -4px;
}

.feed-item {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
  position: relative;
}

.feed-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.feed-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.user-badge {
  font-weight: 700;
  color: var(--text-secondary);
}

.feed-item-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Feed Tags */
.type-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.type-tag-bug {
  background: rgba(239, 68, 68, 0.08);
  color: var(--status-error-text);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.type-tag-feature {
  background: rgba(99, 102, 241, 0.08);
  color: var(--brand-primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.status-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.status-tag-open {
  background: rgba(245, 158, 11, 0.08);
  color: var(--status-warning-text);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.status-tag-fixed {
  background: rgba(16, 185, 129, 0.08);
  color: var(--status-success-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.status-tag-closed {
  background: rgba(100, 116, 139, 0.08);
  color: var(--status-neutral);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* Status dot inside badge */
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.status-dot-fixed  { background: var(--status-success); }
.status-dot-closed { background: var(--status-neutral); }

/* Owner badge inside reply author */
.owner-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  background: var(--status-success);
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Ghost / danger action buttons */
.ghost-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: inherit;
}
.ghost-btn:hover { color: var(--text-primary); background: var(--bg-sunken); }
.danger-btn { color: var(--status-error-text) !important; }
.danger-btn:hover { background: var(--status-error-bg) !important; }

.feed-item-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.feed-item-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
}

.feed-item-steps {
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.steps-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.steps-content {
  font-family: inherit;
  margin: 0;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

/* Screenshot Attachment Thumb */
.feed-item-attachment {
  display: inline-flex;
  margin-top: 4px;
}

.attached-thumb {
  max-width: 140px;
  max-height: 90px;
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  object-fit: cover;
}
.attached-thumb:hover {
  transform: scale(1.03);
  border-color: var(--brand-primary);
}

/* ── Comments / Replies Thread ───────────────────────────────────────────── */
.feed-item-comments {
  margin-top: 8px;
  border-top: 1.5px solid var(--border-default);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comments-header {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-row {
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}

.comment-row-owner {
  background: color-mix(in srgb, var(--status-success) 4%, var(--bg-surface));
  border-color: color-mix(in srgb, var(--status-success) 20%, var(--border-default));
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.comment-author-owner {
  color: var(--status-success-text);
  font-weight: 800;
  background: rgba(16, 185, 129, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.comment-author-user {
  font-weight: 700;
  color: var(--text-secondary);
}

.comment-text {
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0;
  white-space: pre-line;
}

/* Add Comment Form */
.add-comment-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.add-comment-input {
  flex: 1;
  background: var(--bg-sunken);
  border: 1.5px solid var(--border-default);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.add-comment-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
}

.comment-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  font-family: inherit;
}
.comment-btn:hover {
  background: var(--brand-primary-hover);
}

/* Empty / loading state box */
.support-feed-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: 12px;
  font-size: 13px;
}

/* ── Lightbox Overlay ────────────────────────────────────────────────────── */
.support-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.support-lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-light);
}

.support-lightbox-close {
  position: absolute;
  top: -30px;
  right: -30px;
  background: transparent;
  border: none;
  color: white;
  font-size: 32px;
  font-weight: 400;
  cursor: pointer;
  padding: 4px;
}
.support-lightbox-close:hover {
  color: var(--status-error);
}

/* ── Toast Banner ────────────────────────────────────────────────────────── */
#support-banner {
  position: fixed;
  top: 84px;
  right: 16px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 340px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s;
}
