/* ==========================================================================
   Quotation Formats — 02 Filter Template (sidebar filters + card grid)
   Paste into the block's WP Coder shortcode (CSS tab), or WPCode > CSS Snippet.
   Fully scoped to .vyq-filter-template — safe to load on any page, in any order.

   The markup is native Gutenberg blocks, so this file also restyles the core
   wrappers WordPress emits: .wp-block-columns, .wp-block-buttons,
   .wp-block-button__link and the <figure> around every image.
   ========================================================================== */

/* --- Design tokens (scoped: they never leak to the rest of the page) ------ */
.vyq-filter-template {
  --vyq-primary: #ED1A3B !important;
  --vyq-primary-light: #FDECEF !important;
  --vyq-primary-lighter: #FEF5F7 !important;
  --vyq-text: #1F2937 !important;
  --vyq-text-mid: #4B5563 !important;
  --vyq-text-light: #6B7280 !important;
  --vyq-bg-soft: #FAFAFA !important;
  --vyq-bg-card: #F9FAFB !important;
  --vyq-border: #E5E7EB !important;
  --vyq-border-light: #F3F4F6 !important;
  --vyq-white: #FFFFFF !important;
  --vyq-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  --vyq-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
  --vyq-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* --- Base ----------------------------------------------------------------- */
.vyq-filter-template,
.vyq-filter-template * {
  box-sizing: border-box !important;
  /* Reset only has to beat the theme defaults. Equal specificity to the
     rules below, so it must stay first in the file — they re-apply the
     spacing this block actually wants. */
  margin: 0 !important;
  padding: 0 !important;
}

/* --- Classic-theme group wrapper ------------------------------------------
   On a classic theme (Sydney), WordPress wraps every group block's children in
   an extra .wp-block-group__inner-container div at render time — it is not in
   the pasted markup. That wrapper would be the only child of our grid/flex
   containers, so every layout below would collapse to one column.
   display: contents takes it out of the layout without removing it. */
.vyq-filter-template .wp-block-group__inner-container {
  display: contents !important;
}

.vyq-filter-template {
  font-family: var(--vyq-font) !important;
  color: var(--vyq-text) !important;
  line-height: 1.6 !important;
  background: var(--vyq-bg-soft) !important;
  padding: 48px 0 !important;
  overflow: visible !important;
}

/* --- Layout (core columns block) ------------------------------------------ */
.vyq-filter-template-layout {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 0 24px !important;
  display: grid !important;
  grid-template-columns: 240px 1fr !important;
  gap: 32px !important;
  align-items: start !important;
  overflow: visible !important;
}

/* WordPress writes inline flex-basis on .wp-block-column — the grid above owns
   the widths, so neutralise it */
.vyq-filter-template-layout > .wp-block-column {
  flex-basis: auto !important;
  max-width: none !important;
  min-width: 0 !important;
}

/* --- Sidebar -------------------------------------------------------------- */
.vyq-filter-template-sidebar {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 90px !important;
  align-self: start !important;
  height: fit-content !important;
  max-height: none !important;
  overflow: visible !important;
  background: var(--vyq-white) !important;
  border: 1px solid var(--vyq-border) !important;
  border-radius: 12px !important;
  padding: 24px 20px !important;
  box-shadow: var(--vyq-shadow-sm) !important;
}

.vyq-filter-template-sidebar-title {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-family: var(--vyq-font) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--vyq-text) !important;
  margin-bottom: 6px !important;
}

.vyq-filter-template-sidebar-title::before {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ED1A3B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z'/%3E%3C/svg%3E") !important;
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 0 !important;
  flex-shrink: 0 !important;
}

.vyq-filter-template-sidebar-sub {
  font-size: 12px !important;
  color: var(--vyq-text-light) !important;
  margin-bottom: 18px !important;
}

.vyq-filter-template-filter-group {
  margin-bottom: 22px !important;
}

.vyq-filter-template-filter-group:last-of-type {
  margin-bottom: 16px !important;
}

.vyq-filter-template-filter-label {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--vyq-text-mid) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  margin-bottom: 10px !important;
}

/* --- Filters (core buttons block, stacked) -------------------------------- */
.vyq-filter-template-filter-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.vyq-filter-template-filter {
  width: 100% !important;
}

.vyq-filter-template-filter .wp-block-button__link {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  padding: 8px 10px !important;
  /* Sydney Pro forces border-radius: 25px and a fill on buttons */
  background: transparent !important;
  border: none !important;
  border-radius: 6px !important;
  color: var(--vyq-text-mid) !important;
  font-family: var(--vyq-font) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  text-align: left !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.vyq-filter-template-filter .wp-block-button__link:hover {
  background: var(--vyq-primary-lighter) !important;
  color: var(--vyq-text) !important;
}

.vyq-filter-template-filter.vyq-is-active .wp-block-button__link {
  background: var(--vyq-primary-light) !important;
  color: var(--vyq-primary) !important;
  font-weight: 600 !important;
}

/* The count pill is injected by the JS, so editors never maintain the numbers */
.vyq-filter-template-filter-count {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--vyq-text-light) !important;
  background: var(--vyq-bg-card) !important;
  padding: 2px 8px !important;
  border-radius: 10px !important;
  flex-shrink: 0 !important;
  margin-left: 8px !important;
}

.vyq-filter-template-filter.vyq-is-active .vyq-filter-template-filter-count {
  background: var(--vyq-primary) !important;
  color: var(--vyq-white) !important;
}

.vyq-filter-template-reset-wrap {
  display: block !important;
  margin-top: 8px !important;
}

.vyq-filter-template-reset .wp-block-button__link {
  display: block !important;
  width: 100% !important;
  padding: 9px !important;
  background: var(--vyq-bg-card) !important;
  color: var(--vyq-text-mid) !important;
  border: 1px solid var(--vyq-border) !important;
  border-radius: 6px !important;
  font-family: var(--vyq-font) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-align: center !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.vyq-filter-template-reset .wp-block-button__link:hover {
  background: var(--vyq-white) !important;
  border-color: var(--vyq-primary) !important;
  color: var(--vyq-primary) !important;
}

/* --- Main column ---------------------------------------------------------- */
.vyq-filter-template-main {
  min-width: 0 !important;
}

.vyq-filter-template-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  margin-bottom: 20px !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--vyq-border-light) !important;
}

.vyq-filter-template-title {
  font-family: var(--vyq-font) !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  color: var(--vyq-text) !important;
}

.vyq-filter-template-count {
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--vyq-text-light) !important;
}

.vyq-filter-template-count strong {
  color: var(--vyq-primary) !important;
  font-weight: 700 !important;
}

.vyq-filter-template-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 20px !important;
}

/* --- Cards ---------------------------------------------------------------- */
.vyq-filter-template-card {
  display: flex !important;
  flex-direction: column !important;
  background: var(--vyq-white) !important;
  border: 1px solid var(--vyq-border) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  transition: all 0.25s ease !important;
}

/* Filtering toggles a class — inline styles would lose to the !important above */
.vyq-filter-template-card.vyq-is-hidden {
  display: none !important;
}

.vyq-filter-template-card:hover {
  box-shadow: var(--vyq-shadow-md) !important;
  transform: translateY(-2px) !important;
  border-color: var(--vyq-primary-light) !important;
}

/* The class sits on the core image block's <figure> */
.vyq-filter-template-card-media {
  aspect-ratio: 3 / 4 !important;
  background: var(--vyq-bg-soft) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 14px !important;
  overflow: hidden !important;
  border-bottom: 1px solid var(--vyq-border-light) !important;
}

/* WordPress writes width/height attributes on uploads — override them here */
.vyq-filter-template-card-media img {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  display: block !important;
}

.vyq-filter-template-card-body {
  flex: 1 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 14px !important;
}

.vyq-filter-template-card-info {
  min-width: 0 !important;
}

.vyq-filter-template-card-title {
  font-family: var(--vyq-font) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--vyq-text) !important;
  line-height: 1.3 !important;
  letter-spacing: normal !important;
  margin-bottom: 4px !important;
}

.vyq-filter-template-card-format {
  font-size: 10px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.6px !important;
}

.vyq-filter-template-card-format--word {
  color: #2563EB !important;
}

.vyq-filter-template-card-format--excel {
  color: #059669 !important;
}

.vyq-filter-template-card-format--pdf {
  color: #ED1A3B !important;
}

.vyq-filter-template-card-actions {
  flex-shrink: 0 !important;
}

/* The button keeps its "Download" label so it reads clearly in the editor;
   on the front end the label collapses and the icon below stands in for it.
   Screen readers still announce the text. */
.vyq-filter-template-card-download .wp-block-button__link {
  width: 36px !important;
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: var(--vyq-primary-light) !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 0 !important;
  line-height: 0 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.vyq-filter-template-card-download .wp-block-button__link::before {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ED1A3B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3'/%3E%3C/svg%3E") !important;
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 0 !important;
}

.vyq-filter-template-card-download .wp-block-button__link:hover {
  background: var(--vyq-primary) !important;
  transform: translateY(-1px) !important;
}

/* Swap the icon to white on hover — a data URI cannot inherit currentColor */
.vyq-filter-template-card-download .wp-block-button__link:hover::before {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3'/%3E%3C/svg%3E") !important;
}

/* --- Empty state (hidden until the JS finds no matches) ------------------- */
.vyq-filter-template-empty {
  display: none !important;
  grid-column: 1 / -1 !important;
  text-align: center !important;
  padding: 60px 20px !important;
  background: var(--vyq-white) !important;
  border: 1px dashed var(--vyq-border) !important;
  border-radius: 10px !important;
}

.vyq-filter-template-empty.vyq-is-visible {
  display: block !important;
}

.vyq-filter-template-empty-title {
  font-family: var(--vyq-font) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--vyq-text) !important;
  margin-bottom: 6px !important;
}

.vyq-filter-template-empty-text {
  font-size: 13px !important;
  color: var(--vyq-text-light) !important;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 992px) {
  .vyq-filter-template-layout {
    grid-template-columns: 1fr !important;
  }
  .vyq-filter-template-sidebar {
    position: static !important;
  }
  .vyq-filter-template-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .vyq-filter-template {
    padding: 36px 0 !important;
  }
  .vyq-filter-template-layout {
    padding: 0 16px !important;
  }
  .vyq-filter-template-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
  .vyq-filter-template-grid {
    grid-template-columns: 1fr !important;
  }
}
