/**
 * @file
 * Mobile Filter Toggle — Generic styles.
 * Works with the mobile-filters.js behavior.
 *
 * Classes applied by JS:
 *   .mft-toggle        — the injected toggle button
 *   .mft-panel         — the filter container (sidebar/aside)
 *   .mft-panel--open   — open state
 *   .mft-toggle__badge — active filter count badge
 */

/* ── Toggle button — hidden on desktop ──────────────────────────────────── */
.mft-toggle {
  display: none;
}

@media (max-width: 768px) {

  /* ── Toggle button ────────────────────────────────────────────────────── */
  .mft-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0a0a0a;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: 'Inter', sans-serif;
  }

  .mft-toggle:hover {
    background: #f3f4f6;
    border-color: #d4d4d4;
  }

  .mft-toggle:focus-visible {
    outline: 3px solid #b91c1c;
    outline-offset: 2px;
  }

  .mft-toggle__label {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mft-toggle__chevron {
    transition: transform 0.25s ease;
    flex-shrink: 0;
  }

  .mft-toggle[aria-expanded="true"] .mft-toggle__chevron {
    transform: rotate(180deg);
  }

  /* Active filter badge */
  .mft-toggle__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #b91c1c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    line-height: 1;
  }

  /* ── Panel collapse ────────────────────────────────────────────────────── */

  /* Any known filter panel/sidebar gets the collapse behaviour */
  .mft-panel,
  .ai-listing__sidebar,
  .roac-sidebar,
  .fc-sidebar,
  .peh-sidebar,
  .verificacion-filter-panel,
  .coesadir-filter-panel,
  .proc-sidebar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.2s ease;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
  }

  /* Open state */
  .mft-panel.mft-panel--open,
  .ai-listing__sidebar.mft-panel--open,
  .roac-sidebar.mft-panel--open,
  .fc-sidebar.mft-panel--open,
  .peh-sidebar.mft-panel--open,
  .verificacion-filter-panel.mft-panel--open,
  .coesadir-filter-panel.mft-panel--open,
  .proc-sidebar.mft-panel--open {
    max-height: 1200px;
    overflow: visible;
  }

  /* Ensure sidebars go full-width in mobile layout */
  .ai-listing__sidebar,
  .roac-sidebar,
  .fc-sidebar,
  .peh-sidebar,
  .verificacion-filter-panel,
  .coesadir-filter-panel,
  .proc-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    position: static !important; /* remove sticky */
    flex-shrink: 0;
  }

  /* Two-column layouts (sidebar + content) become single column */
  .ai-listing__layout,
  .fc-listing__content,
  .peh-listing__layout,
  .verificacion-main__content,
  .coesadir-layout,
  .proc-layout,
  .roac-content {
    flex-direction: column !important;
  }
}
