/* Native Mobile App Filter Styles */
/* Isolated styles for search_box.html mobile filter */
/* All classes prefixed with 'nf-' to avoid conflicts */

/* Only apply on mobile */
@media (max-width: 767px) {
  /* Hide modern search container on mobile when native filter is used */
  #searchContainer {
    display: none !important;
  }
  
  /* Native Filter Container */
  .nf-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-tertiary);
    z-index: var(--z-modal);
    display: none;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
  }

  .nf-container.active {
    display: flex;
    transform: translateX(0);
  }

  /* Native Filter Header */
  .nf-header {
    background: var(--primary-blue);
    color: var(--color-text-inverse);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: relative;
    flex-shrink: 0;
  }

  .nf-back-btn {
    background: none;
    border: none;
    color: var(--color-text-inverse);
    font-size: 20px;
    padding: 8px;
    margin-left: -8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .nf-back-btn:active {
    background: rgba(255, 255, 255, 0.1);
  }

  .nf-header-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    letter-spacing: 0.5px;
  }

  /* Native Filter Body */
  .nf-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px;
  }

  /* Filter Fields */
  .nf-field {
    margin-bottom: 16px;
  }

  .nf-field-label {
    display: block;
    font-size: 12px;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-weight: 500;
  }

  .nf-dropdown {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text-primary);
    min-height: 48px;
    width: 100%;
    text-align: left;
    position: relative;
  }

  .nf-dropdown:active {
    background: var(--color-bg-secondary);
  }

  .nf-dropdown-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nf-dropdown-icon {
    color: var(--color-text-tertiary);
    font-size: 12px;
    margin-left: 8px;
  }

  /* Native Dropdown Menu */
  .nf-dropdown-menu {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 100%;
    margin-top: 4px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: var(--z-popover);
    display: none;
  }

  .nf-dropdown-menu.active {
    display: block;
  }

  .nf-dropdown-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
  }

  .nf-dropdown-item:last-child {
    border-bottom: none;
  }

  .nf-dropdown-item:active,
  .nf-dropdown-item.selected {
    background: var(--primary-blue-50);
    color: var(--primary-blue);
  }

  /* Filter Sections */
  .nf-section {
    margin-top: 24px;
  }

  .nf-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .nf-helper {
    font-size: 13px;
    color: var(--danger);
    font-weight: 400;
  }

  /* Native Chip Grid */
  .nf-chip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px;
  }

  /* Native Chip Style */
  .nf-chip {
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 10px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--color-text-primary);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
  }

  .nf-chip-text {
    font-size: 12px;
    line-height: 1.2;
  }

  .nf-chip:active {
    transform: scale(0.95);
  }

  .nf-chip.selected {
    background: var(--primary-blue-50);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
  }

  .nf-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  /* Apply Button Footer */
  .nf-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: var(--color-bg-primary);
    border-top: 1px solid var(--color-border-primary);
  }

  .nf-apply-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-blue);
    color: var(--color-text-inverse);
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
  }

  .nf-apply-btn:active {
    background: var(--primary-blue-dark);
    transform: scale(0.98);
  }

  /* Hide body scroll when filter is active */
  body.nf-active {
    overflow: hidden;
  }

  /* Transition animations */
  @keyframes nfSlideIn {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }

  @keyframes nfSlideOut {
    from {
      transform: translateX(0);
    }
    to {
      transform: translateX(100%);
    }
  }

  .nf-container.animating-in {
    animation: nfSlideIn 0.3s ease-out forwards;
  }

  .nf-container.animating-out {
    animation: nfSlideOut 0.3s ease-in forwards;
  }

  /* Mobile specific adjustments */
  @media (max-width: 375px) {
    .nf-chip-text {
      font-size: 11px;
    }
    
    .nf-chip-grid {
      gap: 8px;
    }

    .nf-chip {
      min-height: 36px;
      padding: 8px 6px;
    }
  }

  /* Ensure dropdowns are properly positioned */
  .nf-field {
    position: relative;
  }

  /* Loading state */
  .nf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--color-text-tertiary);
  }

  .nf-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-100);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: nfSpin 0.8s linear infinite;
  }

  @keyframes nfSpin {
    to {
      transform: rotate(360deg);
    }
  }
}

/* Ensure desktop is not affected */
@media (min-width: 768px) {
  .nf-container {
    display: none !important;
  }
  
  .mobile-search-collapsed {
    display: none !important;
  }
}