/* =====================================================
   PURESTORA BOTTOM SHEET FILTER SYSTEM
   Modern Mobile-First Filter Experience
   ===================================================== */

/* =====================================================
   1. FLOATING ACTION BUTTON (FAB)
   ===================================================== */

   .filter-fab-container {
    position: fixed;
    bottom: 80px; /* Above mobile nav (64px + 16px spacing) */
    right: 20px;
    z-index: 999;
    display: none; /* Hidden by default, shown only on mobile */
  }
  
  .filter-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #996633 0%, #8B5D47 100%);
    color: #fff;
    border: none;
    box-shadow: 
      0 4px 12px rgba(153, 102, 51, 0.3),
      0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
  }
  
  .filter-fab i {
    font-size: 22px;
    transition: transform 0.3s ease;
  }
  
  .filter-fab:hover {
    transform: scale(1.08);
    box-shadow: 
      0 6px 16px rgba(153, 102, 51, 0.4),
      0 4px 8px rgba(0, 0, 0, 0.2);
  }
  
  .filter-fab:active {
    transform: scale(0.95);
  }
  
  /* Active Filter Badge on FAB */
  .filter-fab .filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #AFBD77;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
    animation: badge-pulse 2s infinite;
  }
  
  @keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
  }
  
  /* =====================================================
     2. BOTTOM SHEET OVERLAY
     ===================================================== */
  
  .bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
  }
  
  .bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* =====================================================
     3. BOTTOM SHEET CONTAINER
     ===================================================== */
  
  .bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 85vh;
    background: #fff;
    border-radius: 24px 24px 0 0;
    z-index: 1051;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
      0 -4px 24px rgba(0, 0, 0, 0.12),
      0 -2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .bottom-sheet.active {
    transform: translateY(0);
  }
  
  /* =====================================================
     4. BOTTOM SHEET HEADER
     ===================================================== */
  
  .bottom-sheet-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    position: relative;
  }
  
  /* Drag Handle */
  .bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 12px;
    cursor: grab;
  }
  
  .bottom-sheet-handle:active {
    cursor: grabbing;
  }
  
  /* Header Title and Actions */
  .bottom-sheet-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .bottom-sheet-title {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
    margin: 0;
  }
  
  .bottom-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #848688;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
  }
  
  .bottom-sheet-close:hover {
    background: #f5f5f5;
    color: #212529;
  }
  
  .bottom-sheet-close i {
    font-size: 20px;
  }
  
  /* =====================================================
     5. TAB SYSTEM (Sort | Filters)
     ===================================================== */
  
  .bottom-sheet-tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin: 0;
    padding: 0 20px;
    gap: 8px;
    flex-shrink: 0;
  }
  
  .bottom-sheet-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #848688;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
    border-radius: 8px 8px 0 0;
  }
  
  .bottom-sheet-tab:hover {
    color: #996633;
    background: #f9f9f9;
  }
  
  .bottom-sheet-tab.active {
    color: #996633;
    font-weight: 600;
  }
  
  .bottom-sheet-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #996633 0%, #AFBD77 100%);
    border-radius: 2px 2px 0 0;
  }
  
  /* =====================================================
     6. BOTTOM SHEET CONTENT AREA
     ===================================================== */
  
  .bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Custom Scrollbar */
  .bottom-sheet-content::-webkit-scrollbar {
    width: 6px;
  }
  
  .bottom-sheet-content::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
  }
  
  .bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
  }
  
  .bottom-sheet-content::-webkit-scrollbar-thumb:hover {
    background: #ccc;
  }
  
  /* Tab Content Panels */
  .tab-content-panel {
    display: none;
    animation: fadeIn 0.3s ease;
  }
  
  .tab-content-panel.active {
    display: block;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* =====================================================
     7. SORT OPTIONS STYLING
     ===================================================== */
  
  .sort-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .sort-option {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid #e4e4e4;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
  }
  
  .sort-option:hover {
    background: #f9f9f9;
    border-color: #996633;
  }
  
  .sort-option.active {
    background: linear-gradient(135deg, #AFBD77 0%, #90AD46 100%);
    border-color: #996633;
    box-shadow: 0 2px 8px rgba(153, 102, 51, 0.15);
  }
  
  .sort-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #996633;
  }
  
  .sort-option label {
    font-size: 15px;
    font-weight: 500;
    color: #212529;
    cursor: pointer;
    flex: 1;
    margin: 0;
  }
  
  .sort-option.active label {
    color: #fff;
    font-weight: 600;
  }
  
  /* =====================================================
     8. FILTER GROUPS STYLING
     ===================================================== */
  
  .filter-group {
    margin-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 20px;
  }
  
  .filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  
  .filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
  }
  
  .filter-group-title {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    margin: 0;
  }
  
  .filter-group-toggle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  
  .filter-group-toggle i {
    font-size: 12px;
    color: #848688;
    transition: transform 0.3s ease;
  }
  
  .filter-group.collapsed .filter-group-toggle i {
    transform: rotate(-90deg);
  }
  
  .filter-group-header:hover .filter-group-toggle {
    background: #e8e8e8;
  }
  
  /* Filter Group Content */
  .filter-group-content {
    padding-top: 12px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }
  
  .filter-group.collapsed .filter-group-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
  }
  
  /* Search Box in Filters */
  .filter-search-box {
    position: relative;
    margin-bottom: 12px;
  }
  
  .filter-search-box input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
  }
  
  .filter-search-box input:focus {
    outline: none;
    border-color: #996633;
    box-shadow: 0 0 0 3px rgba(153, 102, 51, 0.1);
  }
  
  .filter-search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #848688;
    font-size: 14px;
  }
  
  /* Filter Options List */
  .filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
  }
  
  .filter-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
    cursor: pointer;
  }
  
  .filter-option:hover {
    background: #f9f9f9;
  }
  
  .filter-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #996633;
  }
  
  .filter-option label {
    font-size: 14px;
    color: #212529;
    cursor: pointer;
    flex: 1;
    margin: 0;
  }
  
  .filter-option input:checked + label {
    font-weight: 600;
    color: #996633;
  }
  
  /* Price Range Inputs */
  .price-range-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
  }
  
  .price-input-group {
    flex: 1;
  }
  
  .price-input-group label {
    display: block;
    font-size: 13px;
    color: #848688;
    margin-bottom: 6px;
    font-weight: 500;
  }
  
  .price-input-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease;
  }
  
  .price-input-group select:focus {
    outline: none;
    border-color: #996633;
    box-shadow: 0 0 0 3px rgba(153, 102, 51, 0.1);
  }
  
  /* =====================================================
     9. BOTTOM SHEET FOOTER (Action Buttons)
     ===================================================== */
  
  .bottom-sheet-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  }
  
  .bottom-sheet-actions {
    display: flex;
    gap: 12px;
  }
  
  .btn-clear-filters,
  .btn-apply-filters {
    flex: 1;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  
  .btn-clear-filters {
    background: #fff;
    color: #848688;
    border: 2px solid #e4e4e4;
  }
  
  .btn-clear-filters:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #212529;
  }
  
  .btn-apply-filters {
    background: linear-gradient(135deg, #996633 0%, #8B5D47 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(153, 102, 51, 0.25);
  }
  
  .btn-apply-filters:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(153, 102, 51, 0.35);
  }
  
  .btn-apply-filters:active {
    transform: translateY(0);
  }
  
  /* =====================================================
     10. ACTIVE FILTER CHIPS (Below Search)
     ===================================================== */
  
  .active-filters-section {
    padding: 0 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: none; /* Hidden when no filters */
  }
  
  .active-filters-section.has-filters {
    display: block;
  }
  
  .active-filters-label {
    font-size: 13px;
    color: #848688;
    margin-bottom: 8px;
    font-weight: 500;
  }
  
  .active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #AFBD77 0%, #90AD46 100%);
    color: #fff;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(153, 102, 51, 0.15);
  }
  
  .filter-chip-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
    font-size: 10px;
  }
  
  .filter-chip-remove:hover {
    background: rgba(255, 255, 255, 0.5);
  }
  
  /* =====================================================
     11. RESPONSIVE BREAKPOINTS
     ===================================================== */
  
  /* Show FAB only on mobile/tablet */
  @media (max-width: 991px) {
    .filter-fab-container {
      display: block;
    }
    
    /* Hide desktop filter sidebar */
    .store-wrapper.col-xl-3.col-lg-3 {
      display: none !important;
    }
    
    /* Make product grid full width */
    .result-block.col-md-9 {
      flex: 0 0 100%;
      max-width: 100%;
    }
  }
  
  /* Tablet adjustments */
  @media (min-width: 768px) and (max-width: 991px) {
    .bottom-sheet {
      max-height: 75vh;
    }
    
    .bottom-sheet-content {
      padding: 24px;
    }
    
    .filter-options {
      max-height: 300px;
    }
  }
  
  /* Large mobile optimization */
  @media (min-width: 480px) and (max-width: 767px) {
    .filter-fab {
      width: 64px;
      height: 64px;
    }
    
    .filter-fab i {
      font-size: 24px;
    }
  }
  
  /* Small mobile optimization */
  @media (max-width: 479px) {
    .bottom-sheet {
      max-height: 90vh;
    }
    
    .bottom-sheet-header {
      padding: 14px 16px 10px;
    }
    
    .bottom-sheet-title {
      font-size: 18px;
    }
    
    .bottom-sheet-content {
      padding: 16px;
    }
    
    .bottom-sheet-footer {
      padding: 14px 16px;
    }
    
    .filter-group-title {
      font-size: 15px;
    }
    
    .sort-option,
    .filter-option {
      padding: 12px 14px;
    }
  }
  
  /* Desktop - hide all bottom sheet components */
  @media (min-width: 992px) {
    .filter-fab-container,
    .bottom-sheet-overlay,
    .bottom-sheet {
      display: none !important;
    }
  }
  
  /* =====================================================
     12. ACCESSIBILITY & SMOOTH INTERACTIONS
     ===================================================== */
  
  /* Focus states for keyboard navigation */
  .filter-fab:focus,
  .bottom-sheet-close:focus,
  .bottom-sheet-tab:focus,
  .sort-option:focus,
  .filter-option:focus,
  .btn-clear-filters:focus,
  .btn-apply-filters:focus {
    outline: 3px solid rgba(153, 102, 51, 0.3);
    outline-offset: 2px;
  }
  
  /* Reduce motion for accessibility */
  @media (prefers-reduced-motion: reduce) {
    .bottom-sheet,
    .bottom-sheet-overlay,
    .tab-content-panel,
    .filter-group-content {
      transition: none !important;
      animation: none !important;
    }
  }
  
  /* Touch target sizing (minimum 44x44px) */
  .bottom-sheet-tab,
  .sort-option,
  .filter-option,
  .filter-chip-remove {
    min-height: 44px;
  }
  
  /* Prevent text selection during interactions */
  .bottom-sheet-header,
  .bottom-sheet-tabs,
  .sort-option,
  .filter-option {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
  }
  
  /* Safe area insets for iOS devices */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-sheet-footer {
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    
    .filter-fab-container {
      bottom: calc(80px + env(safe-area-inset-bottom));
    }
  }
  
  /* =====================================================
     13. LOADING STATES
     ===================================================== */
  
  .bottom-sheet-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
  }
  
  .bottom-sheet.loading .bottom-sheet-loading {
    display: block;
  }
  
  .bottom-sheet.loading .bottom-sheet-content {
    opacity: 0.5;
    pointer-events: none;
  }
  
  /* Spinner animation */
  .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #996633;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* =====================================================
     END OF BOTTOM SHEET STYLES
     ===================================================== */