/* ============================================
   DJY Mobile Filter Drawer - Styles
   ============================================ */

/* ============================================
   Mobile Filter Button
   ============================================ */
.filtermobile {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  transition: background 0.2s ease;
}

.filtermobile:hover {
  background: #f8f8f8;
}

.filtermobile:active {
  background: #f0f0f0;
}

/* Show button on mobile and tablet only */
@media (max-width: 991px) {
  .filtermobile {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ============================================
   Drawer Overlay (backdrop)
   ============================================ */
.filter-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.filter-drawer-overlay.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   Drawer Container
   ============================================ */
.filter-drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  background: #ffffff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}

.filter-drawer.open {
  visibility: visible;
  transform: translateX(0);
}

/* Drawer header */
.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f8f8;
  flex-shrink: 0;
}

.filter-drawer-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.filter-drawer-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #666;
  transition: all 0.2s ease;
}

.filter-drawer-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #333;
}

.filter-drawer-close:active {
  background: rgba(0, 0, 0, 0.12);
}

/* Drawer content (scrollable) */
.filter-drawer-content {
  flex: 1 1 auto;
  min-height: 0; /* Important for flex scrolling */
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* Prevent scroll chaining */
}

/* Filter controls inside drawer - add spacing */
.filter-drawer-content > * {
  margin-bottom: 20px;
}

.filter-drawer-content > *:last-child {
  margin-bottom: 0;
}

/* ============================================
   CRITICAL: Force filter container to be visible
   when inside drawer (overrides mobile display:none)
   ============================================ */
.filter-drawer-content .filter-controls-main,
.filter-drawer-content > .filter-controls-main {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .filter-drawer {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   Desktop: Hide drawer completely
   ============================================ */
@media (min-width: 992px) {
  .filter-drawer-overlay {
    display: none !important;
  }
  .filter-drawer {
    visibility: hidden !important;
    transform: translateX(-100%) !important;
  }
}
