/* SEC & SEDAR Filings feed page — whole-page scroll with a sticky filter
   zone. Page scrolls naturally; filters + count line stick to the top under
   the fixed nav so they stay visible at any scroll depth. */

body {
  background-color: #f7f7f7;
}

.sf-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 80px;     /* bottom padding clears the fixed market-data footer */
  font-family: 'Roboto', sans-serif;
  color: #1f2937;
}

.sf-header {
  margin-bottom: 16px;
  transition: max-height 0.18s ease, opacity 0.18s ease, margin 0.18s ease;
  overflow: hidden;
  max-height: 80px;
}
.sf-title {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}
.sf-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

#sf-upgrade-banner-container:not(:empty) {
  margin-bottom: 12px;
}

/* Sticky zone wraps the filter card + results-header so they stay pinned to
   just below the fixed nav as the page scrolls. Background matches the page
   so result rows scrolling under it aren't visible. */
.sf-sticky-zone {
  position: sticky;
  top: 65px;                  /* clears the fixed desktop nav */
  z-index: 50;
  background-color: #f7f7f7;
  padding-top: 8px;
  padding-bottom: 4px;       /* extends bg below count line so rows scrolling under have breathing room */
  margin: -8px 0 0;
  transition: transform 0.2s ease;
}
.sf-sticky-zone.is-hidden {
  /* Mobile-only: scroll-down reveal pattern. JS toggles this to slide the
     zone out of view while the user is scrolling down, slides it back on
     any upward scroll. */
  transform: translateY(-120%);
}
@media (max-width: 1023px) {
  .sf-sticky-zone {
    top: 56px;                /* mobile nav is shorter */
  }
}

/* Shared card styling — applied to the filter bar and the results list. */
.sf-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.sf-filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  padding: 16px 20px;
  margin-bottom: 8px;
  transition: padding 0.18s ease, gap 0.18s ease;
}
.sf-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.sf-filter-field label {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

/* Autocomplete search wrapper — replaces the previous <sl-input>. Provides
   a styled input with a leading icon, trailing clear button, and a
   positioned dropdown that holds grouped suggestions. */
.sf-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.sf-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  display: flex;
  align-items: center;
  pointer-events: none;
}
#sf-search {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 34px;     /* room for the icon left, clear-button right */
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #ffffff;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#sf-search:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
#sf-search::placeholder {
  color: #9ca3af;
}
.sf-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: #e5e7eb;
  color: #4b5563;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sf-search-clear:hover {
  background: #d1d5db;
  color: #111827;
}
.sf-search-clear[hidden] {
  display: none;
}

.sf-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}
.sf-search-dropdown[hidden] {
  display: none;
}
.sf-sd-header {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  background: #f9fafb;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sf-sd-header svg {
  flex-shrink: 0;
  color: #9ca3af;
}
.sf-sd-header:first-child {
  border-top: none;
}
.sf-sd-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #f9fafb;
}
.sf-sd-item:hover,
.sf-sd-item.is-active {
  background: #f3f4f6;
}
.sf-sd-item mark {
  background: transparent;
  color: inherit;
  font-weight: 600;
}
.sf-sd-item-meta {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
.sf-sd-item-free {
  font-style: italic;
  color: #4b5563;
}
.sf-clear-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 14px;
  cursor: pointer;
  padding: 0 8px;
  height: 38px;
  align-self: end;
}
.sf-clear-btn:hover {
  color: #111827;
}

.sf-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 4px 10px;
  font-size: 13px;
  color: #6b7280;
  transition: margin 0.18s ease;
}
.sf-count {
  font-weight: 600;
  color: #111827;
}

/* Compressed state — once the page has been scrolled past a small threshold,
   collapse the title block and tighten the filter card so the sticky zone
   takes minimum vertical space. */
.sf-page.is-scrolled .sf-header {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
}
.sf-page.is-scrolled .sf-filters {
  padding-top: 10px;
  padding-bottom: 10px;
  gap: 12px;
}
.sf-page.is-scrolled .sf-filter-field label {
  display: none;
}
.sf-page.is-scrolled .sf-results-header {
  margin-top: 2px;
  margin-bottom: 6px;
}

.sf-results {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;             /* clip rows to the card's rounded corners */
}
.sf-row {
  display: grid;
  grid-template-columns: 120px 200px 1fr 100px;
  gap: 16px;
  align-items: start;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.sf-row:last-child {
  border-bottom: none;
}
.sf-row-date {
  color: #6b7280;
  font-size: 13px;
}
.sf-row-category {
  align-self: start;
}
.sf-cat-pill {
  display: inline-block;
  background: var(--sf-cat-bg, #f1f5f9);
  color: var(--sf-cat-fg, #334155);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sf-cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-cat-dot, #94a3b8);
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sf-row-main {
  min-width: 0;
}
.sf-row-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
}
.sf-row-company {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 6px;
}
.sf-row-company a {
  color: #2563eb;
  text-decoration: none;
}
.sf-row-company a:hover {
  text-decoration: underline;
}
.sf-row-excerpt {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sf-row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.sf-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-size: 18px;
  transition: background 0.15s ease;
}
.sf-action-btn:hover {
  background: #e5e7eb;
}
.sf-action-btn--pdf {
  color: #dc2626;
}

.sf-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.sf-loading[hidden] {
  display: none;
}
.sf-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: sf-spin 0.7s linear infinite;
}
@keyframes sf-spin {
  to { transform: rotate(360deg); }
}

.sf-empty {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}
.sf-empty[hidden] {
  display: none;
}
.sf-empty-icon {
  font-size: 36px;
  opacity: 0.5;
  margin-bottom: 8px;
}

.sf-sentinel {
  height: 1px;
}

.sf-foot-hint {
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  margin-top: 16px;
}
.sf-foot-hint[hidden] {
  display: none;
}

/* Scroll-to-top button (visible after 500px of scroll). */
.sf-scroll-top {
  position: fixed;
  right: 32px;
  bottom: 90px;       /* sits above the market-data sticky footer */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #111827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.sf-scroll-top:hover {
  opacity: 1;
  transform: translateY(-2px);
}
.sf-scroll-top[hidden] {
  display: none;
}

/* Category-option prefix dot inside the sl-select dropdown. */
sl-option .sf-opt-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-cat-dot, #94a3b8);
}

/* Mobile-only filters toggle button. Hidden on desktop; the media query
   below flips its display and rearranges the filter card around it. */
.sf-mobile-filter-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  height: 40px;
  padding: 0 12px;
  cursor: pointer;
}
.sf-mobile-filter-toggle:hover {
  background: #f9fafb;
}
.sf-mobile-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
}
.sf-mobile-filter-badge[hidden] {
  display: none;
}
/* Two label/icon pairs live inside the button; CSS picks one based on the
   parent .sf-filters expanded state so the affordance is unambiguous. */
.sf-mft-label,
.sf-mft-icon {
  display: none;
}
.sf-mobile-filter-toggle .sf-mft-icon-filter,
.sf-mobile-filter-toggle .sf-mft-label-default {
  display: inline-flex;
}
.sf-filters.is-expanded .sf-mobile-filter-toggle .sf-mft-icon-filter,
.sf-filters.is-expanded .sf-mobile-filter-toggle .sf-mft-label-default {
  display: none;
}
.sf-filters.is-expanded .sf-mobile-filter-toggle .sf-mft-icon-close,
.sf-filters.is-expanded .sf-mobile-filter-toggle .sf-mft-label-expanded {
  display: inline-flex;
}

@media (max-width: 900px) {
  /* The nav.js market-data disclaimer footer at viewport bottom takes vertical
     space we can't afford on mobile. Hide it so the result list reclaims it. */
  #_footer {
    display: none !important;
  }
  .sf-page {
    /* No fixed footer to reserve space for at narrow widths. */
    padding: 16px 16px 24px;
  }

  /* Filter card: search on the left, mobile-toggle on the right; everything
     else collapses behind the toggle by default. */
  .sf-filters {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
  }

  /* Shrink the search input + filters button to match Shoelace size="small"
     so the filter row claims less vertical space on phones. The sl-select
     components inside get their size flipped via JS on viewport match. */
  #sf-search {
    height: 32px;
    padding: 0 32px 0 30px;
    font-size: 13px;
  }
  .sf-search-icon {
    left: 8px;
  }
  .sf-search-icon svg {
    width: 14px;
    height: 14px;
  }
  .sf-search-clear {
    right: 6px;
    width: 18px;
    height: 18px;
    font-size: 12px;
  }
  .sf-mobile-filter-toggle {
    height: 32px;
    font-size: 12px;
    padding: 0 10px;
    gap: 5px;
  }
  .sf-clear-btn {
    height: 32px;
    font-size: 13px;
  }
  .sf-filters .sf-search-field {
    grid-column: 1 / 2;
  }
  .sf-mobile-filter-toggle {
    display: inline-flex;
    grid-column: 2 / 3;
    align-self: end;
  }
  /* Hide Date Range + Category + Clear by default — revealed by .is-expanded. */
  .sf-filters > .sf-filter-field:not(.sf-search-field),
  .sf-filters > .sf-clear-btn {
    display: none;
  }
  .sf-filters.is-expanded {
    grid-template-columns: 1fr;
  }
  .sf-filters.is-expanded .sf-search-field,
  .sf-filters.is-expanded .sf-mobile-filter-toggle {
    grid-column: 1 / -1;
  }
  .sf-filters.is-expanded .sf-mobile-filter-toggle {
    align-self: stretch;
  }
  .sf-filters.is-expanded > .sf-filter-field:not(.sf-search-field) {
    display: flex;
  }
  .sf-filters.is-expanded > .sf-clear-btn {
    display: inline-block;
    justify-self: start;
    align-self: start;
  }

  /* Compact 3-line result rows. Date + category pill on the meta line, title
     truncated to one line, company + ticker on a third. Actions sit absolute
     in the top-right so the title can claim the full row width. */
  .sf-row {
    display: block;
    position: relative;
    padding: 10px 64px 10px 14px;   /* right padding reserves space for actions */
  }
  .sf-row > .sf-row-date {
    display: inline-block;
    font-size: 11px;
    margin: 0 8px 0 0;
    vertical-align: middle;
  }
  .sf-row > .sf-row-category {
    display: inline-block;
    vertical-align: middle;
  }
  .sf-row > .sf-row-main {
    margin-top: 3px;
  }
  .sf-row-title {
    font-size: 13px;
    margin: 0 0 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sf-row-company {
    font-size: 11px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sf-row-excerpt {
    display: none;
  }
  .sf-row-actions {
    position: absolute;
    top: 8px;
    right: 12px;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-end;
  }
  .sf-action-btn {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
  .sf-cat-pill {
    font-size: 10px;
    padding: 2px 6px;
  }

  /* Pull the header line in tighter on mobile and let the title use its
     available space. */
  .sf-results-header {
    margin: 4px 2px 8px;
    font-size: 12px;
  }

  .sf-scroll-top {
    right: 16px;
    bottom: 20px;        /* no fixed footer to clear at this width */
  }

  /* Mobile sticky zone needs a higher z-index and a solid background since
     it can translate over the top of result rows during the scroll-up reveal. */
  .sf-sticky-zone {
    padding-top: 0;
    padding-bottom: 4px;
    margin: 0;
  }
}
