/* cycle-filters-mobile.css */

/* Hide Mobile Elements on Desktop */
.mobile-bottom-bar,
.mobile-sort-modal,
.mobile-filter-modal {
  display: none;
}

/* Mobile specific overrides */
@media (max-width: 991px) {
  /* Hide Desktop Sidebar */
  .filters-sidebar {
    display: none !important;
  }

  /* Hide Sort Button and its Separator on Mobile Header */
  .sort-button,
  .sort-separator {
    display: none !important;
  }

  /* Horizontal Category Scroll */
  .filter-chips-container {
    width: 100% !important;
    overflow: hidden !important;
    padding: 10px 0;
  }

  .filter-chips-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch; /* Momentum scroll for iOS */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    gap: 8px !important;
    padding-bottom: 5px;
  }

  .filter-chips-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
  }

  .filter-chip {
    flex: 0 0 auto !important; /* Prevent shrinking */
    white-space: nowrap !important;
  }

  /* Sticky Bottom Bar */
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    height: 60px;
    align-items: center;
  }

  .mobile-bar-btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    height: 100%;
    background: none;
    border: none;
    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #303030;
    cursor: pointer;
    position: relative;
  }

  .mobile-bar-btn:first-child {
    border-right: 1px solid #e7eef1;
  }

  .mobile-bar-btn svg {
    width: 18px;
    height: 18px;
    stroke: #303030;
  }

  .filter-count-badge {
    background: #ff4d4d;
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 25%;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  #selected-filters-container {
    display: none !important;
  }

  /* Mobile Sort Modal (Bottom Sheet) */
  .mobile-sort-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    align-items: flex-end; /* Align to bottom */
  }

  .mobile-sort-modal.show {
    display: flex;
  }

  .mobile-sort-content {
    width: 100%;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    padding: 17px 0;
    padding-bottom: 30px;
    animation: slideUp 0.3s ease-out;
    overscroll-behavior: contain;
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .mobile-sort-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 17px 15px;
  }

  .mobile-sort-header h4 {
    margin: 0;
    font-size: 18px;
    color: #303030;
    font-family: "DM Sans", sans-serif;
  }

  .mobile-sort-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 17px;
    font-size: 15px;
    color: #303030;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
  }

  .mobile-sort-option.selected,
  .mobile-sort-option.is-selected {
    color: #00a5f1;
    background-color: #e8f6ff;
    border-radius: 0;
  }

  /* Mobile Filter Modal (Full Screen) */
  .mobile-filter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 1200;
    flex-direction: column;
    overscroll-behavior: contain;
  }

  .mobile-filter-modal.show {
    display: flex;
  }

  .mobile-filter-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid #e7eef1;
    background: #ffffff;
  }

  .mobile-back-btn {
    font-size: 24px;
    color: #303030;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 8px;
  }

  .mobile-filter-header h4 {
    margin: 0;
    font-size: 18px;
    color: #303030;
    font-weight: 700;
  }

  .mobile-filter-body {
    flex: 1;
    display: flex;
    overflow: hidden;
  }

  .mobile-filter-sidebar {
    width: 35%;
    background: #f8f9fa;
    overflow-y: auto;
  }

  .mobile-filter-tab {
    padding: 15px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-left: 3px solid transparent;
  }

  .mobile-filter-tab.active {
    background: #ffffff;
    color: #00a5f1;
    border-left-color: #00a5f1;
  }

  .mobile-filter-content {
    width: 65%;
    padding: 10px;
    overflow-y: auto;
  }

  .mobile-filter-section {
    display: none;
  }

  .mobile-filter-section.active {
    display: block;
  }

  .mobile-filter-section .filter-item {
    margin-bottom: 0px !important;
    padding: 7px;
    border-radius: 8px;
    transition: background-color 0.2s;
  }

  .mobile-filter-footer {
    padding: 15px;
    border-top: 1px solid #e7eef1;
    text-align: center;
  }

  .mobile-apply-btn {
    width: 100%;
    background: #00a5f1;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 16px;
  }

  body.modal-open {
    overflow: hidden !important;
    height: 100vh !important;
    touch-action: none;
  }

  /* Allow touch action on the modal content themselves */
  .mobile-sort-content,
  .mobile-filter-modal {
    touch-action: pan-y;
  }
}
