/* 
 * Ultimate Product Filters - Mobile Screens and Drawer Drawer Layouts 
 */

@media (max-width: 768px) {
  
  /* Reset Structural Layout to Columns */
  .upf-pro-wrapper {
    flex-direction: column;
    gap: var(--upf-spacing-md, 16px);
  }

  /* Absolute Positioned Off-canvas Filtering Drawer Panel */
  .upf-pro-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85vw;
    max-width: 320px;
    height: 100vh;
    overflow-y: auto;
    z-index: 99999;
    background: var(--upf-bg, #ffffff);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transition: left var(--upf-transition, 0.3s ease);
    padding: var(--upf-spacing-lg, 24px) var(--upf-spacing-md, 16px);
    border-radius: 0;
    border: none;
  }

  /* Open state class for off-canvas drawer */
  .upf-pro-sidebar.is-open {
    left: 0;
  }

  /* Overlay cover back backdrop */
  .upf-pro-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--upf-transition, 0.3s ease);
  }

  .upf-pro-drawer-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
  }

  /* Displays mobile filter button hook */
  .upf-pro-mobile-toggle {
    display: none !important;
  }

  .upf-pro-mobile-toggle:hover {
    background: var(--upf-accent-hover, #135e96);
  }

  /* Close drawer button */
  .upf-pro-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: var(--upf-bg-hover, #f6f7f7);
    border: 1px solid var(--upf-border, #dcdcde);
    border-radius: 50%;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--upf-text-muted, #72777c);
    transition: all var(--upf-transition, 0.2s ease);
    z-index: 100000;
  }

  .upf-pro-drawer-close:hover {
    background: var(--upf-accent, #2271b1);
    color: var(--upf-accent-text, #ffffff);
    border-color: var(--upf-accent, #2271b1);
  }
}

/* RTL (Right-to-Left) Language Direction Supports */
[dir="rtl"] .upf-pro-sidebar {
  left: auto;
  right: -100%;
}

[dir="rtl"] .upf-pro-sidebar.is-open {
  right: 0;
  left: auto;
}

[dir="rtl"] .upf-pro-drawer-close {
  right: auto;
  left: 12px;
}

[dir="rtl"] .upf-pro-group-arrow {
  transform: rotate(180deg);
}

[dir="rtl"] .upf-pro-search-input {
  padding: 8px 12px 8px 36px;
}

[dir="rtl"] .upf-pro-search-icon {
  right: auto;
  left: 12px;
}
